delete keyframe range

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  09 September 2009
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
Quote: deleteKeys o.pos.controller #allKeys
deleteKeys o.rotation.controller #allKeys


Thank you for help
 
  09 September 2009

selectKeys o.pos.controller 0f 30f
deleteKeys o.pos.controller #selection 
selectKeys o.rotation.controller 0f 30f
deleteKeys o.rotation.controller #selection 
__________________
----------------------------------
Akram Parvez
http://www.akramparvez.com/
 
  04 April 2010
Originally Posted by AkramParvez:

 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?
 
  04 April 2010
Use this
o.modifiers[#Edit_Poly][#Master_Point_Controller]
__________________
----------------------------------
Akram Parvez
http://www.akramparvez.com/
 
  04 April 2010
Originally Posted by AkramParvez: 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?
 
  04 April 2010
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)
 	)
 )
__________________
www.jasonlabbe3d.com
 
  04 April 2010
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 Parvez
http://www.akramparvez.com/
 
  04 April 2010
Originally Posted by labbejason: 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.

Originally Posted by AkramParvez: 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
 
  04 April 2010
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:01 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.