2
$\begingroup$

enter image description here

I have different animations in each action with different duration.

Is there a way to store the length of the duration in each action so that the frame_end can adjust accordingly to it?

bpy.data.scenes["Scene"].frame_end = (animationLength * 24)

only set my frame_end at the last loop in my for loop for creating multiple animation.

$\endgroup$

1 Answer 1

1
$\begingroup$

The following snippet will loop over all actions and prints the length in keyframes of each action, the scenes keyframe position is adjusted.

import bpy

frame=1
for action in bpy.data.actions:
    print( "action=%s" % action.name )
    print( "action length=%d" % action.frame_range.y)
    frame = frame + action.frame_range.y
    bpy.context.scene.frame_set( frame )
    print( "frame=%d" % frame)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .