ragdolldynamics / ragdoll-maya

Real-time physics for Maya
https://ragdolldynamics.com
148 stars 18 forks source link

Exception in ragdoll.commands breaks undo #7

Open domrab opened 2 years ago

domrab commented 2 years ago
from ragdoll import commands as ragCmds

# calling with wrong arguments/types to cause exception
group = ragCmds.create_group("test")

Trying to undo in maya results in: // Error: line 1: Undo is temporarily unavailable. Try exiting the current tool. //

Calling cmds.undoInfo(closeChunk=True) seems to solve the issue.

Is this a bug or is it deliberately left to the TDs to validate their inputs?

domrab commented 2 years ago

To expand, AssertionErrors are not affected by this and do NOT break undo

domrab commented 2 years ago

Upon further testing, this might not be related to commands but to exceptions raised within the cmdx.DagModifier?

mottosso commented 2 years ago

Yes, I believe you are right. It shouldn't happen, the modifiers are explicitly protected against this here:

https://github.com/mottosso/ragdoll/blob/b959b76b2984c405c60be22ea24549e6b0d9cea4/ragdoll/vendor/cmdx_ragdoll.py#L5776

But I have also seen this. It is not deliberate and could be considered a bug. Happy to accept a PR if you manage to find a solution.