From 372c6d89c37e1d67aea8caab69667d55e5b6f34d Mon Sep 17 00:00:00 2001 From: 2-REC Date: Fri, 4 Nov 2022 15:26:33 +0700 Subject: [PATCH 1/5] Setting from other plugin --- .../publish/validate_texture_workfiles.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py b/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py index 56ea82f6b6..a25b80438d 100644 --- a/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py +++ b/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py @@ -1,5 +1,7 @@ +import os import pyblish.api +from openpype.settings import get_project_settings from openpype.pipeline.publish import ( ValidateContentsOrder, PublishXmlValidationError, @@ -18,23 +20,40 @@ class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin): families = ["texture_batch_workfile"] optional = True + #TODO(2-rec): remove/change comment # from presets main_workfile_extensions = ['mra'] def process(self, instance): if instance.data["family"] == "workfile": ext = instance.data["representations"][0]["ext"] - if ext not in self.main_workfile_extensions: + main_workfile_extensions = self.get_main_workfile_extensions() + if ext not in main_workfile_extensions: self.log.warning("Only secondary workfile present!") return if not instance.data.get("resources"): msg = "No secondary workfile present for workfile '{}'". \ format(instance.data["name"]) - ext = self.main_workfile_extensions[0] + ext = main_workfile_extensions[0] formatting_data = {"file_name": instance.data["name"], "extension": ext} raise PublishXmlValidationError(self, msg, formatting_data=formatting_data ) + + @classmethod + def get_main_workfile_extensions(cls): + project_settings = get_project_settings(os.environ["AVALON_PROJECT"]) + + #TODO: find better way? (depends on other plugin) + try: + extensions = (project_settings["standalonepublisher"] + ["publish"] + ["CollectTextures"] + ["main_workfile_extensions"]) + except KeyError: + extensions = cls.main_workfile_extensions + + return extensions From 1719e33b00807c336fdf6367460b9fb386a91930 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 2 Dec 2022 17:20:32 +0100 Subject: [PATCH 2/5] flame: create vertically aligned subsets fix --- openpype/hosts/flame/api/plugin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/flame/api/plugin.py b/openpype/hosts/flame/api/plugin.py index 26129ebaa6..7e012330cf 100644 --- a/openpype/hosts/flame/api/plugin.py +++ b/openpype/hosts/flame/api/plugin.py @@ -596,18 +596,19 @@ class PublishableClip: if not hero_track and self.vertical_sync: # driving layer is set as negative match for (_in, _out), hero_data in self.vertical_clip_match.items(): - hero_data.update({"heroTrack": False}) - if _in == self.clip_in and _out == self.clip_out: + _hero_data = deepcopy(hero_data) + _hero_data.update({"heroTrack": False}) + if _in <= self.clip_in and _out >= self.clip_out: data_subset = hero_data["subset"] # add track index in case duplicity of names in hero data if self.subset in data_subset: - hero_data["subset"] = self.subset + str( + _hero_data["subset"] = self.subset + str( self.track_index) # in case track name and subset name is the same then add if self.subset_name == self.track_name: - hero_data["subset"] = self.subset + _hero_data["subset"] = self.subset # assing data to return hierarchy data to tag - tag_hierarchy_data = hero_data + tag_hierarchy_data = _hero_data # add data to return data dict self.marker_data.update(tag_hierarchy_data) From ee921e0bd4f384a3a94707d706f251e4aa997927 Mon Sep 17 00:00:00 2001 From: Derek Severin Date: Sat, 3 Dec 2022 17:04:02 +0700 Subject: [PATCH 3/5] Removed class variable and TODOs --- .../plugins/publish/validate_texture_workfiles.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py b/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py index a25b80438d..a7ae02a2eb 100644 --- a/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py +++ b/openpype/hosts/standalonepublisher/plugins/publish/validate_texture_workfiles.py @@ -20,10 +20,6 @@ class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin): families = ["texture_batch_workfile"] optional = True - #TODO(2-rec): remove/change comment - # from presets - main_workfile_extensions = ['mra'] - def process(self, instance): if instance.data["family"] == "workfile": ext = instance.data["representations"][0]["ext"] @@ -43,17 +39,19 @@ class ValidateTextureBatchWorkfiles(pyblish.api.InstancePlugin): formatting_data=formatting_data ) - @classmethod - def get_main_workfile_extensions(cls): + @staticmethod + def get_main_workfile_extensions(): project_settings = get_project_settings(os.environ["AVALON_PROJECT"]) - #TODO: find better way? (depends on other plugin) try: extensions = (project_settings["standalonepublisher"] ["publish"] ["CollectTextures"] ["main_workfile_extensions"]) except KeyError: - extensions = cls.main_workfile_extensions + raise Exception("Setting 'Main workfile extensions' not found." + " The setting must be set for the" + " 'Collect Texture' publish plugin of the" + " 'Standalone Publish' tool.") return extensions From c0b05e5846eecf7788d7ec3866023c83e4dded70 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 5 Dec 2022 10:50:58 +0100 Subject: [PATCH 4/5] add break and better explanation of procedure --- openpype/hosts/flame/api/plugin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openpype/hosts/flame/api/plugin.py b/openpype/hosts/flame/api/plugin.py index 7e012330cf..0d45792a38 100644 --- a/openpype/hosts/flame/api/plugin.py +++ b/openpype/hosts/flame/api/plugin.py @@ -596,6 +596,14 @@ class PublishableClip: if not hero_track and self.vertical_sync: # driving layer is set as negative match for (_in, _out), hero_data in self.vertical_clip_match.items(): + """ + Since only one instance of hero clip is expected in + `self.vertical_clip_match`, this will loop only once + until none hero clip will be matched with hero clip. + + `tag_hierarchy_data` will be used only once for every + clip which is not hero clip. + """ _hero_data = deepcopy(hero_data) _hero_data.update({"heroTrack": False}) if _in <= self.clip_in and _out >= self.clip_out: @@ -609,6 +617,7 @@ class PublishableClip: _hero_data["subset"] = self.subset # assing data to return hierarchy data to tag tag_hierarchy_data = _hero_data + break # add data to return data dict self.marker_data.update(tag_hierarchy_data) From ca1d518dd0dd026124b8879fdb446b34a170cc05 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Mon, 5 Dec 2022 10:53:03 +0100 Subject: [PATCH 5/5] comment improvement --- openpype/hosts/flame/api/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/flame/api/plugin.py b/openpype/hosts/flame/api/plugin.py index 0d45792a38..ca113fd98a 100644 --- a/openpype/hosts/flame/api/plugin.py +++ b/openpype/hosts/flame/api/plugin.py @@ -601,7 +601,7 @@ class PublishableClip: `self.vertical_clip_match`, this will loop only once until none hero clip will be matched with hero clip. - `tag_hierarchy_data` will be used only once for every + `tag_hierarchy_data` will be set only once for every clip which is not hero clip. """ _hero_data = deepcopy(hero_data)