1
$\begingroup$

I have two sequential actions, and I want to shift them both foward. I can list the actions with bpy.data.actons, but I don't know how to modify them.

enter image description here

$\endgroup$
1
$\begingroup$

While you can list the actions with bpy.data.actions, once they are in the NLA Editor you need to access them slightly differently.

Once in the NLA Editor they are classed as strips on nla_tracks which are stored in the animation_data for that object.

For example, in the case of the image you have shown you will use this to access an individual strip:

bpy.data.objects['sash_KIN_TYPE_S'].animation_data.nla_tracks['KIN_TYPE_SL'].strips['KIN_TYPE_SL_close']

From there you can access the frame_start and frame_end properties of the strip. Increasing both of these by the same amount will move the strip. For example:

strip.frame_start += 10
strip.frame_end += 10

To shift multiple strips you can loop over the strips collection in the same way you would loop over actions:

strips = bpy.data.objects['sash_KIN_TYPE_S'].animation_data.nla_tracks['KIN_TYPE_SL'].strips
for strip in strips:
    strip.frame_start += 10
    strip.frame_end += 10

I found all of this out by hovering my mouse over the properties in the NLA Editor and looking in the tooltip (because I enabled Python Tooltips in the User Preferences).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.