Animation. Linear Interpolation
jmucchiello
Posts: 126
in New Users
Is there a way to tell Daz that every existing key and every future key in every existing and future property of every existing key frame and every future key frame should use linear interpolation by default?
Comments
there is a script Richard posted but I cannot figure out how to use it
I saved it as a dsa but it doesn't seem to do anything
Scene.setDefaultKeyInterpolationType( DzProperty.InterpLinear );
I moved the cube up and down at frames 5, 10, and 15. Then I ran the script. The I moved the cube and frames 20, 25, and 30 - the keys created seem to have switched from TCB to Linear as they should.
It works. It just doesn't affect existing keys. So I've added it to the script loaded when a scene loads.
Thanks for remembering the script existed.
Right, it chnages the default (the kind of key created when a new key is created after running the script - note that this seems to affect the outgoing behaviour, as you can see in my screenshot above the line graph line coming into the Linear key iss till curved from the preceeding TCB key, so you won't see the difference on the first new key created at the end of a run of previously created keys.
Next is the script to change existing keys. But I can't seem to find a script api that enumerates or list all frames of an animation. Or all frame keys attached to nodes. (Which is the ridiculous method of where stuff is saved in scene file.)
You'd have to iterate over properties on nodes with DzProperty.hasKeys() I think
So it's bunch of nested loops? Will this hit all keys at all times in the animation?
Is that your own work or AI generated? It's not an approach I have seen before, and the lop opening have mis-matched parentheses. I don't see foreach in the reference docs.
[Boo to] AI.
I wrote it from the docs.
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/array#a_1a50bc05836f5d6592feeda8c3a2d61377
As for mismatched parentheses. I do that all the time. I typed the code here, not in Daz. (I'm in the middle of a render.) Apparently I misspelled forEach as foreach.
It's weird. The loops work. But the interpolation type isn't changing. These are all store assets: the g9 character, the animation. It plainly shows it found all the keys at all the time offsets. But, I've run the script several times, the interpolations types remain TCB. Only takes 14 seconds to run.
Sorry, I looked for foreach in the general control statements rather than in Array.
Your script looks plausible, I don't know why it isn't working.
Would a bug report be of use? I am running 4.22 still.
I would at least wait a bit to see if soemone else can spot a logic flaw.
If I instead get the current key value and time and set them using the new interpolation type that does work:
DzFloatProperty does have a different enumeration for the types, but substituting for that didn't seem to help.
The thing I don't want to try is deleting the key and rebuilding it from scratch. That seems both time consuming and error prone.
Well, the script does the work for you - it isn't a manual copy and redo. It does suggest that there may be a bug, unless there is an extra step that we are both missing.
The call to setKeyInterpolationType doesn't do anything. I wouldn't call that "working."
A missing step seems a possibility but who knows what?
For sweeping through keys in an existing scene, I've always used mCasual's SetInterpolation script, which still works as of 4.22. It appears to use a different constant ( DzFloatProperty.LINEAR_INTERP ) than what's referenced above.
https://sites.google.com/site/mcasualsdazscripts/setinterpolation-for-ds2-3