Ragdoll API Questions

hey, I want to call the record function from my own button
I wanted to use the opt dict in order to make it auto cache (like the checkbox in the tool)
are any of those keys responsible for auto cache?

opts = {
“startTime”: None,
“endTime”: None,
“include”: None,
“exclude”: None,
“toLayer”: True,
“rotationFilter”: 1,
“ignoreJoints”: False,
“resetMarkers”: False,
“experimental”: False,
“maintainOffset”: constants.FromStart,
“extractAndAttach”: False,
“includeKinematic”: False,
“protectOriginalInput”: True,
“mode”: constants.RecordNiceAndSteady,
}

for solver in solvers:
    rd.recordPhysics(solver.name(), opts)

if not, if I make it with
ri.cache_all() before
will that give me the same result?

image

Try this.

for solver in solvers:
    cmds.setAttr(str(solver) + ".cache", True)
    rd.recordPhysics(solver.name(), opts)

That’s all Auto Cache is, it sets the Cache attribute on the solver to Static. If it’s already Static it would leave it be.

If you’re curious about the Python, here’s where this option is taken into account.

Alternatively, when you call Record Simulation from the Ragdoll menu, it will print the command you can put into your own button. It’s this here.

from ragdoll import interactive as ri
ri.record_markers()

This would take Auto Cache, and all of the other options currently active, into account.

And alternatively alternatively, you can hold Ctrl + Shift when clicking on a Ragdoll menu item, and it will put the item in your currently open shelf. The Python script will be embedded into it.

See here

1 Like

ohhhh everything is so helpful
thank you for all of it

hey marcus, how can I check with a command if ragdoll was able to aquire a lease ?
image

like the green/red square here- True if the lease was aquired and false if not

Have a look at this one.

from maya import cmds
if cmds.ragdollLicence(hasLease=True):
  print("Got it!")

Can also call:

from ragdoll import licence
data = licence.data()
if data["hasLease"]:
  print("Got it!")

Find all available options here.

thank you!

hey, is there any way to make ragdoll show cache for 2 solvers in the same time? for example if I have 2 characters with rd in the same shot

It’d be great if we could keep the conversation related to the title of this thread, such that people know what they’ll get when they click on “Ragdoll API Questions”.

Feel free to open up a new thread, and try and include some more information; like what you’ve tried so far along with any screenshots you think might help.

ok, you can delete from here