HELP! - Need script that copy keys in animation and shift frames upwards...

Hello. I need a script for 3ds Max that can....

1. Select a set of editable poly objects in Viewport.

2. If these objects have animations on some parameters, copy the framenumbers and values of these animation keys to memory.

3. Prompt a dialog where user can insert 3 "copy start" frame numbers. So a dialog of 3 numbers.

4. Script then pastes all keys, frames and values from the copied data, and add the difference between original framenumber and the first "copy start" framenumber, and set this as new framenumber for each copied key. Script does the same with the other two "copy start" framenumbers as well.

Example: At frame 5 there is a key with value 100 for a parameter of the selected object, and at frame 10 a key with value 200. Script ask user for 3 "copy start" framenumbers. User set these to 50, 120 and 200.

Result: These keys are added, Frame,Value; 50,100;55,200;120,100;125,200;200,100;205,200.

Could someone help me maybe? I'm new to 3ds Max.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
TsveTan's picture

Just for given controllers

This is an exmpl. with the x_rotation.controller of an obj.
To set numbers as key values you need to be sure this is compatible with the controller's values.
There are point3, quats, booleans ... values, so you need to know, which controller to access.

o = $ -- current selected obj.
old_cont = o.rotation.controller.x_rotation.controller
new_cont = bezier_float()
For k in old_cont.keys Do (
 temp_key = addNewKey new_cont (frame_num1 + k.time)
 temp_key.value = k.value
 temp_key = addNewKey new_cont (frame_num2 + k.time)
 temp_key.value = k.value
 temp_key = addNewKey new_cont (frame_num3 + k.time)
 temp_key.value = k.value
)
o.rotation.controller.x_rotation.controller = new_cont
<code>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.