Copying markers in Blender is easy
Ever wanted to copy markers from one scene to another? Blender doesn’t have a built-in method to do this but we can do it with some Python.
Markers are stored as scene properties, much like Render settings or units, that’s why we can’t copy them individually. The alternative is to append/duplicate the entire scene and then remove what we don’t want. But man that’s a waste of time. We can get this done much faster with the ancient arts of Python scripting.
If you have a camera bound to the markers, and the camera is also available in the target scene, you can set it afterwards.
import bpy
source_scene = bpy.data.scenes['Scene']
target_scene = bpy.data.scenes['Other Scene']
for marker in source_scene.timeline_markers:
new_marker = target_scene.timeline_markers.new(name=marker.name, frame=marker.frame)
# Camera (if it's available in the other scene)
new_marker.camera = marker.camera
Sharing markers between blendfiles
Copying markers between blendfiles is a little more involved but not hard. We need a file to write the markers and then read them from it. You can use any format you want to do this, I’m going to use a simple one:
- One Marker per line
- First the frame number, then the marker’s name. Separated by a comma.
Here’s the script we would run in the source blendfile.
import bpy
source_scene = bpy.data.scenes['Scene']
# Don't forget to change this!
filename = '/path/to/file/markers.txt'
with open(filename, 'w') as stream:
for marker in source_scene.timeline_markers:
stream.write(f'{marker.frame},{marker.name}\n')
Once we have written the file, we can read from it and create the markers in the target blendfile. We use the strip()
function to remove the newlines (\n
) from the name.
import bpy
target_scene = bpy.data.scenes['Other Scene']
# Don't forget to change this!
filename = '/path/to/file/markers.txt'
with open(filename, 'r') as stream:
for line in stream.readlines():
frame, name = line.strip().split(',')
target_scene.timeline_markers.new(name=name, frame=int(frame))
That’s all there is to it. Don’t forget you can also keep the markers file around and import it into multiple blendfiles!
Batch rendering is complicated
But it doesn’t have to be! Render+ lets you setup, run batches and a whole lot more from the comfort of Blender’s interface.
Try out Render+ today!