flame: add clip segment unpacking method

This commit is contained in:
Jakub Jezek 2022-02-10 15:28:19 +01:00
parent 5910617943
commit 8e12ef43df
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
5 changed files with 28 additions and 7 deletions

View file

@ -692,3 +692,18 @@ def maintained_object_duplication(item):
finally:
# delete the item at the end
flame.delete(duplicate)
def get_clip_segment(flame_clip):
name = flame_clip.name.get_value()
version = flame_clip.versions[0]
track = version.tracks[0]
segments = track.segments
if len(segments) < 1:
raise ValueError("Clip `{}` has no segments!".format(name))
if len(segments) > 1:
raise ValueError("Clip `{}` has too many segments!".format(name))
return segments[0]