From d90310079cbd7a81a032be3f3d50f7346805ff76 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Tue, 3 Sep 2024 15:13:36 +0300 Subject: [PATCH] refactor settings names --- .../plugins/publish/extract_color_transcode.py | 15 +++++++++------ server/settings/publish_plugins.py | 18 +++++------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_color_transcode.py b/client/ayon_core/plugins/publish/extract_color_transcode.py index c5f90e4c99..77ab6d0428 100644 --- a/client/ayon_core/plugins/publish/extract_color_transcode.py +++ b/client/ayon_core/plugins/publish/extract_color_transcode.py @@ -123,15 +123,18 @@ class ExtractOIIOTranscode(publish.Extractor): target_colorspace = view = display = None # NOTE: we use colorspace_data as the fallback values for the target colorspace. - if transcoding_type == "use_colorspace": + 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["use_colorspace"]["colorspace"] or + target_colorspace = (output_def["colorspace"] or colorspace_data.get("colorspace")) - elif transcoding_type == "use_display_view": - view = output_def["use_display_view"]["view"] or colorspace_data.get("view") - display = (output_def["use_display_view"]["display"] or - colorspace_data.get("display")) + elif transcoding_type == "display_view": + display_view = output_def["display_view"] + view = display_view["view"] or colorspace_data.get("view") + display = ( + display_view["display"] + or colorspace_data.get("display") + ) # both could be already collected by DCC, # but could be overwritten when transcoding diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index cbfab4c5c6..98a50e6101 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -267,8 +267,8 @@ class ExtractThumbnailModel(BaseSettingsModel): def _extract_oiio_transcoding_type(): return [ - {"value": "use_colorspace", "label": "Use Colorspace"}, - {"value": "use_display_view", "label": "Use Display&View"} + {"value": "colorspace", "label": "Use Colorspace"}, + {"value": "display_view", "label": "Use Display&View"} ] @@ -277,11 +277,6 @@ class OIIOToolArgumentsModel(BaseSettingsModel): default_factory=list, title="Arguments") -class UseColorspaceModel(BaseSettingsModel): - _layout = "expanded" - colorspace: str = SettingsField("", title="Target Colorspace") - - class UseDisplayViewModel(BaseSettingsModel): _layout = "expanded" display: str = SettingsField("", title="Target Display") @@ -298,16 +293,13 @@ class ExtractOIIOTranscodeOutputModel(BaseSettingsModel): ) extension: str = SettingsField("", title="Extension") transcoding_type: str = SettingsField( - "use_colorspace", + "colorspace", title="Transcoding type", enum_resolver=_extract_oiio_transcoding_type, conditionalEnum=True ) - use_colorspace: UseColorspaceModel = SettingsField( - title="Use Colorspace", - default_factory=UseColorspaceModel - ) - use_display_view: UseDisplayViewModel = SettingsField( + colorspace: str = SettingsField("", title="Target Colorspace") + display_view: UseDisplayViewModel = SettingsField( title="Use Display&View", default_factory=UseDisplayViewModel )