Notifications
Clear all

[Closed] selected keyrange lenght?

I want to know the number of frames in the selected key range. I can’t find it
I tryed to get it from the getTimeRange but failed
any help?

6 Replies

perhaps this may help

local myAnimStart = ((animationRange.start as integer)/TicksPerFrame)
local myAnimEnd = ((animationRange.end as integer)/TicksPerFrame)
local myTotalFrames = (myAnimEnd-myAnimStart)

 lo1

or simply
animationrange.end.frame-animationrange.start.frame

animationrange.end.frame-animationrange.start.frame returns the timeline range, not the selected keyframes range.

Imagine a animated box from frame 5 to frame15: keyframe range = 10

Kinda crude and works only for position. Adjust to fit your needs:

fn getKeyRange node = (
node.pos.controller.keys[node.pos.controller.keys.count]-node.pos.controller.keys[1]
)
 lo1

why do you need to iterate over all the keys?
Is it possible to have out-of-order keys?

1 Reply
(@noouch)
Joined: 11 months ago

Posts: 0

Thanks, now I feel extra-stupid
fixed it good.