From c03326f5d8d0c45427d5cb24187c390d2b8c5113 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 19 Sep 2023 19:19:40 +0800 Subject: [PATCH 01/25] Jakub's comment on the review plugin --- openpype/hosts/nuke/api/plugin.py | 5 + .../publish/extract_review_data_mov.py | 2 +- openpype/settings/ayon_settings.py | 21 ++- .../defaults/project_settings/nuke.json | 54 +++++++ .../schemas/schema_nuke_publish.json | 145 ++++++++++++++++++ .../nuke/server/settings/publish_plugins.py | 10 +- .../settings_project_global.md | 12 +- website/docs/pype2/admin_presets_plugins.md | 3 +- 8 files changed, 236 insertions(+), 16 deletions(-) diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index a0e1525cd0..adbe43e481 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -21,6 +21,9 @@ from openpype.pipeline import ( CreatedInstance, get_current_task_name ) +from openpype.lib.transcoding import ( + VIDEO_EXTENSIONS +) from .lib import ( INSTANCE_DATA_KNOB, Knobby, @@ -801,6 +804,8 @@ class ExporterReviewMov(ExporterReview): self.log.info("File info was set...") self.file = self.fhead + self.name + ".{}".format(self.ext) + if self.ext != VIDEO_EXTENSIONS: + self.file = os.path.basename(self.path_in) self.path = os.path.join( self.staging_dir, self.file).replace("\\", "/") diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py b/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py index 956d1a54a3..1568a2de9b 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py @@ -8,7 +8,7 @@ from openpype.hosts.nuke.api import plugin from openpype.hosts.nuke.api.lib import maintained_selection -class ExtractReviewDataMov(publish.Extractor): +class ExtractReviewDataBakingStreams(publish.Extractor): """Extracts movie and thumbnail with baked in luts must be run after extract_render_local.py diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index 9a4f0607e0..b7fcaa1216 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -748,7 +748,19 @@ def _convert_nuke_project_settings(ayon_settings, output): ) new_review_data_outputs = {} - for item in ayon_publish["ExtractReviewDataMov"]["outputs"]: + outputs_settings = None + # just in case that the users having old presets in outputs setting + deprecrated_review_settings = ayon_publish["ExtractReviewDataMov"] + current_review_settings = ( + ayon_publish["ExtractReviewDataBakingStreams"] + ) + if deprecrated_review_settings["outputs"] == ( + current_review_settings["outputs"]): + outputs_settings = current_review_settings["outputs"] + else: + outputs_settings = deprecrated_review_settings["outputs"] + + for item in outputs_settings: item_filter = item["filter"] if "product_names" in item_filter: item_filter["subsets"] = item_filter.pop("product_names") @@ -767,7 +779,12 @@ def _convert_nuke_project_settings(ayon_settings, output): name = item.pop("name") new_review_data_outputs[name] = item - ayon_publish["ExtractReviewDataMov"]["outputs"] = new_review_data_outputs + + if deprecrated_review_settings["outputs"] == ( + current_review_settings["outputs"]): + current_review_settings["outputs"] = new_review_data_outputs + else: + deprecrated_review_settings["outputs"] = new_review_data_outputs collect_instance_data = ayon_publish["CollectInstanceData"] if "sync_workfile_version_on_product_types" in collect_instance_data: diff --git a/openpype/settings/defaults/project_settings/nuke.json b/openpype/settings/defaults/project_settings/nuke.json index 7961e77113..fac78dbcd5 100644 --- a/openpype/settings/defaults/project_settings/nuke.json +++ b/openpype/settings/defaults/project_settings/nuke.json @@ -501,6 +501,60 @@ } } }, + "ExtractReviewDataBakingStreams": { + "enabled": true, + "viewer_lut_raw": false, + "outputs": { + "baking": { + "filter": { + "task_types": [], + "families": [], + "subsets": [] + }, + "read_raw": false, + "viewer_process_override": "", + "bake_viewer_process": true, + "bake_viewer_input_process": true, + "reformat_nodes_config": { + "enabled": false, + "reposition_nodes": [ + { + "node_class": "Reformat", + "knobs": [ + { + "type": "text", + "name": "type", + "value": "to format" + }, + { + "type": "text", + "name": "format", + "value": "HD_1080" + }, + { + "type": "text", + "name": "filter", + "value": "Lanczos6" + }, + { + "type": "bool", + "name": "black_outside", + "value": true + }, + { + "type": "bool", + "name": "pbb", + "value": false + } + ] + } + ] + }, + "extension": "mov", + "add_custom_tags": [] + } + } + }, "ExtractSlateFrame": { "viewer_lut_raw": false, "key_value_mapping": { diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json index f006392bef..0f366d55ba 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json @@ -371,6 +371,151 @@ ] }, + { + "type": "label", + "label": "^ Settings and for ExtractReviewDataMov is deprecated and will be soon removed.
Please use ExtractReviewDataBakingStreams instead." + }, + { + "type": "dict", + "collapsible": true, + "checkbox_key": "enabled", + "key": "ExtractReviewDataBakingStreams", + "label": "ExtractReviewDataBakingStreams", + "is_group": true, + "children": [ + { + "type": "boolean", + "key": "enabled", + "label": "Enabled" + }, + { + "type": "boolean", + "key": "viewer_lut_raw", + "label": "Viewer LUT raw" + }, + { + "key": "outputs", + "label": "Output Definitions", + "type": "dict-modifiable", + "highlight_content": true, + "object_type": { + "type": "dict", + "children": [ + { + "type": "dict", + "collapsible": false, + "key": "filter", + "label": "Filtering", + "children": [ + { + "key": "task_types", + "label": "Task types", + "type": "task-types-enum" + }, + { + "key": "families", + "label": "Families", + "type": "list", + "object_type": "text" + }, + { + "key": "subsets", + "label": "Subsets", + "type": "list", + "object_type": "text" + } + ] + }, + { + "type": "separator" + }, + { + "type": "boolean", + "key": "read_raw", + "label": "Read colorspace RAW", + "default": false + }, + { + "type": "text", + "key": "viewer_process_override", + "label": "Viewer Process colorspace profile override" + }, + { + "type": "boolean", + "key": "bake_viewer_process", + "label": "Bake Viewer Process" + }, + { + "type": "boolean", + "key": "bake_viewer_input_process", + "label": "Bake Viewer Input Process (LUTs)" + }, + { + "type": "separator" + }, + { + "key": "reformat_nodes_config", + "type": "dict", + "label": "Reformat Nodes", + "collapsible": true, + "checkbox_key": "enabled", + "children": [ + { + "type": "boolean", + "key": "enabled", + "label": "Enabled" + }, + { + "type": "label", + "label": "Reposition knobs supported only.
You can add multiple reformat nodes
and set their knobs. Order of reformat
nodes is important. First reformat node
will be applied first and last reformat
node will be applied last." + }, + { + "key": "reposition_nodes", + "type": "list", + "label": "Reposition nodes", + "object_type": { + "type": "dict", + "children": [ + { + "key": "node_class", + "label": "Node class", + "type": "text" + }, + { + "type": "schema_template", + "name": "template_nuke_knob_inputs", + "template_data": [ + { + "label": "Node knobs", + "key": "knobs" + } + ] + } + ] + } + } + ] + }, + { + "type": "separator" + }, + { + "type": "text", + "key": "extension", + "label": "Write node file type" + }, + { + "key": "add_custom_tags", + "label": "Add custom tags", + "type": "list", + "object_type": "text" + } + ] + } + } + + ] + }, { "type": "dict", "collapsible": true, diff --git a/server_addon/nuke/server/settings/publish_plugins.py b/server_addon/nuke/server/settings/publish_plugins.py index c78685534f..423448219d 100644 --- a/server_addon/nuke/server/settings/publish_plugins.py +++ b/server_addon/nuke/server/settings/publish_plugins.py @@ -165,7 +165,7 @@ class BakingStreamModel(BaseSettingsModel): title="Custom tags", default_factory=list) -class ExtractReviewDataMovModel(BaseSettingsModel): +class ExtractReviewBakingStreamsModel(BaseSettingsModel): enabled: bool = Field(title="Enabled") viewer_lut_raw: bool = Field(title="Viewer lut raw") outputs: list[BakingStreamModel] = Field( @@ -266,9 +266,9 @@ class PublishPuginsModel(BaseSettingsModel): title="Extract Review Data Lut", default_factory=ExtractReviewDataLutModel ) - ExtractReviewDataMov: ExtractReviewDataMovModel = Field( - title="Extract Review Data Mov", - default_factory=ExtractReviewDataMovModel + ExtractReviewDataBakingStreams: ExtractReviewBakingStreamsModel = Field( + title="Extract Review Data Baking Streams", + default_factory=ExtractReviewBakingStreamsModel ) ExtractSlateFrame: ExtractSlateFrameModel = Field( title="Extract Slate Frame", @@ -410,7 +410,7 @@ DEFAULT_PUBLISH_PLUGIN_SETTINGS = { "ExtractReviewDataLut": { "enabled": False }, - "ExtractReviewDataMov": { + "ExtractReviewDataBakingStreams": { "enabled": True, "viewer_lut_raw": False, "outputs": [ diff --git a/website/docs/project_settings/settings_project_global.md b/website/docs/project_settings/settings_project_global.md index 5ddf247d98..9092ccdcdf 100644 --- a/website/docs/project_settings/settings_project_global.md +++ b/website/docs/project_settings/settings_project_global.md @@ -189,10 +189,10 @@ A profile may generate multiple outputs from a single input. Each output must de - Profile filtering defines which group of output definitions is used but output definitions may require more specific filters on their own. - They may filter by subset name (regex can be used) or publish families. Publish families are more complex as are based on knowing code base. - Filtering by custom tags -> this is used for targeting to output definitions from other extractors using settings (at this moment only Nuke bake extractor can target using custom tags). - - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewDataMov/outputs/baking/add_custom_tags` + - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewDataBakingStreams/outputs/baking/add_custom_tags` - Filtering by input length. Input may be video, sequence or single image. It is possible that `.mp4` should be created only when input is video or sequence and to create review `.png` when input is single frame. In some cases the output should be created even if it's single frame or multi frame input. - + ### Extract Burnin Plugin is responsible for adding burnins into review representations. @@ -226,13 +226,13 @@ A burnin profile may set multiple burnin outputs from one input. The burnin's na | **Bottom Centered** | Bottom center content. | str | "{username}" | | **Bottom Right** | Bottom right corner content. | str | "{frame_start}-{current_frame}-{frame_end}" | -Each burnin profile can be configured with additional family filtering and can -add additional tags to the burnin representation, these can be configured under +Each burnin profile can be configured with additional family filtering and can +add additional tags to the burnin representation, these can be configured under the profile's **Additional filtering** section. :::note Filename suffix -The filename suffix is appended to filename of the source representation. For -example, if the source representation has suffix **"h264"** and the burnin +The filename suffix is appended to filename of the source representation. For +example, if the source representation has suffix **"h264"** and the burnin suffix is **"client"** then the final suffix is **"h264_client"**. ::: diff --git a/website/docs/pype2/admin_presets_plugins.md b/website/docs/pype2/admin_presets_plugins.md index 6a057f4bb4..a869ead819 100644 --- a/website/docs/pype2/admin_presets_plugins.md +++ b/website/docs/pype2/admin_presets_plugins.md @@ -534,8 +534,7 @@ Plugin responsible for generating thumbnails with colorspace controlled by Nuke. } ``` -### `ExtractReviewDataMov` - +### `ExtractReviewDataBakingStreams` `viewer_lut_raw` **true** will publish the baked mov file without any colorspace conversion. It will be baked with the workfile workspace. This can happen in case the Viewer input process uses baked screen space luts. #### baking with controlled colorspace From e0fba9713d37c4cf73210c2c37179f9403b2399a Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 19 Sep 2023 19:22:52 +0800 Subject: [PATCH 02/25] hound --- openpype/settings/ayon_settings.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index b7fcaa1216..0b72d267f7 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -755,7 +755,8 @@ def _convert_nuke_project_settings(ayon_settings, output): ayon_publish["ExtractReviewDataBakingStreams"] ) if deprecrated_review_settings["outputs"] == ( - current_review_settings["outputs"]): + current_review_settings["outputs"] + ): outputs_settings = current_review_settings["outputs"] else: outputs_settings = deprecrated_review_settings["outputs"] @@ -781,7 +782,8 @@ def _convert_nuke_project_settings(ayon_settings, output): new_review_data_outputs[name] = item if deprecrated_review_settings["outputs"] == ( - current_review_settings["outputs"]): + current_review_settings["outputs"] + ): current_review_settings["outputs"] = new_review_data_outputs else: deprecrated_review_settings["outputs"] = new_review_data_outputs From 174ef45b0b068ccfc9382a254af64ea0d4c5b009 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 22 Sep 2023 15:07:58 +0800 Subject: [PATCH 03/25] jakub's comment on apply_settings and fix the bug of not being extracted the review --- openpype/hosts/nuke/api/plugin.py | 11 ++- ...ov.py => extract_review_baking_streams.py} | 30 +++++++- .../nuke/server/settings/publish_plugins.py | 71 +++++++++++++++++++ server_addon/nuke/server/version.py | 2 +- 4 files changed, 109 insertions(+), 5 deletions(-) rename openpype/hosts/nuke/plugins/publish/{extract_review_data_mov.py => extract_review_baking_streams.py} (82%) diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index adbe43e481..a814615164 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -804,8 +804,13 @@ class ExporterReviewMov(ExporterReview): self.log.info("File info was set...") self.file = self.fhead + self.name + ".{}".format(self.ext) - if self.ext != VIDEO_EXTENSIONS: - self.file = os.path.basename(self.path_in) + if ".{}".format(self.ext) not in VIDEO_EXTENSIONS: + filename = os.path.basename(self.path_in) + self.file = filename + if ".{}".format(self.ext) not in self.file: + wrg_ext = filename.split(".")[-1] + self.file = filename.replace(wrg_ext, self.ext) + self.path = os.path.join( self.staging_dir, self.file).replace("\\", "/") @@ -926,7 +931,7 @@ class ExporterReviewMov(ExporterReview): self.log.debug("Path: {}".format(self.path)) write_node["file"].setValue(str(self.path)) write_node["file_type"].setValue(str(self.ext)) - + self.log.debug("{0}".format(self.ext)) # Knobs `meta_codec` and `mov64_codec` are not available on centos. # TODO shouldn't this come from settings on outputs? try: diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py similarity index 82% rename from openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py rename to openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py index 1568a2de9b..59a3f659c9 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_data_mov.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py @@ -16,7 +16,7 @@ class ExtractReviewDataBakingStreams(publish.Extractor): """ order = pyblish.api.ExtractorOrder + 0.01 - label = "Extract Review Data Mov" + label = "Extract Review Data Baking Streams" families = ["review"] hosts = ["nuke"] @@ -25,6 +25,34 @@ class ExtractReviewDataBakingStreams(publish.Extractor): viewer_lut_raw = None outputs = {} + @classmethod + def apply_settings(cls, project_settings): + """just in case there are some old presets + in deprecrated ExtractReviewDataMov Plugins + """ + nuke_publish = project_settings["nuke"]["publish"] + deprecrated_review_settings = nuke_publish["ExtractReviewDataMov"] + current_review_settings = ( + nuke_publish["ExtractReviewDataBakingStreams"] + ) + if deprecrated_review_settings["viewer_lut_raw"] == ( + current_review_settings["viewer_lut_raw"] + ): + cls.viewer_lut_raw = ( + current_review_settings["viewer_lut_raw"] + ) + else: + cls.viewer_lut_raw = ( + deprecrated_review_settings["viewer_lut_raw"] + ) + + if deprecrated_review_settings["outputs"] == ( + current_review_settings["outputs"] + ): + cls.outputs = current_review_settings["outputs"] + else: + cls.outputs = deprecrated_review_settings["outputs"] + def process(self, instance): families = set(instance.data["families"]) diff --git a/server_addon/nuke/server/settings/publish_plugins.py b/server_addon/nuke/server/settings/publish_plugins.py index 423448219d..6459dd7225 100644 --- a/server_addon/nuke/server/settings/publish_plugins.py +++ b/server_addon/nuke/server/settings/publish_plugins.py @@ -165,6 +165,18 @@ class BakingStreamModel(BaseSettingsModel): title="Custom tags", default_factory=list) +class ExtractReviewDataMovModel(BaseSettingsModel): + """[deprecated] use Extract Review Data Baking + Streams instead. + """ + enabled: bool = Field(title="Enabled") + viewer_lut_raw: bool = Field(title="Viewer lut raw") + outputs: list[BakingStreamModel] = Field( + default_factory=list, + title="Baking streams" + ) + + class ExtractReviewBakingStreamsModel(BaseSettingsModel): enabled: bool = Field(title="Enabled") viewer_lut_raw: bool = Field(title="Viewer lut raw") @@ -266,6 +278,10 @@ class PublishPuginsModel(BaseSettingsModel): title="Extract Review Data Lut", default_factory=ExtractReviewDataLutModel ) + ExtractReviewDataMov: ExtractReviewDataMovModel = Field( + title="Extract Review Data Mov", + default_factory=ExtractReviewDataMovModel + ) ExtractReviewDataBakingStreams: ExtractReviewBakingStreamsModel = Field( title="Extract Review Data Baking Streams", default_factory=ExtractReviewBakingStreamsModel @@ -410,6 +426,61 @@ DEFAULT_PUBLISH_PLUGIN_SETTINGS = { "ExtractReviewDataLut": { "enabled": False }, + "ExtractReviewDataMov": { + "enabled": True, + "viewer_lut_raw": False, + "outputs": [ + { + "name": "baking", + "filter": { + "task_types": [], + "product_types": [], + "product_names": [] + }, + "read_raw": False, + "viewer_process_override": "", + "bake_viewer_process": True, + "bake_viewer_input_process": True, + "reformat_nodes_config": { + "enabled": False, + "reposition_nodes": [ + { + "node_class": "Reformat", + "knobs": [ + { + "type": "text", + "name": "type", + "text": "to format" + }, + { + "type": "text", + "name": "format", + "text": "HD_1080" + }, + { + "type": "text", + "name": "filter", + "text": "Lanczos6" + }, + { + "type": "bool", + "name": "black_outside", + "boolean": True + }, + { + "type": "bool", + "name": "pbb", + "boolean": False + } + ] + } + ] + }, + "extension": "mov", + "add_custom_tags": [] + } + ] + }, "ExtractReviewDataBakingStreams": { "enabled": True, "viewer_lut_raw": False, diff --git a/server_addon/nuke/server/version.py b/server_addon/nuke/server/version.py index b3f4756216..ae7362549b 100644 --- a/server_addon/nuke/server/version.py +++ b/server_addon/nuke/server/version.py @@ -1 +1 @@ -__version__ = "0.1.2" +__version__ = "0.1.3" From dd2255f8fd13919d8e3d2d2df02652a515f00a57 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 22 Sep 2023 20:39:33 +0800 Subject: [PATCH 04/25] jakub's comment --- openpype/hosts/nuke/api/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index a814615164..fe7b52cd8a 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -808,8 +808,8 @@ class ExporterReviewMov(ExporterReview): filename = os.path.basename(self.path_in) self.file = filename if ".{}".format(self.ext) not in self.file: - wrg_ext = filename.split(".")[-1] - self.file = filename.replace(wrg_ext, self.ext) + original_ext = filename.split(".")[-1] + self.file = filename.replace(original_ext, self.ext) self.path = os.path.join( self.staging_dir, self.file).replace("\\", "/") From d744a486d64134455ffc636fef92ce09c9742b5f Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 22 Sep 2023 21:38:30 +0800 Subject: [PATCH 05/25] edit the settings where deprecated_setting used when it enabled; current_setting adopted when deprecated_setting diabled in extract_reiew_baking_streams --- .../publish/extract_review_baking_streams.py | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py index 59a3f659c9..d9ae673c2c 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py @@ -28,30 +28,18 @@ class ExtractReviewDataBakingStreams(publish.Extractor): @classmethod def apply_settings(cls, project_settings): """just in case there are some old presets - in deprecrated ExtractReviewDataMov Plugins + in deprecated ExtractReviewDataMov Plugins """ nuke_publish = project_settings["nuke"]["publish"] - deprecrated_review_settings = nuke_publish["ExtractReviewDataMov"] - current_review_settings = ( - nuke_publish["ExtractReviewDataBakingStreams"] - ) - if deprecrated_review_settings["viewer_lut_raw"] == ( - current_review_settings["viewer_lut_raw"] - ): - cls.viewer_lut_raw = ( - current_review_settings["viewer_lut_raw"] - ) + deprecated_setting = nuke_publish["ExtractReviewDataMov"] + current_setting = nuke_publish["ExtractReviewDataBakingStreams"] + if not deprecated_setting["enabled"]: + if current_setting["enabled"]: + cls.viewer_lut_raw = current_setting["viewer_lut_raw"] + cls.outputs = current_setting["outputs"] else: - cls.viewer_lut_raw = ( - deprecrated_review_settings["viewer_lut_raw"] - ) - - if deprecrated_review_settings["outputs"] == ( - current_review_settings["outputs"] - ): - cls.outputs = current_review_settings["outputs"] - else: - cls.outputs = deprecrated_review_settings["outputs"] + cls.viewer_lut_raw = deprecated_setting["viewer_lut_raw"] + cls.outputs = deprecated_setting["outputs"] def process(self, instance): families = set(instance.data["families"]) From 21d547a085c1b06fc9f26829920b24dd0068d01b Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Sun, 24 Sep 2023 12:49:30 +0800 Subject: [PATCH 06/25] introduce the function for checking the filename to see if it consists of the frame hashes element --- openpype/hosts/nuke/api/lib.py | 18 ++++++++++++++++++ openpype/hosts/nuke/api/plugin.py | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 41e6a27cef..ed517b472c 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3397,3 +3397,21 @@ def create_viewer_profile_string(viewer, display=None, path_like=False): if path_like: return "{}/{}".format(display, viewer) return "{} ({})".format(viewer, display) + +def get_file_with_name_and_hashes(original_path, name): + """Function to get the ranmed filename with frame hashes + + Args: + original_path (str): the filename with frame hashes + name (str): the name of the tags + + Returns: + filename: the renamed filename with the tag + """ + filename = os.path.basename(original_path) + fhead = filename.split(".")[0] + if "#" in fhead: + fhead = fhead.replace("#", "")[:-1] + new_fhead = "{}.{}".format(fhead, name) + filename = filename.replace(fhead, new_fhead) + return filename diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index fe7b52cd8a..b7927738d6 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -38,7 +38,8 @@ from .lib import ( get_node_data, get_view_process_node, get_viewer_config_from_string, - deprecated + deprecated, + get_file_with_name_and_hashes ) from .pipeline import ( list_instances, @@ -805,11 +806,12 @@ class ExporterReviewMov(ExporterReview): self.file = self.fhead + self.name + ".{}".format(self.ext) if ".{}".format(self.ext) not in VIDEO_EXTENSIONS: - filename = os.path.basename(self.path_in) + filename = get_file_with_name_and_hashes( + self.path_in, self.name) self.file = filename if ".{}".format(self.ext) not in self.file: original_ext = filename.split(".")[-1] - self.file = filename.replace(original_ext, self.ext) + self.file = filename.replace(original_ext, ext) self.path = os.path.join( self.staging_dir, self.file).replace("\\", "/") @@ -931,7 +933,6 @@ class ExporterReviewMov(ExporterReview): self.log.debug("Path: {}".format(self.path)) write_node["file"].setValue(str(self.path)) write_node["file_type"].setValue(str(self.ext)) - self.log.debug("{0}".format(self.ext)) # Knobs `meta_codec` and `mov64_codec` are not available on centos. # TODO shouldn't this come from settings on outputs? try: From 6f858a80ca4839bb581685d48d4d5d6304ac5403 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Sun, 24 Sep 2023 12:50:42 +0800 Subject: [PATCH 07/25] hound --- openpype/hosts/nuke/api/lib.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index ed517b472c..2c5838ffd3 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3398,6 +3398,7 @@ def create_viewer_profile_string(viewer, display=None, path_like=False): return "{}/{}".format(display, viewer) return "{} ({})".format(viewer, display) + def get_file_with_name_and_hashes(original_path, name): """Function to get the ranmed filename with frame hashes From 5f7f4f08d1cf1ac38c4016e3c4d4bb2211b73767 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 14:23:17 +0800 Subject: [PATCH 08/25] fix the slate in --- openpype/hosts/nuke/api/plugin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index b7927738d6..f587d109c1 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -591,6 +591,11 @@ class ExporterReview(object): # get first and last frame self.first_frame = min(self.collection.indexes) self.last_frame = max(self.collection.indexes) + + first = self.instance.data.get("frameStartHandle", None) + if first: + if first > self.first_frame: + self.first_frame = first else: self.fname = os.path.basename(self.path_in) self.fhead = os.path.splitext(self.fname)[0] + "." From 41e81ef7a87faced226f2bcc6b904e58de5f78e0 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 18:03:22 +0800 Subject: [PATCH 09/25] rename the function and the elaborate the docstring --- openpype/hosts/nuke/api/lib.py | 6 ++++-- openpype/hosts/nuke/api/plugin.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 2c5838ffd3..d95839bb8d 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3399,8 +3399,10 @@ def create_viewer_profile_string(viewer, display=None, path_like=False): return "{} ({})".format(viewer, display) -def get_file_with_name_and_hashes(original_path, name): - """Function to get the ranmed filename with frame hashes +def get_head_filename_without_hashes(original_path, name): + """Function to get the ranmed head filename without frame hashes + To avoid the system being confused on finding the filename with + frame hashes if the head of the filename has the hashed symbol Args: original_path (str): the filename with frame hashes diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index 97e7c3ad8c..1550a60f32 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -39,7 +39,7 @@ from .lib import ( get_view_process_node, get_viewer_config_from_string, deprecated, - get_file_with_name_and_hashes + get_head_filename_without_hashes ) from .pipeline import ( list_instances, @@ -813,7 +813,7 @@ class ExporterReviewMov(ExporterReview): self.file = self.fhead + self.name + ".{}".format(self.ext) if ".{}".format(self.ext) not in VIDEO_EXTENSIONS: - filename = get_file_with_name_and_hashes( + filename = get_head_filename_without_hashes( self.path_in, self.name) self.file = filename if ".{}".format(self.ext) not in self.file: From 22ce181f2de6b1ed001a135442c1884a71882599 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 18:24:48 +0800 Subject: [PATCH 10/25] make sure the deprecated setting used when it enabled while the current setting is used when the deprecrated setting diabled --- openpype/settings/ayon_settings.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index a66e1b6ec6..b43e0b7c5f 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -754,10 +754,9 @@ def _convert_nuke_project_settings(ayon_settings, output): current_review_settings = ( ayon_publish["ExtractReviewDataBakingStreams"] ) - if deprecrated_review_settings["outputs"] == ( - current_review_settings["outputs"] - ): - outputs_settings = current_review_settings["outputs"] + if not deprecrated_review_settings["enabled"]: + if current_review_settings["enabled"]: + outputs_settings = current_review_settings["outputs"] else: outputs_settings = deprecrated_review_settings["outputs"] From 3da4bac77db45edff25df7e4958a301ff5775cbc Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 18:26:16 +0800 Subject: [PATCH 11/25] typo in lib --- openpype/hosts/nuke/api/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index d95839bb8d..3617133d2b 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3400,7 +3400,7 @@ def create_viewer_profile_string(viewer, display=None, path_like=False): def get_head_filename_without_hashes(original_path, name): - """Function to get the ranmed head filename without frame hashes + """Function to get the renamed head filename without frame hashes To avoid the system being confused on finding the filename with frame hashes if the head of the filename has the hashed symbol From 8b76238b2d8199e2af541365e6ef074ef1c95825 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 19:25:44 +0800 Subject: [PATCH 12/25] fixing get_head_filename_without_hashes not being able to get multiple hashes & some strip fix --- openpype/hosts/nuke/api/lib.py | 8 ++++++-- openpype/hosts/nuke/api/plugin.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 3617133d2b..29e7c88c71 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3406,15 +3406,19 @@ def get_head_filename_without_hashes(original_path, name): Args: original_path (str): the filename with frame hashes + e.g. "renderAssetMain.####.exr" name (str): the name of the tags + e.g. "baking" Returns: filename: the renamed filename with the tag + e.g. "renderAssetMain.baking.####.exr" """ filename = os.path.basename(original_path) fhead = filename.split(".")[0] - if "#" in fhead: - fhead = fhead.replace("#", "")[:-1] + tmp_fhead = re.sub("\d", "#", fhead) + if "#" in tmp_fhead: + fhead = tmp_fhead.replace("#", "").rstrip(".") new_fhead = "{}.{}".format(fhead, name) filename = filename.replace(fhead, new_fhead) return filename diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index 1550a60f32..ca31068943 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -817,7 +817,7 @@ class ExporterReviewMov(ExporterReview): self.path_in, self.name) self.file = filename if ".{}".format(self.ext) not in self.file: - original_ext = filename.split(".")[-1] + original_ext = os.path.splitext(filename)[-1].strip(".") # noqa self.file = filename.replace(original_ext, ext) self.path = os.path.join( From e2509a9447c5900f4c469a2c81e89c9a79a2524e Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Mon, 25 Sep 2023 19:29:35 +0800 Subject: [PATCH 13/25] hound --- openpype/hosts/nuke/api/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 29e7c88c71..7b1aaa8fe0 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3415,8 +3415,8 @@ def get_head_filename_without_hashes(original_path, name): e.g. "renderAssetMain.baking.####.exr" """ filename = os.path.basename(original_path) - fhead = filename.split(".")[0] - tmp_fhead = re.sub("\d", "#", fhead) + fhead = os.path.splitext(filename)[0].strip(".") + tmp_fhead = re.sub(r"\d", "#", fhead) if "#" in tmp_fhead: fhead = tmp_fhead.replace("#", "").rstrip(".") new_fhead = "{}.{}".format(fhead, name) From 0595afe8a3240747cd852e3fc4073f58382ccd86 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 26 Sep 2023 00:34:44 +0800 Subject: [PATCH 14/25] add % check on the fhead in the lib.py --- openpype/hosts/nuke/api/lib.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index af07092daf..8790794fcd 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3432,19 +3432,27 @@ def get_head_filename_without_hashes(original_path, name): Args: original_path (str): the filename with frame hashes - e.g. "renderAssetMain.####.exr" + e.g. "renderCompositingMain.####.exr" name (str): the name of the tags e.g. "baking" Returns: filename: the renamed filename with the tag - e.g. "renderAssetMain.baking.####.exr" + e.g. "renderCompositingMain.baking.####.exr" """ filename = os.path.basename(original_path) fhead = os.path.splitext(filename)[0].strip(".") - tmp_fhead = re.sub(r"\d", "#", fhead) - if "#" in tmp_fhead: - fhead = tmp_fhead.replace("#", "").rstrip(".") + if "#" in fhead: + fhead = re.sub("#+", "", fhead).rstrip(".") + elif "%" in fhead: + # use regex to convert %04d to {:0>4} + padding = re.search("%(\\d)+d", fhead) + padding = padding.group(1) if padding else 1 + fhead = re.sub( + "%.*d", + "{{:0>{}}}".format(padding), + fhead + ).rstip(".") new_fhead = "{}.{}".format(fhead, name) filename = filename.replace(fhead, new_fhead) return filename From 65bfe023c7d2b8a571185a49e78ef7b775d30fc9 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 26 Sep 2023 00:41:04 +0800 Subject: [PATCH 15/25] transform the files with frame hashes to the list of filenames when publishing --- openpype/hosts/nuke/api/lib.py | 24 ++++++++++++++++++++++++ openpype/hosts/nuke/api/plugin.py | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 8790794fcd..9e41dbe8bc 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3456,3 +3456,27 @@ def get_head_filename_without_hashes(original_path, name): new_fhead = "{}.{}".format(fhead, name) filename = filename.replace(fhead, new_fhead) return filename + + +def get_filenames_without_hash(filename, frame_start, frame_end): + """Get filenames without frame hash + i.e. "renderCompositingMain.baking.0001.exr" + + Args: + filename (str): filename with frame hash + frame_start (str): start of the frame + frame_end (str): end of the frame + + Returns: + filenames(list): list of filename + """ + filenames = [] + for frame in range(int(frame_start), (int(frame_end) + 1)): + if "#" in filename: + # use regex to convert #### to {:0>4} + def replace(match): + return "{{:0>{}}}".format(len(match.group())) + filename_without_hashes = re.sub("#+", replace, filename) + new_filename = filename_without_hashes.format(frame) + filenames.append(new_filename) + return filenames diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index ca31068943..348a0b5d76 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -39,7 +39,8 @@ from .lib import ( get_view_process_node, get_viewer_config_from_string, deprecated, - get_head_filename_without_hashes + get_head_filename_without_hashes, + get_filenames_without_hash ) from .pipeline import ( list_instances, @@ -638,6 +639,10 @@ class ExporterReview(object): "frameStart": self.first_frame, "frameEnd": self.last_frame, }) + if ".{}".format(self.ext) not in VIDEO_EXTENSIONS: + filenames = get_filenames_without_hash( + self.file, self.first_frame, self.last_frame) + repre["files"] = filenames if self.multiple_presets: repre["outputName"] = self.name From 6deb9338cbd56447ea548f20eb0a51158b124b9e Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 27 Sep 2023 21:47:02 +0800 Subject: [PATCH 16/25] fix the typo of rstrip --- openpype/hosts/nuke/api/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 9e41dbe8bc..351778d997 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3452,7 +3452,7 @@ def get_head_filename_without_hashes(original_path, name): "%.*d", "{{:0>{}}}".format(padding), fhead - ).rstip(".") + ).rstrip(".") new_fhead = "{}.{}".format(fhead, name) filename = filename.replace(fhead, new_fhead) return filename From ebdcc49cd7895aa3e4aceadb0a0af116a0e41843 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 27 Sep 2023 22:52:53 +0800 Subject: [PATCH 17/25] implement more concise function for getting filenames with hashes --- openpype/hosts/nuke/api/lib.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 351778d997..d34e7a1e0a 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3432,30 +3432,20 @@ def get_head_filename_without_hashes(original_path, name): Args: original_path (str): the filename with frame hashes - e.g. "renderCompositingMain.####.exr" + e.g. "renderCompositingMain.####.exr" name (str): the name of the tags - e.g. "baking" + e.g. "baking" Returns: - filename: the renamed filename with the tag - e.g. "renderCompositingMain.baking.####.exr" + str: the renamed filename with the tag + e.g. "renderCompositingMain.baking.####.exr" """ filename = os.path.basename(original_path) - fhead = os.path.splitext(filename)[0].strip(".") - if "#" in fhead: - fhead = re.sub("#+", "", fhead).rstrip(".") - elif "%" in fhead: - # use regex to convert %04d to {:0>4} - padding = re.search("%(\\d)+d", fhead) - padding = padding.group(1) if padding else 1 - fhead = re.sub( - "%.*d", - "{{:0>{}}}".format(padding), - fhead - ).rstrip(".") - new_fhead = "{}.{}".format(fhead, name) - filename = filename.replace(fhead, new_fhead) - return filename + + def insert_name(matchobj): + return "{}.{}".format(name, matchobj.group(0)) + + return re.sub(r"(%\d*d)|#+", insert_name, filename) def get_filenames_without_hash(filename, frame_start, frame_end): From abef01cd0560ce60e108ed71c1de1d159b7efcb1 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 27 Sep 2023 22:54:18 +0800 Subject: [PATCH 18/25] edit docstring --- openpype/hosts/nuke/api/lib.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index d34e7a1e0a..cc2c5a6ec7 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3430,15 +3430,20 @@ def get_head_filename_without_hashes(original_path, name): To avoid the system being confused on finding the filename with frame hashes if the head of the filename has the hashed symbol + Examples: + >>> get_head_filename_without_hashes("render.####.exr", "baking") + render.baking.####.exr + >>> get_head_filename_without_hashes("render.%d.exr", "tag") + render.tag.%d.exr + >>> get_head_filename_without_hashes("exr.####.exr", "foo") + exr.foo.%04d.exr + Args: original_path (str): the filename with frame hashes - e.g. "renderCompositingMain.####.exr" name (str): the name of the tags - e.g. "baking" Returns: str: the renamed filename with the tag - e.g. "renderCompositingMain.baking.####.exr" """ filename = os.path.basename(original_path) From e493886f4de4316778d3129d40f441f8ded24b71 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 27 Sep 2023 23:17:12 +0800 Subject: [PATCH 19/25] improve docstring on lib.py and add comment on the condition of setting filename with extension and improved the deprecrated settings --- openpype/hosts/nuke/api/lib.py | 2 +- openpype/hosts/nuke/api/plugin.py | 4 ++++ .../publish/extract_review_baking_streams.py | 10 +++++----- openpype/settings/ayon_settings.py | 15 ++++++--------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index cc2c5a6ec7..dafc4bf838 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3463,7 +3463,7 @@ def get_filenames_without_hash(filename, frame_start, frame_end): frame_end (str): end of the frame Returns: - filenames(list): list of filename + list: filename per frame of the sequence """ filenames = [] for frame in range(int(frame_start), (int(frame_end) + 1)): diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index 348a0b5d76..e16aef6740 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -818,9 +818,13 @@ class ExporterReviewMov(ExporterReview): self.file = self.fhead + self.name + ".{}".format(self.ext) if ".{}".format(self.ext) not in VIDEO_EXTENSIONS: + # filename would be with frame hashes if + # the file extension is not in video format filename = get_head_filename_without_hashes( self.path_in, self.name) self.file = filename + # make sure the filename are in + # correct image output format if ".{}".format(self.ext) not in self.file: original_ext = os.path.splitext(filename)[-1].strip(".") # noqa self.file = filename.replace(original_ext, ext) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py index d9ae673c2c..fe468bd263 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py @@ -33,13 +33,13 @@ class ExtractReviewDataBakingStreams(publish.Extractor): nuke_publish = project_settings["nuke"]["publish"] deprecated_setting = nuke_publish["ExtractReviewDataMov"] current_setting = nuke_publish["ExtractReviewDataBakingStreams"] - if not deprecated_setting["enabled"]: - if current_setting["enabled"]: - cls.viewer_lut_raw = current_setting["viewer_lut_raw"] - cls.outputs = current_setting["outputs"] - else: + if deprecated_setting["enabled"]: + # Use deprecated settings if they are still enabled cls.viewer_lut_raw = deprecated_setting["viewer_lut_raw"] cls.outputs = deprecated_setting["outputs"] + elif current_setting["enabled"]: + cls.viewer_lut_raw = current_setting["viewer_lut_raw"] + cls.outputs = current_setting["outputs"] def process(self, instance): families = set(instance.data["families"]) diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index b43e0b7c5f..dc6e9fab12 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -754,11 +754,10 @@ def _convert_nuke_project_settings(ayon_settings, output): current_review_settings = ( ayon_publish["ExtractReviewDataBakingStreams"] ) - if not deprecrated_review_settings["enabled"]: - if current_review_settings["enabled"]: - outputs_settings = current_review_settings["outputs"] - else: + if deprecrated_review_settings["enabled"]: outputs_settings = deprecrated_review_settings["outputs"] + elif current_review_settings["enabled"]: + outputs_settings = current_review_settings["outputs"] for item in outputs_settings: item_filter = item["filter"] @@ -780,12 +779,10 @@ def _convert_nuke_project_settings(ayon_settings, output): name = item.pop("name") new_review_data_outputs[name] = item - if deprecrated_review_settings["outputs"] == ( - current_review_settings["outputs"] - ): - current_review_settings["outputs"] = new_review_data_outputs - else: + if deprecrated_review_settings["enabled"]: deprecrated_review_settings["outputs"] = new_review_data_outputs + elif current_review_settings["enabled"]: + current_review_settings["outputs"] = new_review_data_outputs collect_instance_data = ayon_publish["CollectInstanceData"] if "sync_workfile_version_on_product_types" in collect_instance_data: From 973e4804d5731dbb85e916177ecef7854d5d30d1 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 27 Sep 2023 23:30:57 +0800 Subject: [PATCH 20/25] make sure not using .replace --- openpype/hosts/nuke/api/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/nuke/api/plugin.py b/openpype/hosts/nuke/api/plugin.py index e16aef6740..81841d17be 100644 --- a/openpype/hosts/nuke/api/plugin.py +++ b/openpype/hosts/nuke/api/plugin.py @@ -826,8 +826,8 @@ class ExporterReviewMov(ExporterReview): # make sure the filename are in # correct image output format if ".{}".format(self.ext) not in self.file: - original_ext = os.path.splitext(filename)[-1].strip(".") # noqa - self.file = filename.replace(original_ext, ext) + filename_no_ext, _ = os.path.splitext(filename) + self.file = "{}.{}".format(filename_no_ext, self.ext) self.path = os.path.join( self.staging_dir, self.file).replace("\\", "/") From 356f05ff91efd32dcecbb72081f94740ec8df908 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 28 Sep 2023 19:20:37 +0800 Subject: [PATCH 21/25] docstring tweaks --- openpype/hosts/nuke/api/lib.py | 2 +- .../nuke/plugins/publish/extract_review_baking_streams.py | 6 +++--- openpype/settings/ayon_settings.py | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index dafc4bf838..07f394ec00 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3433,7 +3433,7 @@ def get_head_filename_without_hashes(original_path, name): Examples: >>> get_head_filename_without_hashes("render.####.exr", "baking") render.baking.####.exr - >>> get_head_filename_without_hashes("render.%d.exr", "tag") + >>> get_head_filename_without_hashes("render.%04d.exr", "tag") render.tag.%d.exr >>> get_head_filename_without_hashes("exr.####.exr", "foo") exr.foo.%04d.exr diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py index fe468bd263..1ba107a3e7 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py @@ -9,7 +9,7 @@ from openpype.hosts.nuke.api.lib import maintained_selection class ExtractReviewDataBakingStreams(publish.Extractor): - """Extracts movie and thumbnail with baked in luts + """Extracts Sequences and thumbnail with baked in luts must be run after extract_render_local.py @@ -27,8 +27,8 @@ class ExtractReviewDataBakingStreams(publish.Extractor): @classmethod def apply_settings(cls, project_settings): - """just in case there are some old presets - in deprecated ExtractReviewDataMov Plugins + """Apply the settings from the deprecated + ExtractReviewDataMov plugin for backwards compatibility """ nuke_publish = project_settings["nuke"]["publish"] deprecated_setting = nuke_publish["ExtractReviewDataMov"] diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index dc6e9fab12..f23046e6c4 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -749,7 +749,8 @@ def _convert_nuke_project_settings(ayon_settings, output): new_review_data_outputs = {} outputs_settings = None - # just in case that the users having old presets in outputs setting + # Check deprecated ExtractReviewDataMov + # settings for backwards compatibility deprecrated_review_settings = ayon_publish["ExtractReviewDataMov"] current_review_settings = ( ayon_publish["ExtractReviewDataBakingStreams"] From 6c1e066b3b7d58eba28d38900a886a0c89c556b5 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 28 Sep 2023 20:07:28 +0800 Subject: [PATCH 22/25] Rename ExtractReviewDataBakingStreams to ExtractReviewIntermediate --- .../nuke/plugins/publish/extract_review_baking_streams.py | 6 +++--- openpype/settings/ayon_settings.py | 2 +- openpype/settings/defaults/project_settings/nuke.json | 2 +- .../projects_schema/schemas/schema_nuke_publish.json | 6 +++--- server_addon/nuke/server/settings/publish_plugins.py | 4 ++-- website/docs/project_settings/settings_project_global.md | 2 +- website/docs/pype2/admin_presets_plugins.md | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py index 1ba107a3e7..4407c039b4 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py @@ -8,7 +8,7 @@ from openpype.hosts.nuke.api import plugin from openpype.hosts.nuke.api.lib import maintained_selection -class ExtractReviewDataBakingStreams(publish.Extractor): +class ExtractReviewIntermediate(publish.Extractor): """Extracts Sequences and thumbnail with baked in luts must be run after extract_render_local.py @@ -16,7 +16,7 @@ class ExtractReviewDataBakingStreams(publish.Extractor): """ order = pyblish.api.ExtractorOrder + 0.01 - label = "Extract Review Data Baking Streams" + label = "Extract Review Intermediate" families = ["review"] hosts = ["nuke"] @@ -32,7 +32,7 @@ class ExtractReviewDataBakingStreams(publish.Extractor): """ nuke_publish = project_settings["nuke"]["publish"] deprecated_setting = nuke_publish["ExtractReviewDataMov"] - current_setting = nuke_publish["ExtractReviewDataBakingStreams"] + current_setting = nuke_publish["ExtractReviewIntermediate"] if deprecated_setting["enabled"]: # Use deprecated settings if they are still enabled cls.viewer_lut_raw = deprecated_setting["viewer_lut_raw"] diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index f23046e6c4..fbf35aec0a 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -753,7 +753,7 @@ def _convert_nuke_project_settings(ayon_settings, output): # settings for backwards compatibility deprecrated_review_settings = ayon_publish["ExtractReviewDataMov"] current_review_settings = ( - ayon_publish["ExtractReviewDataBakingStreams"] + ayon_publish["ExtractReviewIntermediate"] ) if deprecrated_review_settings["enabled"]: outputs_settings = deprecrated_review_settings["outputs"] diff --git a/openpype/settings/defaults/project_settings/nuke.json b/openpype/settings/defaults/project_settings/nuke.json index fac78dbcd5..7346c9d7b8 100644 --- a/openpype/settings/defaults/project_settings/nuke.json +++ b/openpype/settings/defaults/project_settings/nuke.json @@ -501,7 +501,7 @@ } } }, - "ExtractReviewDataBakingStreams": { + "ExtractReviewIntermediate": { "enabled": true, "viewer_lut_raw": false, "outputs": { diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json index 0f366d55ba..c14f47a3a7 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json @@ -373,14 +373,14 @@ }, { "type": "label", - "label": "^ Settings and for ExtractReviewDataMov is deprecated and will be soon removed.
Please use ExtractReviewDataBakingStreams instead." + "label": "^ Settings and for ExtractReviewDataMov is deprecated and will be soon removed.
Please use ExtractReviewIntermediate instead." }, { "type": "dict", "collapsible": true, "checkbox_key": "enabled", - "key": "ExtractReviewDataBakingStreams", - "label": "ExtractReviewDataBakingStreams", + "key": "ExtractReviewIntermediate", + "label": "ExtractReviewIntermediate", "is_group": true, "children": [ { diff --git a/server_addon/nuke/server/settings/publish_plugins.py b/server_addon/nuke/server/settings/publish_plugins.py index 6459dd7225..399aa7e38e 100644 --- a/server_addon/nuke/server/settings/publish_plugins.py +++ b/server_addon/nuke/server/settings/publish_plugins.py @@ -282,7 +282,7 @@ class PublishPuginsModel(BaseSettingsModel): title="Extract Review Data Mov", default_factory=ExtractReviewDataMovModel ) - ExtractReviewDataBakingStreams: ExtractReviewBakingStreamsModel = Field( + ExtractReviewIntermediate: ExtractReviewBakingStreamsModel = Field( title="Extract Review Data Baking Streams", default_factory=ExtractReviewBakingStreamsModel ) @@ -481,7 +481,7 @@ DEFAULT_PUBLISH_PLUGIN_SETTINGS = { } ] }, - "ExtractReviewDataBakingStreams": { + "ExtractReviewIntermediate": { "enabled": True, "viewer_lut_raw": False, "outputs": [ diff --git a/website/docs/project_settings/settings_project_global.md b/website/docs/project_settings/settings_project_global.md index 8ecfe0c5da..3aa9772118 100644 --- a/website/docs/project_settings/settings_project_global.md +++ b/website/docs/project_settings/settings_project_global.md @@ -189,7 +189,7 @@ A profile may generate multiple outputs from a single input. Each output must de - Profile filtering defines which group of output definitions is used but output definitions may require more specific filters on their own. - They may filter by subset name (regex can be used) or publish families. Publish families are more complex as are based on knowing code base. - Filtering by custom tags -> this is used for targeting to output definitions from other extractors using settings (at this moment only Nuke bake extractor can target using custom tags). - - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewDataBakingStreams/outputs/baking/add_custom_tags` + - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewIntermediate/outputs/baking/add_custom_tags` - Filtering by input length. Input may be video, sequence or single image. It is possible that `.mp4` should be created only when input is video or sequence and to create review `.png` when input is single frame. In some cases the output should be created even if it's single frame or multi frame input. diff --git a/website/docs/pype2/admin_presets_plugins.md b/website/docs/pype2/admin_presets_plugins.md index a869ead819..a039c5fbd8 100644 --- a/website/docs/pype2/admin_presets_plugins.md +++ b/website/docs/pype2/admin_presets_plugins.md @@ -534,7 +534,7 @@ Plugin responsible for generating thumbnails with colorspace controlled by Nuke. } ``` -### `ExtractReviewDataBakingStreams` +### `ExtractReviewIntermediate` `viewer_lut_raw` **true** will publish the baked mov file without any colorspace conversion. It will be baked with the workfile workspace. This can happen in case the Viewer input process uses baked screen space luts. #### baking with controlled colorspace From ef12a5229dec982aa525f9fee2c29493263e0faf Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 28 Sep 2023 20:27:55 +0800 Subject: [PATCH 23/25] plural form for extract_review_intermediate --- ...king_streams.py => extract_review_intermediates.py} | 4 ++-- openpype/settings/ayon_settings.py | 2 +- openpype/settings/defaults/project_settings/nuke.json | 2 +- .../projects_schema/schemas/schema_nuke_publish.json | 6 +++--- server_addon/nuke/server/settings/publish_plugins.py | 10 +++++----- .../docs/project_settings/settings_project_global.md | 2 +- website/docs/pype2/admin_presets_plugins.md | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) rename openpype/hosts/nuke/plugins/publish/{extract_review_baking_streams.py => extract_review_intermediates.py} (99%) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py similarity index 99% rename from openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py rename to openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py index 4407c039b4..2d996b1381 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_baking_streams.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py @@ -8,7 +8,7 @@ from openpype.hosts.nuke.api import plugin from openpype.hosts.nuke.api.lib import maintained_selection -class ExtractReviewIntermediate(publish.Extractor): +class ExtractReviewIntermediates(publish.Extractor): """Extracts Sequences and thumbnail with baked in luts must be run after extract_render_local.py @@ -32,7 +32,7 @@ class ExtractReviewIntermediate(publish.Extractor): """ nuke_publish = project_settings["nuke"]["publish"] deprecated_setting = nuke_publish["ExtractReviewDataMov"] - current_setting = nuke_publish["ExtractReviewIntermediate"] + current_setting = nuke_publish["ExtractReviewIntermediates"] if deprecated_setting["enabled"]: # Use deprecated settings if they are still enabled cls.viewer_lut_raw = deprecated_setting["viewer_lut_raw"] diff --git a/openpype/settings/ayon_settings.py b/openpype/settings/ayon_settings.py index fbf35aec0a..68693bb953 100644 --- a/openpype/settings/ayon_settings.py +++ b/openpype/settings/ayon_settings.py @@ -753,7 +753,7 @@ def _convert_nuke_project_settings(ayon_settings, output): # settings for backwards compatibility deprecrated_review_settings = ayon_publish["ExtractReviewDataMov"] current_review_settings = ( - ayon_publish["ExtractReviewIntermediate"] + ayon_publish["ExtractReviewIntermediates"] ) if deprecrated_review_settings["enabled"]: outputs_settings = deprecrated_review_settings["outputs"] diff --git a/openpype/settings/defaults/project_settings/nuke.json b/openpype/settings/defaults/project_settings/nuke.json index 7346c9d7b8..ad9f46c8ab 100644 --- a/openpype/settings/defaults/project_settings/nuke.json +++ b/openpype/settings/defaults/project_settings/nuke.json @@ -501,7 +501,7 @@ } } }, - "ExtractReviewIntermediate": { + "ExtractReviewIntermediates": { "enabled": true, "viewer_lut_raw": false, "outputs": { diff --git a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json index c14f47a3a7..fa08e19c63 100644 --- a/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json +++ b/openpype/settings/entities/schemas/projects_schema/schemas/schema_nuke_publish.json @@ -373,14 +373,14 @@ }, { "type": "label", - "label": "^ Settings and for ExtractReviewDataMov is deprecated and will be soon removed.
Please use ExtractReviewIntermediate instead." + "label": "^ Settings and for ExtractReviewDataMov is deprecated and will be soon removed.
Please use ExtractReviewIntermediates instead." }, { "type": "dict", "collapsible": true, "checkbox_key": "enabled", - "key": "ExtractReviewIntermediate", - "label": "ExtractReviewIntermediate", + "key": "ExtractReviewIntermediates", + "label": "ExtractReviewIntermediates", "is_group": true, "children": [ { diff --git a/server_addon/nuke/server/settings/publish_plugins.py b/server_addon/nuke/server/settings/publish_plugins.py index 399aa7e38e..efb814eff0 100644 --- a/server_addon/nuke/server/settings/publish_plugins.py +++ b/server_addon/nuke/server/settings/publish_plugins.py @@ -177,7 +177,7 @@ class ExtractReviewDataMovModel(BaseSettingsModel): ) -class ExtractReviewBakingStreamsModel(BaseSettingsModel): +class ExtractReviewIntermediatesModel(BaseSettingsModel): enabled: bool = Field(title="Enabled") viewer_lut_raw: bool = Field(title="Viewer lut raw") outputs: list[BakingStreamModel] = Field( @@ -282,9 +282,9 @@ class PublishPuginsModel(BaseSettingsModel): title="Extract Review Data Mov", default_factory=ExtractReviewDataMovModel ) - ExtractReviewIntermediate: ExtractReviewBakingStreamsModel = Field( - title="Extract Review Data Baking Streams", - default_factory=ExtractReviewBakingStreamsModel + ExtractReviewIntermediates: ExtractReviewIntermediatesModel = Field( + title="Extract Review Intermediates", + default_factory=ExtractReviewIntermediatesModel ) ExtractSlateFrame: ExtractSlateFrameModel = Field( title="Extract Slate Frame", @@ -481,7 +481,7 @@ DEFAULT_PUBLISH_PLUGIN_SETTINGS = { } ] }, - "ExtractReviewIntermediate": { + "ExtractReviewIntermediates": { "enabled": True, "viewer_lut_raw": False, "outputs": [ diff --git a/website/docs/project_settings/settings_project_global.md b/website/docs/project_settings/settings_project_global.md index 3aa9772118..27aa60a464 100644 --- a/website/docs/project_settings/settings_project_global.md +++ b/website/docs/project_settings/settings_project_global.md @@ -189,7 +189,7 @@ A profile may generate multiple outputs from a single input. Each output must de - Profile filtering defines which group of output definitions is used but output definitions may require more specific filters on their own. - They may filter by subset name (regex can be used) or publish families. Publish families are more complex as are based on knowing code base. - Filtering by custom tags -> this is used for targeting to output definitions from other extractors using settings (at this moment only Nuke bake extractor can target using custom tags). - - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewIntermediate/outputs/baking/add_custom_tags` + - Nuke extractor settings path: `project_settings/nuke/publish/ExtractReviewIntermediates/outputs/baking/add_custom_tags` - Filtering by input length. Input may be video, sequence or single image. It is possible that `.mp4` should be created only when input is video or sequence and to create review `.png` when input is single frame. In some cases the output should be created even if it's single frame or multi frame input. diff --git a/website/docs/pype2/admin_presets_plugins.md b/website/docs/pype2/admin_presets_plugins.md index a039c5fbd8..b5e8a3b8a8 100644 --- a/website/docs/pype2/admin_presets_plugins.md +++ b/website/docs/pype2/admin_presets_plugins.md @@ -534,7 +534,7 @@ Plugin responsible for generating thumbnails with colorspace controlled by Nuke. } ``` -### `ExtractReviewIntermediate` +### `ExtractReviewIntermediates` `viewer_lut_raw` **true** will publish the baked mov file without any colorspace conversion. It will be baked with the workfile workspace. This can happen in case the Viewer input process uses baked screen space luts. #### baking with controlled colorspace From f45552ff79fcc72b38825886584b4cecf9160a43 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 28 Sep 2023 20:29:09 +0800 Subject: [PATCH 24/25] label tweak --- .../hosts/nuke/plugins/publish/extract_review_intermediates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py index 2d996b1381..78fb37e8d7 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py @@ -16,7 +16,7 @@ class ExtractReviewIntermediates(publish.Extractor): """ order = pyblish.api.ExtractorOrder + 0.01 - label = "Extract Review Intermediate" + label = "Extract Review Intermediates" families = ["review"] hosts = ["nuke"] From f57c1eb8889fea3b29a85ef0e425c909236dcc7a Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 28 Sep 2023 23:32:39 +0800 Subject: [PATCH 25/25] edit docsting and rename BakingStreamModel as IntermediateOutputModel --- .../nuke/plugins/publish/extract_review_intermediates.py | 3 ++- server_addon/nuke/server/settings/publish_plugins.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py index 78fb37e8d7..da060e3157 100644 --- a/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py +++ b/openpype/hosts/nuke/plugins/publish/extract_review_intermediates.py @@ -9,7 +9,8 @@ from openpype.hosts.nuke.api.lib import maintained_selection class ExtractReviewIntermediates(publish.Extractor): - """Extracts Sequences and thumbnail with baked in luts + """Extracting intermediate videos or sequences with + thumbnail for transcoding. must be run after extract_render_local.py diff --git a/server_addon/nuke/server/settings/publish_plugins.py b/server_addon/nuke/server/settings/publish_plugins.py index efb814eff0..19206149b6 100644 --- a/server_addon/nuke/server/settings/publish_plugins.py +++ b/server_addon/nuke/server/settings/publish_plugins.py @@ -149,7 +149,7 @@ class ReformatNodesConfigModel(BaseSettingsModel): ) -class BakingStreamModel(BaseSettingsModel): +class IntermediateOutputModel(BaseSettingsModel): name: str = Field(title="Output name") filter: BakingStreamFilterModel = Field( title="Filter", default_factory=BakingStreamFilterModel) @@ -171,7 +171,7 @@ class ExtractReviewDataMovModel(BaseSettingsModel): """ enabled: bool = Field(title="Enabled") viewer_lut_raw: bool = Field(title="Viewer lut raw") - outputs: list[BakingStreamModel] = Field( + outputs: list[IntermediateOutputModel] = Field( default_factory=list, title="Baking streams" ) @@ -180,7 +180,7 @@ class ExtractReviewDataMovModel(BaseSettingsModel): class ExtractReviewIntermediatesModel(BaseSettingsModel): enabled: bool = Field(title="Enabled") viewer_lut_raw: bool = Field(title="Viewer lut raw") - outputs: list[BakingStreamModel] = Field( + outputs: list[IntermediateOutputModel] = Field( default_factory=list, title="Baking streams" )