PDA

View Full Version : delete keyframe range


loran
09-07-2009, 05:03 PM
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

AkramParvez
09-07-2009, 05:59 PM
selectKeys o.pos.controller 0f 30f
deleteKeys o.pos.controller #selection
selectKeys o.rotation.controller 0f 30f
deleteKeys o.rotation.controller #selection

Papigiulio
04-19-2010, 03:23 AM
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?

AkramParvez
04-19-2010, 03:57 PM
Use this o.modifiers[#Edit_Poly][#Master_Point_Controller]

Papigiulio
04-21-2010, 05:11 AM
Use this o.modifiers[#Edit_Poly][#Master_Point_Controller]

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?

labbejason
04-21-2010, 07:06 AM
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)
)
)

AkramParvez
04-21-2010, 07:55 AM
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..

Papigiulio
04-21-2010, 08:28 AM
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. :)

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..


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 :)

CGTalk Moderation
04-21-2010, 08:28 AM
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.