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

@ -28,7 +28,8 @@ from .lib import (
get_reformated_filename,
get_frame_from_filename,
get_padding_from_filename,
maintained_object_duplication
maintained_object_duplication,
get_clip_segment
)
from .utils import (
setup,
@ -99,6 +100,7 @@ __all__ = [
"get_frame_from_filename",
"get_padding_from_filename",
"maintained_object_duplication",
"get_clip_segment",
# pipeline
"install",

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]

View file

@ -69,7 +69,7 @@ def uninstall():
log.info("OpenPype Flame host uninstalled ...")
def containerise(flame_clip,
def containerise(flame_clip_segment,
name,
namespace,
context,
@ -91,11 +91,9 @@ def containerise(flame_clip,
log.debug("_ data_imprint: {}".format(data_imprint))
segment = flame_clip.versions[-1].tracks[-1].segments[-1]
set_segment_data_marker(flame_clip_segment, data_imprint)
set_segment_data_marker(segment, data_imprint)
return flame_clip
return True
def ls():

View file

@ -97,8 +97,10 @@ class LoadClip(opfapi.ClipLoader):
"objectName": clip_name
})
opc_segment = opfapi.get_clip_segment(opc)
return opfapi.containerise(
opc,
opc_segment,
name, namespace, context,
self.__class__.__name__,
data_imprint)

4
yarn.lock Normal file
View file

@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1