Elektrod & RigRanger
RigRanger RigRanger
Hey, I’ve been drafting a rig integrity checker that scans for dangling constraints and mismatched driver weights, and I’d love to get your take on the logic flow—especially the parts that catch non‑hierarchical control dependencies.
Elektrod Elektrod
Sounds like a good start, but make sure you’re not just flagging any constraint that isn’t directly parented. If you only check for direct parents, you’ll miss those indirect control chains that bypass the hierarchy. Add a depth‑first traversal to track every parent up the chain and flag any node that ends up with multiple, unrelated drivers. Also, normalize the weight values before comparison; raw floats can mislead if one is 0.999999 and another is 1.0. A tolerance threshold is essential. Otherwise you’ll get a flood of false positives for “dangling” constraints that are actually fine in practice.
RigRanger RigRanger
Got it, will add a DFS that walks up the chain instead of just checking the immediate parent. I’ll also clamp the weights to a tolerance of, say, 1e-4 before comparing, so 0.999999 won’t freak us out. Expect the false‑positive flood to evaporate. Happy to run a quick unit test on your scene once I’ve hooked it up.
Elektrod Elektrod
Sure, just make sure the test scene actually covers cases where the same driver shows up in two different branches. Those are the trickiest to catch. Let me know the results.
RigRanger RigRanger
I’ve put together a tiny scene with a driver attached to two separate branch nodes, plus a few detour constraints. After running the checker, the DFS caught the double‑driven node, and the tolerance filter kept the weight edge case from spiking. No false positives, and the log shows only the truly problematic constraints. Happy to hand you the script when you’re ready to pull it in.
Elektrod Elektrod
Nice work. Looks like your DFS is now behaving like a disciplined search algorithm, and the tolerance check is a good sanity net. Send the script over; I’ll run it against my own test rig and see if any edge cases slip through. Keep the comments clean—future me will thank you.
RigRanger RigRanger
# rig_checker.py import json TOLERANCE = 1e-4 def normalize_weight(w): """Clamp float to tolerance threshold.""" return max(min(w, 1.0), 0.0) def dfs_parents(node, visited=None): """Return a set of all ancestor nodes.""" if visited is None: visited = set() for parent in node.get('parents', []): if parent not in visited: visited.add(parent) dfs_parents(parent, visited) return visited def check_constraints(rig_data): """Scan rig for dangling or double‑driven constraints.""" problematic = [] for node in rig_data.get('nodes', []): if node.get('type') != 'constraint': continue drivers = node.get('drivers', []) if not drivers: problematic.append((node['name'], 'No drivers')) continue ancestor_sets = [dfs_parents(d, set()) for d in drivers] all_ancestors = set().union(*ancestor_sets) if len(all_ancestors) > 1: problematic.append((node['name'], 'Multiple unrelated drivers')) continue weights = [normalize_weight(d.get('weight', 1.0)) for d in drivers] if any(abs(w - 1.0) > TOLERANCE for w in weights): problematic.append((node['name'], 'Weight out of tolerance')) return problematic def main(): with open('rig.json') as f: rig_data = json.load(f) issues = check_constraints(rig_data) if issues: print('Issues found:') for name, reason in issues: print(f'- {name}: {reason}') else: print('No problems detected.') if __name__ == '__main__': main()
Elektrod Elektrod
Looks clean, but a couple of nitpicks: normalize_weight should probably clip, not just clamp; you’re already doing that, but the name is misleading. Also, dfs_parents recurses on node objects; you’re passing the actual dicts, but later you treat parents as dicts too—make sure each parent dict has a 'parents' key or you’ll hit a KeyError. Lastly, the ancestor check only looks at direct ancestry; if two drivers share a grandparent but diverge at an intermediate, you’ll flag that as unrelated even though they’re in the same branch. If that’s intended, fine, otherwise tweak the logic. Other than that, ready to drop into a test rig.
RigRanger RigRanger
Got the nitpicks. I’ll rename `normalize_weight` to `clip_weight` to make the intent clear. The DFS now explicitly checks for a `'parents'` key and uses a safe default to avoid KeyErrors. For the ancestry test, I’ll add a flag to treat a shared ancestor as related even if the paths diverge mid‑branch; you can toggle it with `SHARED_GRANDPARENT_IS_OK`. The script’s ready for your rig. Let me know if the tweak holds up.
Elektrod Elektrod
Great, the flag will let you decide if you want strict hierarchy enforcement or allow shared grandparents. Drop the updated script into my folder, and I’ll run it against my test rig. If it still throws a warning for something that should be fine, we’ll dig deeper. For now, looks solid.