From 1a46bdd21aba6c6abace627e739705e0344aeb2e Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 17 Mar 2021 14:43:44 +0100 Subject: [PATCH 1/2] feat(nuke): read node loaders with preset for node name --- pype/plugins/nuke/load/load_image.py | 17 +++++++++++++---- pype/plugins/nuke/load/load_mov.py | 17 +++++++++++++---- pype/plugins/nuke/load/load_sequence.py | 17 +++++++++++++---- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/pype/plugins/nuke/load/load_image.py b/pype/plugins/nuke/load/load_image.py index 71fa987bc60..e5f09925051 100644 --- a/pype/plugins/nuke/load/load_image.py +++ b/pype/plugins/nuke/load/load_image.py @@ -33,6 +33,9 @@ class LoadImage(api.Loader): ) ] + # presets + name_expression = "{class_name}_{ext}" + def load(self, context, name, namespace, options): from avalon.nuke import ( containerise, @@ -73,10 +76,16 @@ def load(self, context, name, namespace, options): frame, format(frame_number, "0{}".format(padding))) - read_name = "Read_{0}_{1}_{2}".format( - repr_cont["asset"], - repr_cont["subset"], - repr_cont["representation"]) + name_data = { + "asset": repr_cont["asset"], + "subset": repr_cont["subset"], + "representation": context["representation"]["name"], + "ext": repr_cont["representation"], + "id": context["representation"]["_id"], + "class_name": self.__class__.__name__ + } + + read_name = self.name_expression.format(**name_data) # Create the Loader with the filename path set with viewer_update_and_undo_stop(): diff --git a/pype/plugins/nuke/load/load_mov.py b/pype/plugins/nuke/load/load_mov.py index b87cdb994c1..68a92060d80 100644 --- a/pype/plugins/nuke/load/load_mov.py +++ b/pype/plugins/nuke/load/load_mov.py @@ -80,6 +80,9 @@ class LoadMov(api.Loader): icon = "code-fork" color = "orange" + # presets + name_expression = "{class_name}_{ext}" + def loader_shift(self, node, frame, relative=True): """Shift global in time by i preserving duration @@ -152,10 +155,16 @@ def load(self, context, name, namespace, data): file = file.replace("\\", "/") - read_name = "Read_{0}_{1}_{2}".format( - repr_cont["asset"], - repr_cont["subset"], - repr_cont["representation"]) + name_data = { + "asset": repr_cont["asset"], + "subset": repr_cont["subset"], + "representation": context["representation"]["name"], + "ext": repr_cont["representation"], + "id": context["representation"]["_id"], + "class_name": self.__class__.__name__ + } + + read_name = self.name_expression.format(**name_data) # Create the Loader with the filename path set with viewer_update_and_undo_stop(): diff --git a/pype/plugins/nuke/load/load_sequence.py b/pype/plugins/nuke/load/load_sequence.py index 4810db2cd98..1648dc8b630 100644 --- a/pype/plugins/nuke/load/load_sequence.py +++ b/pype/plugins/nuke/load/load_sequence.py @@ -80,6 +80,9 @@ class LoadSequence(api.Loader): icon = "file-video-o" color = "white" + # presets + name_expression = "{class_name}_{ext}" + @staticmethod def fix_hashes_in_path(file, repr_cont): if "#" not in file: @@ -137,10 +140,16 @@ def load(self, context, name, namespace, data): file = self.fix_hashes_in_path(file, repr_cont).replace("\\", "/") - read_name = "Read_{0}_{1}_{2}".format( - repr_cont["asset"], - repr_cont["subset"], - context["representation"]["name"]) + name_data = { + "asset": repr_cont["asset"], + "subset": repr_cont["subset"], + "representation": context["representation"]["name"], + "ext": repr_cont["representation"], + "id": context["representation"]["_id"], + "class_name": self.__class__.__name__ + } + + read_name = self.name_expression.format(**name_data) # Create the Loader with the filename path set with viewer_update_and_undo_stop(): From 1c170b0f0018442bf5003492068333e123989476 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Wed, 17 Mar 2021 14:44:20 +0100 Subject: [PATCH 2/2] feat(global): ading .vscode to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 101c1e62246..52e14b03ab7 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,5 @@ node_modules/ package-lock.json pype/premiere/ppro/js/debug.log + +/.vscode/ \ No newline at end of file