5
$\begingroup$

I've got a scene with timeline markers. Example: "Bob", "John" etc.

I want to set the Output file name to match these markers, so that I can hit Render Animation and have Blender change the output file names to match the timeline markers. So when the playhead reaches the "bob" timeline marker, the output filename is changed to "bob.png"

enter image description here

How would I go about making a Python script to automate this?

$\endgroup$
1
  • $\begingroup$ Sure! pasteall.org/pic/show.php?id=82275 As you can see, I simply need to change the file name based on the current timeline marker. $\endgroup$
    – Billrey
    Commented Jan 13, 2015 at 11:06

1 Answer 1

10
$\begingroup$

Following script renders every frame in the timeline if it is a marker assigned to it. It uses the existing output file path and and the current marker name as output file name.

enter image description here

import bpy
import os

# get the scene
scn = bpy.context.scene

# get the output path
output_path = scn.render.filepath

# iterate through markers and render
for k, m in scn.timeline_markers.items():  
    frame = m.frame
    marker_name = m.name
    scn.frame_set(frame)
    scn.render.filepath = os.path.join(output_path, marker_name + ".jpg")
    bpy.ops.render.render( write_still=True )

bpy.context.scene.render.filepath = output_path

.blend

$\endgroup$
2
  • $\begingroup$ Brilliant! Well done. Works a treat. Thanks $\endgroup$
    – Billrey
    Commented Jan 19, 2015 at 14:17
  • 1
    $\begingroup$ Still works 5 years later, in blender 2.92!! $\endgroup$
    – DavidGasku
    Commented Dec 5, 2020 at 10:09

You must log in to answer this question.

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