Notifications
Clear all

[Closed] finding keyframe values for an object on Slider

how can i find out the number of all the key frames on the slider that is already set for an object ?

also other way around… i have a keyframe for example 25, now i want to find out and select a dummy in my scene that has a keyframe set on 25.

8 Replies

Hi abyjoe,

Someone may well come along and offer a better solution, but this might start you off. When I tackled a similar problem a while back I found that I had to cycle through all the object, checking all the sections of the object to see if they were animated.

Fortunately there is a very useful function buried in the help for this, and it goes something like this:


animated_props = #()

fn getAnimatedProps theObject =
	(
	if try(theObject.isAnimated)catch(false) do 
		(
		--append animated_props theObject 
		NS = theObject.numSubs
		
		if NS == 0 do
			(
			append animated_props theObject 
			)
		)
		
	NS = theObject.numSubs
	for i = 1 to NS do 
		(
		getAnimatedProps theObject[i]
		)
	)--End of Function - getAnimatedProps


By getAnimatedProps you will populate the animated_props array with the subanimes that are animated on that object. It is then easy to access the keyframes on these subanimes by accessing their controllers…


animated_props = #()

--To look at the Keys on the First Animated Property of our Object
getAnimatedProps obj

KeyArr = animated_props[1].controller.keys

--there are other useful commands for playing with the keys such as  

isKeySelected animated_props[i].controller k

--Where k is a reference to a key
movekeys animated_props[i].controller TimeStep        -- is also useful


I am afraid I havent got max, so I am pasting and adjusting sections of my code, so please check it and see if you can get it to work. But that Function is pretty vital for accessing all animated parts of objects, and thus the correct controllers, and thus the keys on the objects. Once you have the these keys, you can then query their time, and selection etc, to start playing games…

Hope this is of some use, bounce back anymore questions.

If anyone has a better way of doing things then please feel free to correct this post…

Good luck!

Rich

Sorry Duplicated Post

–Sorry Duplicated Post!

hi chaps,

I am sure that everzen’s function works just fine, but it seems like you would be sorting through (potentially) a lot of controllers that you dont need to.

there are quite a few controller/key functions, but the

<node>.<animated property>.keys 

constructor will give you access to what you want. since you know the track (ie the slider’s value controller) that you want to access, the .keys method will return an array of keys for that parameter. have a look at “maxkeyarray values” and “controller key functions” to see the other methods.

edit: hey everzen, i apologize i hadnt read all the way down on your post, where you clearly state what i just fumbled my way through! sorry mate!

no probs at all mate At least you didnt post the same thing 3 times in a row! I think that is a record even for me…

nice! here’s what happened –

for i = 1 to 3 do postreply()

thanks guys. will check out these nd get back…

great help. thank you. works for me.