1
$\begingroup$

Situation:

I was doing a physic simulation with thousands of small objects. I baked those into keyframes => should be 1st animation.

Now I want to do this again for a second animation.

Problem:

I would like to stash all of the current Actions of the selected objects into the same NLA-track (same name), so that when I export the objects it is only one animation. And then I can bake the next physic simulation and stash them into another NLA-track for the second animation. Nevertheless, I can't find an option to stash all current actions of the selected objects and rename the NLA-track. And I certainly don't want to do this manually for each.

Maybe there is also another solution to do so?

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

Thanks to @MartyFouts I could solve my problem and shorten the code a bit. So now it is doing what I intended: The action of each object is pushed onto a new action strip (muted) with a given name and the action is cleared.

import bpy

selected_objects = [ object for object in bpy.context.selected_objects if object.animation_data]

start_frame = 1

for obj in selected_objects:
    tracks = obj.animation_data.nla_tracks
    new_track = tracks.new(prev=None)
    new_track.name = "Some Name"
    new_track.mute = True
    
    strip = new_track.strips.new(obj.animation_data.action.name, start_frame, obj.animation_data.action)
    obj.animation_data.action = None
$\endgroup$

You must log in to answer this question.

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