[Closed] Script Controller Undo Context
Hi,
I’ve been setting up a bunch of characters with a few scripted controllers in 2009, and was wondering the script controllers are causing the undo buffer to be cleared. With very little in the scene after a few moves sometimes our animators have said they have no undo history. Unfortunately when i open up the file and move around it is fine so i think it might be on some and not others.
I wondered if I needed to place the script inside the controller inside a ‘with undo off’ context.
To explain the setup a bit more, most of the controllers move or manipulate something on the rig with the exception of some which provide secondary animation with a time offset along a bone chain (a sort of bouncy hair lag) . I didnt know if this was the one causing the issue. again, its annoying as it crops up now and again rather than all the time.
keep in mind that if you have any (non-light) garbage collection event, that’ll clear the undo stack as well. See the topic “Manual Garbage Collection” on this behavior, changes in 3ds Max 6 (the ‘light:<bool>’ flag for gc()), etc.
In the end, though, even though the measures taken make what you describe more rare, they’ll still happen once in a while.
Thanks Rich, the behaviour seemed more regular than max’s usual spring cleaning but i will monitor it and see if it is anything in particular for the future.
Hi Paul,
In a word, no. It was an initial possiblilty for me because it was a setup i hadn’t used before (amongst other things controlling mat id’s via a slider) and I was unsure if that was doing it correctly.
With script controllers I almost always bury the code for them in custom attributes or a scritped modifier and then reference in the CA def or the modifier and call functions from with in them. This gives me a nice container for all my code that drives a character and makes it easy to port that code to other characters. I don’t know if this would correct the problems that you are seeing as I don’t know what is causing it but I don’t think that I get customers compaining about it. I will ask and see if they do.
that’s a good method Paul – Whether it solves any issues or not, It’s certainly a nice way of structuring them, I’m thinking if you call the same script on multiple nodes you don’t have to change each one should you change anything. This is the first set of characters where i’ve started to use the nodetransform monitor within the CAdef and i’ve been really pleased with just how much functionality it opens up. I’m starting to build up CA defs that allow the nodes to be picked so I have solutions that can be applied to any character and specified easilly, a bit like the example of your site. So many thanks for the tutorial, its really pushed things forward for me.
This is exactly what I have. It is a scripted modifier that allows you to add nodes to it. To define what the nodes are I store the data in each node like a set of diescriptive information. Like if an object where to be able to mirror over to another which object would that be and how should it happen. The main code for doing the mirroring is in the modifier which reads in the node from the reference array checks it data and does what it needs to. So all the functions and code for runnning the character are in the one modifier and all the node specific data is in each node.
A great solution. At the moment I have four or five CAs that i add which each have pick buttons to add nodes to the maxobject/tab array (depending on whether its a single node or a group) I was thinking of having a scripted modifer that started like an empty attribute holder except you could add these CA defs to it, choosing the ones you needed.