Delete Object parameters in the key filter

Hello,

It's probably just me fumbling around and not finding it in max script help file, but does anyone know how to get deleted all the "object parameters" on the selected object that we find in the key filter?

If anyone can find something in the help file, please write what I should look for: o)

Sincerely,
Raymond H. Ingebretsen

Comments

Comment viewing options

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

Awesome. Thank you Anubis :)

Awesome. Thank you Anubis :)

/ Raymond

Anubis's picture

Aha, now your question is clear

Well, as you need custom recursive function to get all nested properties, doing this with getPropNames() w'd be the hard way, better is to loop through subAnims.

But as the deleteKeys() do this for you, the most easy way w'd be to call it on desired subAnim ;)

for i in selection do deleteKeys i -- del. all keys
for i in selection do deleteKeys i[1] -- del. viz.
for i in selection do deleteKeys i[4] -- del. all props
--------------------------------------
for i in selection do deleteKeys i[3] -- del. all transf.
for i in selection do deleteKeys i[3][1] -- del. pos
for i in selection do deleteKeys i[3][2] -- del. rot
for i in selection do deleteKeys i[3][3] -- del. scale

Cheers!

my recent MAXScripts RSS (archive here)

tassel's picture

I know these methods:for i

I know these methods:

for i in selection do deleteKeys i
 
-- do deletekeys i.scale.controller
-- do deletekeys i.position.controller
-- do deletekeys i.rotation.controller
-- do deletekeys i.visibility.controller

But i cant find any easy way to do this with obj. parameters.

To make things more sensible and show what I'm trying to do:

/*
[DESCRIPTION]
Lazy Delete Animation Tools V1.0 
 
[INFO]
- Put the files in maxroot\scripts\ (e.g.: C:\3dsmax2012\Scripts\)
- Tested with 3DS Max 2012
 
[CREATION INFO]
Last Modified: September 14, 2011
Author: Raymond Homme Ingebretsen
Webpage: http://www.homme3d.com
 
[History]
V1.0: First version.
 
*/
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Unregister cui dialog bar if it is already open
try(cui.unregisterDialogBar DeleteAnimation) catch()
--Destroy the dialog if it is already open 
try(destroyDialog DeleteAnimation)catch()
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Create a rollout
	rollout DeleteAnimation "Lazy Delete Animation Tools V1.0 <<-->> By Raymond H.Ingebretsen <<-->> http://www.homme3d.com" 
	(
		button btn_DeleteAllKeys "Del All Keys" width:120 height:22 align:#center tooltip:"Delete All Keys In Selection" across:7
		button btn_DeleteParamKeys "Del Parameter Keys" width:120 height:22 align:#center tooltip:"Delete All Parametric Keys In Selection"
		button btn_DelPosKey "Del Position Keys" width:120 height:22 align:#center tooltip:"Delete All Position Keys In Selection"
		button btn_DelRotKey "Del Rotation Keys" width:120 height:22 align:#center tooltip:"Delete All Rotation Keys In Selection"
		button btn_DelScaleKey "Del Scale Keys" width:120 height:22 align:#center tooltip:"Delete All Scale Keys In Selection"
		button btn_DelVisKey "Del Visibility Keys" width:120 height:22 align:#center tooltip:"Delete All Visibility Keys On Selectet Object"
 
		button btn_About "About" width:120 height:22 align:#center tooltip:"About This Script"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		on btn_DeleteAllKeys pressed do	
			(
				for i in selection do deleteKeys i
			)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		on btn_DeleteParamKeys pressed do	
			(			
				for i in selection do
					for p in getPropNames i where isPropertyAnimatable i p do 
						try(execute ("deleteKeys " + (exprForMaxObject i) + "." + p as string + ".controller")) catch()
			)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	on btn_DelVisKey pressed do 
		(	
			for i in selection do 
			(		
				deletekeys i.visibility.controller
			)
		) 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	on btn_DelPosKey pressed do
		(
			for i in selection do 
			(		
				deletekeys i.position.controller
			)
		)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	on btn_DelRotKey pressed do
		(		
			for i in selection do 
			(		
				deletekeys i.rotation.controller
			)
		)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	on btn_DelScaleKey pressed do
		(
			for i in selection do 
			(		
				deletekeys i.scale.controller
			)
		)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
					on btn_About pressed do
				(messagebox "
[DESCRIPTION]
Lazy Delete Animation Tools V1.0 
 
[INFO]
- Put the files in maxroot\scripts\ (e.g.: C:\3dsmax2012\Scripts\)
- Tested with 3DS Max 2012
 
[CREATION INFO]
Last Modified: September 14, 2011
Author: Raymond Homme Ingebretsen
Webpage: http://www.homme3d.com
 
[History]
V1.0: First version.
 
[SPECIAL THANKS TO]
Håvard (haavards) - For always helping me out.
Panayot Karabakalov (Anubis) - To always be a big help for me.
" title:"Lazy Delete Animation Tools")
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	) -- End rollout
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
createDialog DeleteAnimation width:1680 height:35
 
cui.RegisterDialogBar DeleteAnimation minSize:[1024,35] maxSize:[1680,35] style:\
#(#cui_dock_bottom, #cui_dock_top, #cui_floatable,#cui_handles,#cui_max_sized)
 
cui.dockDialogBar DeleteAnimation #cui_dock_bottom

/ Raymond

tassel's picture

Anubis: in your example it

Anubis: in your example it deletes alle keys on selectet object. In my case i just want to remove the animated object parameters and not the scale, move and rotate on the object. Thank you anyway :)

/ Raymond

Anubis's picture

deleteKeys is mapped function

deleteKeys is mapped function and apply recursively to all the nested controllers. Shortly...
for i in selection do deleteKeys i

my recent MAXScripts RSS (archive here)

tassel's picture

Is there a better way to do

Is there a better way to do this?

for i in selection do
	for p in getPropNames i where isPropertyAnimatable i p do 
		try(execute ("deleteKeys " + (exprForMaxObject i) + "." + p as string + ".controller")) catch()

/ Raymond

Comment viewing options

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