Notifications
Clear all

[Closed] Automatic keyframe

Ok so, here’s the thing. I have an IK and a FK spine. The FK spine is driven by the IK spine but you can offset it any way you want (animator’s request). Now what I would like to do is everytime I add a key frame to one of the IK controllers, it automatically adds a keyframe to every bones on the FK spine. Why do you ask? Simply to save time for the animators.

I tried to search in the maxscript reference if there was anything that could help me on that, but I didn’t find anything substantial. Where I’m having problems is, how the heck do I detect when a keyframe is added automatically without having to do any manual interaction?

I thought about using

on $spineik_cntrl addnewkey do (addnewkey $spinefk01)

but it doesn’t work.

Anyone has an idea?

8 Replies

might just make it a button that they would -have- to press, but if that’s not an option, I think you’d be stuck abusing some other callback (trackbar key filter, perhaps) to get a similar effect (and enumerate the keys on the IK yourself to determine what keys were added / copy them to the FK rig).

Almost every animator on my team uses autokey, so a button is not an option.

What I understand from you suggestions would require some user interaction,which is what I want to avoid. Maybe I’m not getting it right though. If I’m not feel free to explain a little bit more.

it wouldn’t require user interaction, actually…

The trackbar filter callback, change handlers, etc. all run automatically. The only problem is that none of them are specific to a user adding a key / removing a key; so on triggering of the callback, you would have to manually check the controller(s) of the object(s) and check whether keys were added/removed from last time.

Hmm, interesting. But how do you trigger those callbacks without user interaction?

‘you’ don’t… max calls them for you whenever certain events happen.

try this code…


fn test ev nd = (
	format "ev % :: nd %
" ev nd
)
temp = nodeEventCallback all:test
-- temp = undefined; gc() -- to remove this callback

then manipulate your objects as you / your artists would, and check which callbacks are triggered.

Then set up just that callback ( to save on callback overhead ) and in the callback function you would check the property of the node you’re interested in and check whether there’s any keys that aren’t on the FK rig and, if there are, create them. That’s manual work on your end, but on the user’s end – provided a callback triggers for what you need – it’d just be a startup function that they wouldn’t ever get to see (short of you building an UI for it, of course).

Ok I’ll try this. Thanks for your help!

 eek

would this suffice?

when transform $spine_control changes do
(
if animbuttonState = true do
(
addKey $fkbone.pos slidertime
)

)

you could also use a callback to detect #animateOn

Interesting. Unfortunatly, that project is on hold right now. But I’ll try that at home tonight.

Thanks a lot man, I’ll owe you a second beer if this works­.