# Render each strip from NLA editor?

I have 20 different strips on the NLA editor, and am trying to render all of them.

How do I:

1. Render each strip seperately into it's own output folder
2. Render only active frames/keyframes

Python looks promising, but I was wondering if anyone could give a few hints on the methods needed.

Something along the lines of:

for strip in nla.getstrips()
{

active_frames = dopesheet.getKeyFrames();

start_frame = active_frames.first();
finish_frame= active_frames.last();

render( dopesheet,
range = [start_frame, end_frame],
outfolder = strip.name()
);

dopesheet.remove( strip );
}

• Do any nla strips overlap? do you want any overlapping strips to render separately? For skipping still frames this answer may help. – sambler Jan 11 '16 at 7:48
• Yes, many strips do overlap (multiple paths an animation can take), and yes overlapping strips should NOT mix and should be kept seperate please – tetris11 Jan 11 '16 at 9:35

Looking at 1. to render each strip into it's own folder we can make a list of each nla strip, here I store the mute setting to restore later and mute each strip as we go through.

Then loop through our list of strips and render the frame range of each one, by setting the render.filepath here each strip can go into it's own folder.

To also achieve 2. you could look at the script in this answer and incorporate it into the rendering loop.

import bpy

output_dir = '//renders/'
scene = bpy.context.scene

# make a list of strips used in the NLA
# strips are found in -
# object.animation_data.nla_tracks[TrackName].strips[stripName]
nla_strips = []
for obj in scene.objects:
if obj.animation_data and obj.animation_data.nla_tracks:
for track in obj.animation_data.nla_tracks:
for strip in track.strips:
nla_strips.append((strip, strip.mute))
strip.mute = True

# save to restore later
orig_frame_start = scene.frame_start
orig_frame_end = scene.frame_end
orig_filepath = scene.render.filepath

# render each strip
for strip in nla_strips:
scene.render.filepath = output_dir + strip[0].name + '/'
scene.frame_start = strip[0].frame_start
scene.frame_end = strip[0].frame_end
strip[0].mute = False
bpy.ops.render.render(animation=True)
strip[0].mute = True