ScriptSpot

Forum topic · General Scripting

Fit selected objects keyframes in timeline

By titane357 · 2019-10-21

Description

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
[code]
(
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 (2)

titane357 · 2019-10-22

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 · 2019-10-21

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