View Full Version : Are Key Values only holding a Key index?
03 March 2012, 03:28 PM
So this bit of Maxscript key/controller behavior seems weird to me:
o = sphere()
n1 = addNewKey o.controller 5 -- new key at frame 5
o.keys -- one key at frame 5
n2 = addNewKey o.controller 3 -- new key at frame 3, new index 1
o.keys -- two keys now
n1 -- now is the same as n2, it's the newer index 1 key at frame 3 instead of the key it was referring to at frame 5
n2 -- same as n1
n0 = o.controller.keys -- key at frame 3
n3 = addNewKey o.controller 1
n0 -- now the key at frame 1
n4 = getkey o.controller 2 -- key at frame 3
n5 = addNewKey o.controller 2
n4 -- now the new key at frame 2
Can keys have a fixed address that I can hold on to in a variable without the above inconsistencies?
03 March 2012, 02:22 PM
I don't think so.
I guess it's kind of an OO conception, such as : a keyframe doesn't have to know what is its index in the controller on which it's applied to.
Anytime you add a or remove a key, the controller keyframes indexes will be regenerated.
You'll have to proceed another way, for example, looking for the designated keyframe by the value of the parameter you're dealing with.
What are you trying to do ?
03 March 2012, 04:44 PM
I personally ran into this issue twice in the last week. I worked around both of them, but then one of the other Tech Artists here had the same issue also, so I thought I'd ask the forum here.
One of my workarounds was in my rig build script where I had to generate a couple of keys and then set them to linear. I was trying to create both keys first, hold them in vars, then change their in/out, but only one of them was getting set correctly. So I have to set their in/out after creating each key, no biggie, but it just seems non-intuitive.
Another is a notetrack tool I wrote last week. Note keys work the same way. This isn't the first notetrack utility I've written, so going in I knew that you can't just edit note key frame values -- weird things happen. So while the tool is open, any time you make a change to the keys in the tool, it just deletes all the keys on the track and re-writes them from the tool, and assumes no one will be editing the keys in the dope sheet while the tool is open.
03 March 2012, 04:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.