Created
November 30, 2020 11:31
-
-
Save sirkkalap/1999c994d26e7be877708f9b72a23810 to your computer and use it in GitHub Desktop.
Write Blender sequencer markers to a CSV file
This file contains 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
# From: https://www.quollism.com/b/archives/113 | |
# | |
# "You can copypaste this script straight into Blender’s text editor and hit | |
# “Run Script” to output filename_frames.csv in the directory right next to | |
# your currently open file. Yay!" | |
# | |
import bpy | |
import csv | |
import os | |
C = bpy.context | |
markers = {} | |
for m in C.scene.timeline_markers: | |
markers[m.frame] = m.name | |
k = list(markers.keys()) | |
k.sort() | |
frameinfo = [] | |
for frame in k: | |
frameinfo.append( [markers[frame], frame] ) | |
with open(os.path.splitext(bpy.data.filepath)[0]+'_frames.csv', 'w', newline='') as f: | |
writer = csv.writer(f) | |
writer.writerow( [ "Marker", "Frame" ] ) | |
for row in frameinfo: | |
writer.writerow(row) | |
print("All done!") |
Please thank the original author at From: https://www.quollism.com/b/archives/113 . This is just a fork. :)
If you are looking for a solution to read the markers back in, here is a ChatGPT generated reverse script (untested) to do that:
import bpy
import csv
import os
def import_markers_from_csv(csv_file):
with open(csv_file, 'r') as f:
reader = csv.DictReader(f)
markers_data = list(reader)
for data in markers_data:
frame = int(data['Frame'])
name = data['Marker']
bpy.context.scene.timeline_markers.new(name=name, frame=frame)
csv_file_path = "path/to/your/filename_frames.csv"
import_markers_from_csv(csv_file_path)
print("Markers imported from CSV file.")
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Really Works.
Only for timeline.
I go to search solution for reading this files.
Thanks !