Fix setting display/view based on collected scene display/view if left empty in ExtractOIIOTranscode settings.

`instance.data["sceneDisplay"]` and `instance.data["sceneView"]` are now intended to be set to describe the user's configured display/view inside the DCC and can still be used as fallback for the `ExtractOIIOTrancode` transcoding. For the time being the legacy `colorspaceDisplay` and `colorspaceView` instance.data keys will act as fallback for backwards compatibility to represent the scene display and view.

Also see:
 https://github.com/ynput/ayon-core/issues/1430#issuecomment-3516459205
This commit is contained in:
Roy Nieterau 2025-11-11 12:43:00 +01:00
parent 3fcb4949f2
commit 0dfaed53cb
3 changed files with 25 additions and 27 deletions

View file

@ -594,8 +594,8 @@ def create_instances_for_aov(
additional_color_data = {
"renderProducts": instance.data["renderProducts"],
"colorspaceConfig": instance.data["colorspaceConfig"],
"display": instance.data["colorspaceDisplay"],
"view": instance.data["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

@ -443,7 +443,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(
@ -451,7 +451,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."
)
)