Created
July 16, 2018 14:57
-
-
Save the-simian/4c5ec43bf071b812d71d8846ce8e8b06 to your computer and use it in GitHub Desktop.
Blender Script to Name each animation Frame after the marker and number the frames per animation, rather than per sequence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import os | |
import time | |
# get the scene | |
scn = bpy.context.scene | |
# get the output path | |
output_path = scn.render.filepath | |
starting_filepath = output_path | |
all_unsorted_markers = scn.timeline_markers.values() | |
all_markers = sorted(all_unsorted_markers, key=lambda x: x.frame) | |
current_marker_index = 0 | |
current_marker = all_markers[current_marker_index] | |
for frame in range(scn.frame_start, scn.frame_end): | |
next_marker_index = current_marker_index+1 | |
if len(all_markers) > next_marker_index : | |
if all_markers[next_marker_index].frame == frame : | |
current_marker_index += 1 | |
current_marker = all_markers[current_marker_index] | |
marker_name = current_marker.name | |
animation_frame_number = str(frame - current_marker.frame) | |
scn.frame_set(frame) | |
print("Progress :") | |
print(str(current_marker_index) + " | " + str(len(all_markers))) | |
print("Marker / Frame :") | |
print(marker_name + " | " + animation_frame_number) | |
scn.render.filepath = os.path.join(output_path,marker_name + "-" + animation_frame_number + ".png") | |
bpy.ops.render.render( write_still=True ) | |
bpy.context.scene.render.filepath = starting_filepath | |
print("DONE") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment