mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Add logic to extract colorspace from metadata if available.
- Extract colorspace from media metadata for review clips. - Update instance data with the extracted colorspace information.
This commit is contained in:
parent
a1f5270eb9
commit
68db3d9c11
1 changed files with 37 additions and 0 deletions
|
|
@ -95,9 +95,46 @@ class CollectOtioReview(pyblish.api.InstancePlugin):
|
|||
instance.data["label"] = label + " (review)"
|
||||
instance.data["families"] += ["review", "ftrack"]
|
||||
instance.data["otioReviewClips"] = otio_review_clips
|
||||
|
||||
self.log.info(
|
||||
"Creating review track: {}".format(otio_review_clips))
|
||||
|
||||
# get colorspace from metadata if available
|
||||
if len(otio_review_clips) >= 1 and any(
|
||||
# lets make sure any clip with media reference is found
|
||||
(
|
||||
clip
|
||||
for clip in otio_review_clips
|
||||
if isinstance(clip, otio.schema.Clip)
|
||||
and clip.media_reference
|
||||
)
|
||||
):
|
||||
# get metadata from first clip
|
||||
# get colorspace from metadata if available
|
||||
# check if resolution is the same as source
|
||||
r_otio_cl = next(
|
||||
(
|
||||
clip
|
||||
for clip in otio_review_clips
|
||||
if isinstance(clip, otio.schema.Clip)
|
||||
and clip.media_reference
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
# get metadata from first clip with media reference
|
||||
media_ref = r_otio_cl.media_reference
|
||||
media_metadata = media_ref.metadata
|
||||
|
||||
# TODO: we might need some alternative method since
|
||||
# native OTIO exports do not support ayon metadata
|
||||
if review_colorspace := media_metadata.get(
|
||||
"ayon.source.colorspace"
|
||||
):
|
||||
instance.data["reviewColorspace"] = review_colorspace
|
||||
self.log.info(
|
||||
"Review colorspace: {}".format(review_colorspace))
|
||||
|
||||
self.log.debug(
|
||||
"_ instance.data: {}".format(pformat(instance.data)))
|
||||
self.log.debug(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue