[Closed] How to make Script Controllers to refresh in Animate on context?
I’ve recently bumped into a super-stupid problem of Max’s script controllers. I have no idea whether this is a design oversight or an intended implementation or simply a bug.
I have a complex rig of which some helpers are being driven by script controllers. All works fine and smooth as long as I don’t turn the “AUTO KEY” mode on. In that moment, all of the controllers STOP REFRESHING and thus recalculating all the data in them. This could be “forgiven”, but then I have several custom tools I wrote that work with a “with animate on” which is basically the same thing! The whole rig doesn’t work and the whole toolset I’ve written is USELES :banghead:
WHAT THE HELL!?!?! :banghead: :banghead:
Does anyone know a workaround or a solution to this stupid “bug”?! I’m at the end of all the variations and options that I tried.
I also tried updating the sliderTime in the loop cycle, this works, but takes AGES to go through all the objects in the rig and loop through all the frames in the shot to store transform data, it’s almost as slow as plotting point caches on the geometry. So, this is the LAST option I’ll implement in my tools if everything else fails.
Have you added variables to the left hand list and used those instead of referencing nodes by name?
Yes, I have. I just found the problem, however, no workaround yet.
The problem is as follows:
I have a node under whose position controller I store a custAttrib definition which only contains a float variable, let’s call it “test”.
Then, on a different node, I assign to its z_rotation (in a list) a float script controller that references the custAttrib’s “test” variable.
Now, when I play the animation, the variable increses in size by 10, let’s say, so that the object spins. The problem is, when I enter the “Auto Key” mode, the variable get’s all the changes keyed, so I disabled the “test” variable’s .keyable property (set it to FALSE). Now, when I play the anim, all is fine, but AS SOON AS I enter the “Auto Key” mode, the whole system fails to refresh and the object doesn’t spin after the first frame (it rotates correctly on the first frame, but that’s it).
How can this be solved? I don’t want to end up with billions of keys on the variable’s controller, but I need the controller to make the object spin within the “animate on” context. :shrug:
Same behaviour occurs when you add a Script Controller to the z_rot controller and define a “storedRot” and type in the controller this code:
if F < 1 then
(
result = 0.0
storedRot = 0.0
)
else
(
result = storedRot + 0.1
storedRot = result
)
result
Oks, I found a workaround: persistent global variables.
They don’t get keyable and update even when in the animate on context, which is what I’ve been all the time after.
It’s a bit “dirtier” approach, but at least it works for what I need it for. :bounce:
I find it typical that with lots of rigging problems CA’s seem to cause some or lots of updating problems…
Do persistent globals merge and xref ok? (never used them)
-Johan
I’ll quote the documentation as I’ve never XRefed a persistent global variable, but merge seems to work fine:
I wish I could find time to look at this closer for you as I’m using CA defs all the time for this sort of thing without a problem. I’ll see if I can come up with a solution some time this week for you. I’m burried in writting another mocap converter at the moment and need it ready asap.
I absolutely understand your busy schedule, no rush, mate, I very much appretiate that you even took a peek in this thread
Keep the great work up, man! And all the best with the current project of yours… :deal: