Problem linking solvers when hidden

Hey there, I ran into an interesting problem earlier and I think I finally tracked it down!
If you link solvers together while they are hidden, the simulation seems to be accurate but the recording of the markers only happens on the last (“actually active”) solver.

Probably unrelated, I noticed after unlinking, the ‘currentState’ connection remains? Unlinking in general gave me quite a few assertion errors saying the solvers werent linked. Stacktrace below (same from the video):

# Warning: ragdoll.format_exception_wrapper() - Traceback (most recent call last):
  File ".../Ragdoll-2023_12_13/scripts/ragdoll/interactive.py", line 159, in format_exception_wrapper
    return func(*args, **kwargs)
  File ".../Ragdoll-2023_12_13/scripts/ragdoll/interactive.py", line 2940, in unlink_solver
    commands.unlink_solver(solver)
  File ".../Ragdoll-2023_12_13/scripts/ragdoll/commands.py", line 721, in unlink_solver
    assert linked_to, "%s was not linked" % solver
AssertionError: |cube_rSolver|cube_rSolverShape was not linked
 # 

Cheers!

(Edit: replaced video codec)

Thanks for reporting this.

Linking in general is flawed unfortunately. Merging is what has proven to be the most solid, without any real downside. Unlinking is what wouldn’t work with merging, but unlinking has been rare. It’s likely we’ll deprecate linking in favour of merging instead.

That said, when solvers A is linked to B, only B would be recorded as it would contain all of A. The assertion errors look like bugs. The currentState attribute should be disconnected too, see here.

Good to know! We found some instabilities with it in older versions but so far they have all been resolved in the newest one.
We have an artist facing tool that links the solvers for the purpose of simulating and unlinks them after to keep everything independent.
I’ve did some quick tests if Merge Solvers and Move to Solver could replace that workflow for us. It seems promising though the group shape doesnt seem to get moved yet, only the markers themselves. Just a thought for when that deprecation comes up.

@Citron FYI.

Thanks Marcus!

The group should definitely be moved as well, can you confirm the version you are on? Merging looks at any connection to one solver and moves them to the other. It should not matter whether it’s a Group or Marker (or another Solver).

The function itself is about 4 lines of Python, excluding comments. See here

Merging works great! Its the Move to Solver to “undo” the merging that leaves the group shapes. I tried selecting the group, then the solver and click Move to Solver but it only moves the markers, not the group shape. At least that still shows as a connection in the node editor.
(Though after checking the code, that function is equally simple)
In the video you can see how moving a group to a solver brings up an error that is seemingly referring to moving markers into another group.

We are on 2023.12.13

Ahaa, yes that does appear to be the case. See here. An oversight on our part.

Here’s a workaround you can use.

# Select solver and any markers and groups to move
from ragdoll.vendor import cmdx
from ragdoll import commands

solver = cmdx.selection(type="rdSolver")[0]
nodes = cmdx.selection(type=("rdMarker", "rdGroup"))

for node in nodes:
    commands.move_to_solver(node, solver)

The nuance however is that you’ll want to only move markers that are not part of the group being moved, as that would otherwise move them out of that group.

1 Like

That makes sense. Thanks Marcus, we’ll give this a try!