-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathshared_export.py
47 lines (33 loc) · 1.34 KB
/
shared_export.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from collections import OrderedDict
import bpy
def find_seqs(scene, select_marker):
sequences = OrderedDict()
sequence_flags = {}
if "Sequences" in bpy.data.texts:
for line in bpy.data.texts["Sequences"].as_string().split("\n"):
line = line.strip()
if not line:
continue
if ":" not in line:
print("Invalid line in 'Sequences':", line)
continue
name, flags = line.split(":", 1)
if name not in sequences:
sequences[name] = {}
if flags.lstrip():
flags = tuple(map(lambda f: f.strip(), flags.split(",")))
else:
flags = ()
sequence_flags[name] = flags
for marker in scene.timeline_markers:
if ":" not in marker.name or (select_marker and not marker.select):
continue
name, what = marker.name.rsplit(":", 1)
what = what.lower()
if name not in sequences:
sequences[name] = {}
if what in sequences[name]:
print("Warning: Got duplicate '{}' marker for sequence '{}' at frame {} (first was at frame {}), ignoring".format(what, name, marker.frame, sequences[name][what].frame))
continue
sequences[name][what] = marker
return sequences, sequence_flags