From 23e6e05d79722c61ade0e1c27ecf768a0ecb0288 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 18:41:32 +0200 Subject: [PATCH 01/15] removed unused collect project root plugin from nukestudio --- .../nukestudio/publish/collect_project_root.py | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 pype/plugins/nukestudio/publish/collect_project_root.py diff --git a/pype/plugins/nukestudio/publish/collect_project_root.py b/pype/plugins/nukestudio/publish/collect_project_root.py deleted file mode 100644 index 1b21a6b641..0000000000 --- a/pype/plugins/nukestudio/publish/collect_project_root.py +++ /dev/null @@ -1,15 +0,0 @@ -import pyblish.api -import avalon.api as avalon -import os - -class CollectActiveProjectRoot(pyblish.api.ContextPlugin): - """Inject the active project into context""" - - label = "Collect Project Root" - order = pyblish.api.CollectorOrder - 0.1 - - def process(self, context): - S = avalon.Session - context.data["projectroot"] = os.path.normpath( - os.path.join(S['AVALON_PROJECTS'], S['AVALON_PROJECT']) - ) From c2efa69e209148e97798d494b1264b0811e546a2 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 18:41:56 +0200 Subject: [PATCH 02/15] removed AVALON_PROJECTS from required in session schema --- schema/session-2.0.json | 1 - 1 file changed, 1 deletion(-) diff --git a/schema/session-2.0.json b/schema/session-2.0.json index 006a9e2dbf..d37f2ac822 100644 --- a/schema/session-2.0.json +++ b/schema/session-2.0.json @@ -9,7 +9,6 @@ "additionalProperties": true, "required": [ - "AVALON_PROJECTS", "AVALON_PROJECT", "AVALON_ASSET", "AVALON_CONFIG" From b44b8683a0d1f2fb5d3f99171b4b74b73f0136ce Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 18:42:43 +0200 Subject: [PATCH 03/15] skip AVALON PROJECTS in adaobe communicator context collector --- pype/plugins/adobecommunicator/publish/collect_context.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pype/plugins/adobecommunicator/publish/collect_context.py b/pype/plugins/adobecommunicator/publish/collect_context.py index 139dd86480..6d05825844 100644 --- a/pype/plugins/adobecommunicator/publish/collect_context.py +++ b/pype/plugins/adobecommunicator/publish/collect_context.py @@ -39,10 +39,8 @@ class CollectContextDataFromAport(pyblish.api.ContextPlugin): # get avalon session data and convert \ to / _S = avalon.session - projects = Path(_S["AVALON_PROJECTS"]).resolve() asset = _S["AVALON_ASSET"] workdir = Path(_S["AVALON_WORKDIR"]).resolve() - _S["AVALON_PROJECTS"] = str(projects) _S["AVALON_WORKDIR"] = str(workdir) context.data["avalonSession"] = _S From a9fc6614a97eb7961374310ad80e9d24022aae0d Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 18:43:00 +0200 Subject: [PATCH 04/15] changed docstring with mentioned AVAON_PROJECTS --- pype/ftrack/actions/action_delivery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/ftrack/actions/action_delivery.py b/pype/ftrack/actions/action_delivery.py index 9d686929de..23da81d383 100644 --- a/pype/ftrack/actions/action_delivery.py +++ b/pype/ftrack/actions/action_delivery.py @@ -340,7 +340,7 @@ class Delivery(BaseAction): repre_path = self.path_from_represenation(repre, anatomy) # TODO add backup solution where root of path from component - # is repalced with AVALON_PROJECTS root + # is repalced with root if not frame: self.process_single_file( repre_path, anatomy, anatomy_name, anatomy_data From 8402e616a170122583103ac7922c523443780e47 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 18:43:37 +0200 Subject: [PATCH 05/15] delete old version does not do root validation --- .../actions/action_delete_old_versions.py | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/pype/ftrack/actions/action_delete_old_versions.py b/pype/ftrack/actions/action_delete_old_versions.py index c13845f58c..30f786e93f 100644 --- a/pype/ftrack/actions/action_delete_old_versions.py +++ b/pype/ftrack/actions/action_delete_old_versions.py @@ -42,36 +42,8 @@ class DeleteOldVersions(BaseAction): return False def interface(self, session, entities, event): + # TODO Add roots existence validation items = [] - root = os.environ.get("AVALON_PROJECTS") - if not root: - msg = "Root path to projects is not set." - items.append({ - "type": "label", - "value": "ERROR: {}".format(msg) - }) - self.show_interface( - items=items, title=self.inteface_title, event=event - ) - return { - "success": False, - "message": msg - } - - if not os.path.exists(root): - msg = "Root path does not exists \"{}\".".format(str(root)) - items.append({ - "type": "label", - "value": "ERROR: {}".format(msg) - }) - self.show_interface( - items=items, title=self.inteface_title, event=event - ) - return { - "success": False, - "message": msg - } - values = event["data"].get("values") if values: versions_count = int(values["last_versions_count"]) From b778163c86fb8196e1365508d245a8d227af7362 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 19:02:16 +0200 Subject: [PATCH 06/15] set root environments during install of pype --- pype/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pype/__init__.py b/pype/__init__.py index 505db4c57f..775b75e2b0 100644 --- a/pype/__init__.py +++ b/pype/__init__.py @@ -3,7 +3,7 @@ import os from pyblish import api as pyblish from avalon import api as avalon from .lib import filter_pyblish_plugins -from pypeapp import config, Roots +from pypeapp import config, Roots, Anatomy import logging @@ -100,8 +100,9 @@ def install(): avalon.register_plugin_path(avalon.InventoryAction, path) if project_name: - root_obj = Roots(project_name) - avalon.register_root(root_obj.roots) + anatomy = Anatomy(project_name) + anatomy.set_root_environments() + avalon.register_root(anatomy.roots) # apply monkey patched discover to original one avalon.discover = patched_discover From 5fff3e7bdc17b6b38e0593c35f0db181b6ecfcce Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 19:21:19 +0200 Subject: [PATCH 07/15] temporarily disable avalon-launcher --- pype/avalon_apps/avalon_app.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pype/avalon_apps/avalon_app.py b/pype/avalon_apps/avalon_app.py index 35ab4c1eb7..30e7a7412b 100644 --- a/pype/avalon_apps/avalon_app.py +++ b/pype/avalon_apps/avalon_app.py @@ -33,23 +33,23 @@ class AvalonApps: return icon = QtGui.QIcon(launcher_lib.resource("icon", "main.png")) - aShowLauncher = QtWidgets.QAction(icon, "&Launcher", parent_menu) + # aShowLauncher = QtWidgets.QAction(icon, "&Launcher", parent_menu) aLibraryLoader = QtWidgets.QAction("Library", parent_menu) - aShowLauncher.triggered.connect(self.show_launcher) + # aShowLauncher.triggered.connect(self.show_launcher) aLibraryLoader.triggered.connect(self.show_library_loader) - parent_menu.addAction(aShowLauncher) + # parent_menu.addAction(aShowLauncher) parent_menu.addAction(aLibraryLoader) - def show_launcher(self): - # if app_launcher don't exist create it/otherwise only show main window - if self.app_launcher is None: - root = os.path.realpath(os.environ["AVALON_PROJECTS"]) - io.install() - APP_PATH = launcher_lib.resource("qml", "main.qml") - self.app_launcher = launcher_widget.Launcher(root, APP_PATH) - self.app_launcher.window.show() + # def show_launcher(self): + # # if app_launcher don't exist create it/otherwise only show main window + # if self.app_launcher is None: + # root = os.path.realpath(os.environ["AVALON_PROJECTS"]) + # io.install() + # APP_PATH = launcher_lib.resource("qml", "main.qml") + # self.app_launcher = launcher_widget.Launcher(root, APP_PATH) + # self.app_launcher.window.show() def show_library_loader(self): libraryloader.show( From 22fff1f0bbcc859361ad254c7771db62cad68585 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 19:41:14 +0200 Subject: [PATCH 08/15] fixed nuke and nukestudio AVALON_PROJECTS --- pype/nuke/lib.py | 4 +++- pype/nukestudio/lib.py | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/pype/nuke/lib.py b/pype/nuke/lib.py index 163fcd27b7..bd39666ab9 100644 --- a/pype/nuke/lib.py +++ b/pype/nuke/lib.py @@ -973,7 +973,9 @@ class WorkfileSettings(object): self.set_colorspace() def set_favorites(self): - projects_root = os.getenv("AVALON_PROJECTS") + anatomy = get_anatomy() + work_template = anatomy.templates["work"]["path"] + projects_root = anatomy.root_value_for_template(work_template) work_dir = os.getenv("AVALON_WORKDIR") asset = os.getenv("AVALON_ASSET") project = os.getenv("AVALON_PROJECT") diff --git a/pype/nukestudio/lib.py b/pype/nukestudio/lib.py index 774a9d45bf..e0e6d8750c 100644 --- a/pype/nukestudio/lib.py +++ b/pype/nukestudio/lib.py @@ -6,7 +6,7 @@ import pyblish.api import avalon.api as avalon from avalon.vendor.Qt import (QtWidgets, QtGui) import pype.api as pype -from pypeapp import Logger +from pypeapp import Logger, Anatomy log = Logger().get_logger(__name__, "nukestudio") @@ -30,11 +30,16 @@ def set_workfiles(): # show workfile gui workfiles.show(workdir) + def sync_avalon_data_to_workfile(): # import session to get project dir - S = avalon.Session + project_name = avalon.Session["AVALON_PROJECT"] + + anatomy = Anatomy(project_name) + work_template = anatomy.templates["work"]["path"] + work_root = anatomy.root_value_for_template(work_template) active_project_root = os.path.normpath( - os.path.join(S['AVALON_PROJECTS'], S['AVALON_PROJECT']) + os.path.join(work_root, project_name) ) # getting project project = hiero.core.projects()[-1] @@ -350,17 +355,19 @@ def CreateNukeWorkfile(nodes=None, # create root node and save all metadata root_node = hiero.core.nuke.RootNode() - root_path = os.environ["AVALON_PROJECTS"] + anatomy = Anatomy(os.environ["AVALON_PROJECT"]) + work_template = anatomy.templates["work"]["path"] + root_path = anatomy.root_value_for_template(work_template) nuke_script.addNode(root_node) # here to call pype.nuke.lib.BuildWorkfile script_builder = nklib.BuildWorkfile( - root_node=root_node, - root_path=root_path, - nodes=nuke_script.getNodes(), - **kwargs - ) + root_node=root_node, + root_path=root_path, + nodes=nuke_script.getNodes(), + **kwargs + ) class ClipLoader: From b6929fc41be8f6fc62f7f117eafe648c0cd90833 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 19:47:55 +0200 Subject: [PATCH 09/15] using find_root_template_from_path method directly on anatomy object --- pype/plugins/global/publish/integrate_new.py | 2 +- pype/plugins/global/publish/submit_publish_job.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index f7ea4eebf9..fc785f6065 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -651,7 +651,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): source = context.data["currentFile"] anatomy = instance.context.data["anatomy"] success, rootless_path = ( - anatomy.roots_obj.find_root_template_from_path(source) + anatomy.find_root_template_from_path(source) ) if success: source = rootless_path diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 9741a7135a..eb8264dc23 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -195,7 +195,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): output_dir = instance.data["outputDir"] # Convert output dir to `{root}/rest/of/path/...` with Anatomy success, rootless_path = ( - self.anatomy.roots_obj.find_root_template_from_path(output_dir) + self.anatomy.find_root_template_from_path(output_dir) ) if not success: # `rootless_path` is not set to `output_dir` if none of roots match @@ -379,7 +379,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): staging = os.path.dirname(list(cols[0])[0]) success, rootless_staging_dir = ( - self.anatomy.roots_obj.find_root_template_from_path(staging) + self.anatomy.find_root_template_from_path(staging) ) if success: staging = rootless_staging_dir @@ -471,7 +471,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): staging = os.path.dirname(list(collection)[0]) success, rootless_staging_dir = ( - self.anatomy.roots_obj.find_root_template_from_path(staging) + self.anatomy.find_root_template_from_path(staging) ) if success: staging = rootless_staging_dir @@ -506,7 +506,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): staging = os.path.dirname(remainder) success, rootless_staging_dir = ( - self.anatomy.roots_obj.find_root_template_from_path(staging) + self.anatomy.find_root_template_from_path(staging) ) if success: staging = rootless_staging_dir @@ -619,7 +619,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): source = context.data["currentFile"] success, rootless_path = ( - self.anatomy.roots_obj.find_root_template_from_path(source) + self.anatomy.find_root_template_from_path(source) ) if success: source = rootless_path @@ -684,7 +684,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): staging_dir = repre.get("stagingDir") if staging_dir: success, rootless_staging_dir = ( - self.anatomy.roots_obj.find_root_template_from_path( + self.anatomy.find_root_template_from_path( staging_dir ) ) From 8f1ffbffcd93a4f9a5ba3a7117b07242f00e0b0a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 19:48:18 +0200 Subject: [PATCH 10/15] tried to fix validate ass relative paths --- .../publish/validate_ass_relative_paths.py | 90 +++++++++++++------ 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/pype/plugins/maya/publish/validate_ass_relative_paths.py b/pype/plugins/maya/publish/validate_ass_relative_paths.py index b0fd12a550..0373f1bbdf 100644 --- a/pype/plugins/maya/publish/validate_ass_relative_paths.py +++ b/pype/plugins/maya/publish/validate_ass_relative_paths.py @@ -37,50 +37,86 @@ class ValidateAssRelativePaths(pyblish.api.InstancePlugin): scene_dir, scene_basename = os.path.split(cmds.file(q=True, loc=True)) scene_name, _ = os.path.splitext(scene_basename) - project_root = "{}{}{}".format( - os.environ.get("AVALON_PROJECTS"), - os.path.sep, - os.environ.get("AVALON_PROJECT") - ) assert self.maya_is_true(relative_texture) is not True, \ ("Texture path is set to be absolute") assert self.maya_is_true(relative_procedural) is not True, \ ("Procedural path is set to be absolute") + anatomy = instance.context.data["anatomy"] + texture_search_path = texture_search_path.replace("\\", "/") procedural_search_path = procedural_search_path.replace("\\", "/") - project_root = project_root.replace("\\", "/") - assert project_root in texture_search_path, \ + texture_success, texture_search_rootless_path = ( + anatomy.find_root_template_from_path( + texture_search_path + ) + ) + procedural_success, procedural_search_rootless_path = ( + anatomy.find_root_template_from_path( + texture_search_path + ) + ) + + assert not texture_success, \ ("Project root is not in texture_search_path") - assert project_root in procedural_search_path, \ + assert not procedural_success, \ ("Project root is not in procedural_search_path") @classmethod def repair(cls, instance): - texture_search_path = cmds.getAttr( - "defaultArnoldRenderOptions.tspath" + texture_path = cmds.getAttr("defaultArnoldRenderOptions.tspath") + procedural_path = cmds.getAttr("defaultArnoldRenderOptions.pspath") + + anatomy = instance.context.data["anatomy"] + texture_success, texture_rootless_path = ( + anatomy.find_root_template_from_path(texture_path) ) - procedural_search_path = cmds.getAttr( - "defaultArnoldRenderOptions.pspath" + procedural_success, procedural_rootless_path = ( + anatomy.find_root_template_from_path(procedural_path) ) - project_root = "{}{}{}".format( - os.environ.get("AVALON_PROJECTS"), - os.path.sep, - os.environ.get("AVALON_PROJECT"), - ).replace("\\", "/") + all_root_paths = anatomy.all_root_paths() - cmds.setAttr("defaultArnoldRenderOptions.tspath", - project_root + os.pathsep + texture_search_path, - type="string") - cmds.setAttr("defaultArnoldRenderOptions.pspath", - project_root + os.pathsep + procedural_search_path, - type="string") - cmds.setAttr("defaultArnoldRenderOptions.absolute_procedural_paths", - False) - cmds.setAttr("defaultArnoldRenderOptions.absolute_texture_paths", - False) + if not texture_success: + final_path = cls.find_absolute_path( + texture_rootless_path, all_root_paths + ) + if final_path is None: + raise AssertionError("Ass is loaded out of defined roots.") + + cmds.setAttr( + "defaultArnoldRenderOptions.tspath", + final_path, + type="string" + ) + cmds.setAttr( + "defaultArnoldRenderOptions.absolute_texture_paths", + False + ) + + if not procedural_success: + final_path = cls.find_absolute_path( + texture_rootless_path, all_root_paths + ) + if final_path is None: + raise AssertionError("Ass is loaded out of defined roots.") + cmds.setAttr( + "defaultArnoldRenderOptions.pspath", + final_path, + type="string" + ) + cmds.setAttr( + "defaultArnoldRenderOptions.absolute_procedural_paths", + False + ) + + @staticmethod + def find_absolute_path(relative_path, all_root_paths): + for root_path in all_root_paths: + possible_path = os.path.join(root_path, relative_path) + if os.path.exists(possible_path): + return possible_path def maya_is_true(self, attr_val): """ From a1d35fb5bdf5485950aa6bef43665ad78ce343ed Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 13 May 2020 23:27:49 +0200 Subject: [PATCH 11/15] avalon-launcher can be launched again but without setting root --- pype/avalon_apps/avalon_app.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/pype/avalon_apps/avalon_app.py b/pype/avalon_apps/avalon_app.py index 30e7a7412b..d3190a9d53 100644 --- a/pype/avalon_apps/avalon_app.py +++ b/pype/avalon_apps/avalon_app.py @@ -33,23 +33,22 @@ class AvalonApps: return icon = QtGui.QIcon(launcher_lib.resource("icon", "main.png")) - # aShowLauncher = QtWidgets.QAction(icon, "&Launcher", parent_menu) + aShowLauncher = QtWidgets.QAction(icon, "&Launcher", parent_menu) aLibraryLoader = QtWidgets.QAction("Library", parent_menu) - # aShowLauncher.triggered.connect(self.show_launcher) + aShowLauncher.triggered.connect(self.show_launcher) aLibraryLoader.triggered.connect(self.show_library_loader) - # parent_menu.addAction(aShowLauncher) + parent_menu.addAction(aShowLauncher) parent_menu.addAction(aLibraryLoader) - # def show_launcher(self): - # # if app_launcher don't exist create it/otherwise only show main window - # if self.app_launcher is None: - # root = os.path.realpath(os.environ["AVALON_PROJECTS"]) - # io.install() - # APP_PATH = launcher_lib.resource("qml", "main.qml") - # self.app_launcher = launcher_widget.Launcher(root, APP_PATH) - # self.app_launcher.window.show() + def show_launcher(self): + # if app_launcher don't exist create it/otherwise only show main window + if self.app_launcher is None: + io.install() + APP_PATH = launcher_lib.resource("qml", "main.qml") + self.app_launcher = launcher_widget.Launcher(APP_PATH) + self.app_launcher.window.show() def show_library_loader(self): libraryloader.show( From 0d311d63c822e721337a63a147617874981017af Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 14 May 2020 10:15:28 +0200 Subject: [PATCH 12/15] removed unsused import --- pype/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/__init__.py b/pype/__init__.py index 775b75e2b0..9ca0380bf3 100644 --- a/pype/__init__.py +++ b/pype/__init__.py @@ -3,7 +3,7 @@ import os from pyblish import api as pyblish from avalon import api as avalon from .lib import filter_pyblish_plugins -from pypeapp import config, Roots, Anatomy +from pypeapp import config, Anatomy import logging From f30f0099fd65416ffcf4d282d6accbd4e885e9c9 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 14 May 2020 10:59:40 +0200 Subject: [PATCH 13/15] for padding is used frame_padding from anatomy templates but kept backwards compatible "frame" --- pype/nuke/lib.py | 9 ++++++++- pype/plugins/global/publish/integrate_master_version.py | 7 +++++-- pype/plugins/global/publish/integrate_new.py | 7 +++++-- pype/plugins/nukestudio/publish/collect_plates.py | 7 ++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pype/nuke/lib.py b/pype/nuke/lib.py index bd39666ab9..a706753755 100644 --- a/pype/nuke/lib.py +++ b/pype/nuke/lib.py @@ -177,9 +177,16 @@ def format_anatomy(data): log.debug("__ anatomy.templates: {}".format(anatomy.templates)) try: - padding = int(anatomy.templates['render']['padding']) + # TODO: bck compatibility with old anatomy template + padding = int( + anatomy.templates["render"].get( + "frame_padding", + anatomy.templates["render"].get("padding") + ) + ) except KeyError as e: msg = ("`padding` key is not in `render` " + "or `frame_padding` on is not available in " "Anatomy template. Please, add it there and restart " "the pipeline (padding: \"4\"): `{}`").format(e) diff --git a/pype/plugins/global/publish/integrate_master_version.py b/pype/plugins/global/publish/integrate_master_version.py index e6e4247dd8..d82c3be075 100644 --- a/pype/plugins/global/publish/integrate_master_version.py +++ b/pype/plugins/global/publish/integrate_master_version.py @@ -356,8 +356,11 @@ class IntegrateMasterVersion(pyblish.api.InstancePlugin): _anatomy_filled = anatomy.format(anatomy_data) _template_filled = _anatomy_filled["master"]["path"] head, tail = _template_filled.split(frame_splitter) - padding = ( - anatomy.templates["render"]["padding"] + padding = int( + anatomy.templates["render"].get( + "frame_padding", + anatomy.templates["render"].get("padding") + ) ) dst_col = clique.Collection( diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index fc785f6065..08c390d040 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -341,8 +341,11 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): index_frame_start = None if repre.get("frameStart"): - frame_start_padding = ( - anatomy.templates["render"]["padding"] + frame_start_padding = int( + anatomy.templates["render"].get( + "frame_padding", + anatomy.templates["render"].get("padding") + ) ) index_frame_start = int(repre.get("frameStart")) diff --git a/pype/plugins/nukestudio/publish/collect_plates.py b/pype/plugins/nukestudio/publish/collect_plates.py index 8a79354bbf..3e5ba51b60 100644 --- a/pype/plugins/nukestudio/publish/collect_plates.py +++ b/pype/plugins/nukestudio/publish/collect_plates.py @@ -104,7 +104,12 @@ class CollectPlatesData(api.InstancePlugin): version_data = dict() context = instance.context anatomy = context.data.get("anatomy", None) - padding = int(anatomy.templates['render']['padding']) + padding = int( + anatomy.templates["render"].get( + "frame_padding", + anatomy.templates["render"].get("padding") + ) + ) name = instance.data["subset"] source_path = instance.data["sourcePath"] From 2c854faadf7142cb6e5f689d601f9f0335e40fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Thu, 14 May 2020 12:05:43 +0200 Subject: [PATCH 14/15] fixed ass path validator --- .../publish/validate_ass_relative_paths.py | 91 ++++++++----------- 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/pype/plugins/maya/publish/validate_ass_relative_paths.py b/pype/plugins/maya/publish/validate_ass_relative_paths.py index 0373f1bbdf..b64e23e92c 100644 --- a/pype/plugins/maya/publish/validate_ass_relative_paths.py +++ b/pype/plugins/maya/publish/validate_ass_relative_paths.py @@ -44,72 +44,57 @@ class ValidateAssRelativePaths(pyblish.api.InstancePlugin): anatomy = instance.context.data["anatomy"] - texture_search_path = texture_search_path.replace("\\", "/") - procedural_search_path = procedural_search_path.replace("\\", "/") + # Use project root variables for multiplatform support, see: + # https://docs.arnoldrenderer.com/display/A5AFMUG/Search+Path + # ':' as path separator is supported by Arnold for all platforms. + keys = anatomy.root_environments().keys() + paths = [] + for k in keys: + paths.append("[{}]".format(k)) - texture_success, texture_search_rootless_path = ( - anatomy.find_root_template_from_path( - texture_search_path - ) - ) - procedural_success, procedural_search_rootless_path = ( - anatomy.find_root_template_from_path( - texture_search_path - ) + self.log.info("discovered roots: {}".format(":".join(paths))) + + assert ":".join(paths) in texture_search_path, ( + "Project roots are not in texture_search_path" ) - assert not texture_success, \ - ("Project root is not in texture_search_path") - assert not procedural_success, \ - ("Project root is not in procedural_search_path") + assert ":".join(paths) in procedural_search_path, ( + "Project roots are not in procedural_search_path" + ) @classmethod def repair(cls, instance): texture_path = cmds.getAttr("defaultArnoldRenderOptions.tspath") procedural_path = cmds.getAttr("defaultArnoldRenderOptions.pspath") + # Use project root variables for multiplatform support, see: + # https://docs.arnoldrenderer.com/display/A5AFMUG/Search+Path + # ':' as path separator is supported by Arnold for all platforms. anatomy = instance.context.data["anatomy"] - texture_success, texture_rootless_path = ( - anatomy.find_root_template_from_path(texture_path) + keys = anatomy.root_environments().keys() + paths = [] + for k in keys: + paths.append("[{}]".format(k)) + + cmds.setAttr( + "defaultArnoldRenderOptions.tspath", + ":".join([p for p in paths + [texture_path] if p]), + type="string" ) - procedural_success, procedural_rootless_path = ( - anatomy.find_root_template_from_path(procedural_path) + cmds.setAttr( + "defaultArnoldRenderOptions.absolute_texture_paths", + False ) - all_root_paths = anatomy.all_root_paths() - - if not texture_success: - final_path = cls.find_absolute_path( - texture_rootless_path, all_root_paths - ) - if final_path is None: - raise AssertionError("Ass is loaded out of defined roots.") - - cmds.setAttr( - "defaultArnoldRenderOptions.tspath", - final_path, - type="string" - ) - cmds.setAttr( - "defaultArnoldRenderOptions.absolute_texture_paths", - False - ) - - if not procedural_success: - final_path = cls.find_absolute_path( - texture_rootless_path, all_root_paths - ) - if final_path is None: - raise AssertionError("Ass is loaded out of defined roots.") - cmds.setAttr( - "defaultArnoldRenderOptions.pspath", - final_path, - type="string" - ) - cmds.setAttr( - "defaultArnoldRenderOptions.absolute_procedural_paths", - False - ) + cmds.setAttr( + "defaultArnoldRenderOptions.pspath", + ":".join([p for p in paths + [procedural_path] if p]), + type="string" + ) + cmds.setAttr( + "defaultArnoldRenderOptions.absolute_procedural_paths", + False + ) @staticmethod def find_absolute_path(relative_path, all_root_paths): From c34664a370e6a4f6f1cc12daf8ade1a60fa3e98c Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 14 May 2020 15:45:19 +0200 Subject: [PATCH 15/15] replace backslashes with forwardslashed in nukestudio --- pype/nukestudio/lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/nukestudio/lib.py b/pype/nukestudio/lib.py index e0e6d8750c..3a8e35f100 100644 --- a/pype/nukestudio/lib.py +++ b/pype/nukestudio/lib.py @@ -38,9 +38,9 @@ def sync_avalon_data_to_workfile(): anatomy = Anatomy(project_name) work_template = anatomy.templates["work"]["path"] work_root = anatomy.root_value_for_template(work_template) - active_project_root = os.path.normpath( + active_project_root = ( os.path.join(work_root, project_name) - ) + ).replace("\\", "/") # getting project project = hiero.core.projects()[-1]