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?
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.
if _is_interactive():
a, b = cmdx.selected_time()
# Returns a single frame if nothing was selected
if (b.value - a.value) > 2:
start_time, end_time = a, b
start_frame = int(start_time.value)
end_frame = int(end_time.value)
if opts["autoCache"]:
# Leave them cached
with cmdx.DagModifier() as mod:
for solver in solvers:
mod.try_set_attr(solver["cache"], c.StaticCache)
total_frames = 0
timer = i__.Timer("record")
for solver in solvers:
with timer as duration, progressbar() as p:
op = {
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 ?
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.
key=cmds.ragdollLicence(serial=True, query=True),
# Which edition of Ragdoll is this?
# trial, personal, complete, unlimited or batch
product=cmds.ragdollLicence(product=True, query=True),
# Node-locked or floating
isFloating=cmds.ragdollLicence(isFloating=True, query=True),
# Is a licence currently leased?
hasLease=cmds.ragdollLicence(hasLease=True, query=True),
# Is the current licence activated?
isActivated=cmds.ragdollLicence(isActivated=True, query=True),
# Is the current licence a trial licence?
isTrial=cmds.ragdollLicence(isTrial=True, query=True),
# Has the licence not been tampered with?
isGenuine=cmds.ragdollLicence(isGenuine=True, query=True),
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