Frame calculation


#1

Hi all, it has been a while since I last touch on maya scripting.
I am trying to create a function where it will sets a keyframe based on the time slider, per every 4 frames. For example, my time slider range is 1 to 22, and so the keyframes will be set on Frame 1, 5, 9, 13, 17 and 21…

I need this functionality as it will aids me greatly when doing animations.

But I already am having trouble on the frame calculations as I have almost no clues to start off with.

Can anyone give me any pointers?


#2

You could download one of the many tween machine plugins available, keyframing at discrete intervals between two keys is what a tweener does, and take inspiration from that, or use it outright if all you want is the functionality and not the learning experience.


#3

is it not as simple as use

bakeResults

?


#4

Select the objects you want keyed then…

Edit > Keys > Bake Simulation > Options

Under “Sample By” type 4. This will key every 4 frames.