Merge pull request #1541 from BigRoy/bugfix/extract_oiio_transcode_apply_scene_display_view

Fix setting display/view based on collected scene display/view if left empty in ExtractOIIOTranscode settings.
This commit is contained in:
Jakub Trllo 2025-12-01 12:53:55 +01:00 committed by GitHub
commit 0589733e21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 38 additions and 28 deletions

View file

@ -253,6 +253,19 @@ def create_skeleton_instance(
"reuseLastVersion": data.get("reuseLastVersion", False),
}
# Pass on the OCIO metadata of what the source display and view are
# so that the farm can correctly set up color management.
if "sceneDisplay" in data and "sceneView" in data:
instance_skeleton_data["sceneDisplay"] = data["sceneDisplay"]
instance_skeleton_data["sceneView"] = data["sceneView"]
elif "colorspaceDisplay" in data and "colorspaceView" in data:
# Backwards compatibility for sceneDisplay and sceneView
instance_skeleton_data["colorspaceDisplay"] = data["colorspaceDisplay"]
instance_skeleton_data["colorspaceView"] = data["colorspaceView"]
if "sourceDisplay" in data and "sourceView" in data:
instance_skeleton_data["sourceDisplay"] = data["sourceDisplay"]
instance_skeleton_data["sourceView"] = data["sourceView"]
if data.get("renderlayer"):
instance_skeleton_data["renderlayer"] = data["renderlayer"]
@ -589,7 +602,6 @@ def create_instances_for_aov(
"""
# we cannot attach AOVs to other products as we consider every
# AOV product of its own.
log = Logger.get_logger("farm_publishing")
# if there are product to attach to and more than one AOV,
@ -612,8 +624,8 @@ def create_instances_for_aov(
additional_data.update({
"colorspaceConfig": colorspace_config,
# Display/View are optional
"display": instance.data.get("colorspaceDisplay"),
"view": instance.data.get("colorspaceView")
"display": instance.data.get("sourceDisplay"),
"view": instance.data.get("sourceView")
})
# Get templated path from absolute config path.

View file

@ -87,15 +87,19 @@ class ExtractOIIOTranscode(publish.Extractor):
profile_output_defs = profile["outputs"]
new_representations = []
repres = instance.data["representations"]
for idx, repre in enumerate(list(repres)):
# target space, display and view might be defined upstream
# TODO: address https://github.com/ynput/ayon-core/pull/1268#discussion_r2156555474
# Implement upstream logic to handle target_colorspace,
# target_display, target_view in other DCCs
target_colorspace = False
target_display = instance.data.get("colorspaceDisplay")
target_view = instance.data.get("colorspaceView")
scene_display = instance.data.get(
"sceneDisplay",
# Backward compatibility
instance.data.get("colorspaceDisplay")
)
scene_view = instance.data.get(
"sceneView",
# Backward compatibility
instance.data.get("colorspaceView")
)
for idx, repre in enumerate(list(repres)):
self.log.debug("repre ({}): `{}`".format(idx + 1, repre["name"]))
if not self._repre_is_valid(repre):
continue
@ -142,24 +146,18 @@ class ExtractOIIOTranscode(publish.Extractor):
transcoding_type = output_def["transcoding_type"]
# NOTE: we use colorspace_data as the fallback values for
# the target colorspace.
# Set target colorspace/display/view based on transcoding type
target_colorspace = None
target_view = None
target_display = None
if transcoding_type == "colorspace":
# TODO: Should we fallback to the colorspace
# (which used as source above) ?
# or should we compute the target colorspace from
# current view and display ?
target_colorspace = (output_def["colorspace"] or
colorspace_data.get("colorspace"))
target_colorspace = output_def["colorspace"]
elif transcoding_type == "display_view":
display_view = output_def["display_view"]
target_view = (
display_view["view"]
or colorspace_data.get("view"))
target_display = (
display_view["display"]
or colorspace_data.get("display")
)
# If empty values are provided in output definition,
# fallback to scene display/view that is collected from DCC
target_view = display_view["view"] or scene_view
target_display = display_view["display"] or scene_display
# both could be already collected by DCC,
# but could be overwritten when transcoding

View file

@ -456,7 +456,7 @@ class UseDisplayViewModel(BaseSettingsModel):
title="Target Display",
description=(
"Display of the target transform. If left empty, the"
" source Display value will be used."
" scene Display value will be used."
)
)
view: str = SettingsField(
@ -464,7 +464,7 @@ class UseDisplayViewModel(BaseSettingsModel):
title="Target View",
description=(
"View of the target transform. If left empty, the"
" source View value will be used."
" scene View value will be used."
)
)