[Closed] delete keyframe range
Hey,
I want to delete keyframe of selected objects from a range of key.
I found this but can’t use a time :/range
deleteKeys o.pos.controller #allKeys deleteKeys o.rotation.controller #allKeys
Thank you for help
selectKeys o.pos.controller 0f 30f
deleteKeys o.pos.controller #selection
selectKeys o.rotation.controller 0f 30f
deleteKeys o.rotation.controller #selection
I noticed that my animation controllers are not position and rotation related but are animated vertices. I tried:
o.editpoly.controller
instead of the above, but that doesnt work, is there a list of animation controllers somewhere that can be used?
Hmmm unfortunately it doesn’t work, tried a few ways with the code you gave me also the maxscript help doesnt supply any info on this. (at least for what I could find)
on del_key pressed do
(
for o in selection do
(
selectKeys o.modifiers[#Edit_Poly][#Master_Point_Controller] 0f 500f
deleteKeys o.modifiers[#Edit_Poly][#Master_Point_Controller] #selection
selectKeys o.pos.controller 0f 500f
deleteKeys o.pos.controller #selection
selectKeys o.rotation.controller 0f 500f
deleteKeys o.rotation.controller #selection
)
)
The last 4 lines btw only remove keyframe 1 until 500, how come it doesn’t remove frame 0? Is there a logic to this?
It looks like that should work, unless it’s a key from another controller. You can try this, it’s a function to delete keys from a provided controller. Just pass through a controller you want to delete keys from and the delete range.
(
/*************************************
Info: Deletes keys from a controller
Arguments:
con <controller>
deleteRange <interval>
*************************************/
fn deleteKeysByRange con deleteRange =
(
for x in con.keys.count to 1 by -1 do
(
if (con.keys[x].time >= deleteRange.start) and (con.keys[x].time <= deleteRange.end) do deleteKey con x
)
)
for obj in selection do
(
mPointCon = obj.baseObject[#Master_Point_Controller]
if mPointCon != undefined do deleteKeysByRange mPointCon.controller (interval 0f 50f)
deleteKeysByRange obj.position.controller (interval 0f 100f)
deleteKeysByRange obj.rotation.controller (interval 0f 100f)
deleteKeysByRange obj.scale.controller (interval 0f 100f)
)
)
Awesome, thnx Jason this code works perfectly.
Akram: I just found out what the problem was with the previous code.
selectKeys o.modifiers[#Edit_Poly][#Master_Point_Controller] 0f 500f
deleteKeys o.modifiers[#Edit_Poly][#Master_Point_Controller] #selection
My object was in editable_poly mode. So before I could use this line I had to add a edit_poly modifier. Weird as both are editable poly’s. But thnx anyways
The code i have given works if you are animating vertices with edit_poly modifier on the object.
If you are animating without it then this should work.
selectKeys o.baseObject[#Master_Point_Controller] 0f 500f
deleteKeys o.baseObject[#Master_Point_Controller] #selection
@jason Thanks for the function…