Fit selected objects keyframes in timeline

Hi

I wanted to fit all selected objects keyframes in timeline with a script.
I found one script in a cgsociety forum by HornBerger
I modify it to use on multiple objects, but it works only with position controller.
Could it be possible to make it work with all controllers ?
Thanks

(
debb = 10000
finn=-10000
for a in selection do
(
    sortKeys a.controller
    num_keys = numkeys a.position.controller
    starttime = getkeytime a.position.controller 1
    endtime = starttime
    for i = 1 to num_keys do 
    (
 
    	key_time = getkeytime a.position.controller i
    	if key_time > endtime then
    		 endtime = key_time
    )
	if starttime < debb then debb = starttime
	if endtime > finn then finn = endtime
)
animationRange = interval debb finn
)
[\code]

Comments

Comment viewing options

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

Hi, yes I probably can do

Hi, yes I probably can do this.
But there is other controller ( visibility,...)
And I Wonder if there is a way to make it work for all key of all existing controllers.

miauu's picture

.

If it works with position controller then you can create new versions for rotation and scale controllers:

a.position.controller
a.rotation.controller
a.scale.controller

Comment viewing options

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