From b1391e263ea59ef1bb9bd630861190f0ce5c99ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Je=C5=BEek?= Date: Mon, 20 Apr 2026 16:41:14 +0200 Subject: [PATCH 1/2] IMPORT StringTemplate AND Anatomy IN load_effects.py Add new imports for StringTemplate and Anatomy to enhance file path processing in LoadEffects class. --- client/ayon_nuke/plugins/load/load_effects.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/client/ayon_nuke/plugins/load/load_effects.py b/client/ayon_nuke/plugins/load/load_effects.py index 994281c1d5..b92876ad21 100644 --- a/client/ayon_nuke/plugins/load/load_effects.py +++ b/client/ayon_nuke/plugins/load/load_effects.py @@ -1,7 +1,8 @@ import json import nuke - +from ayon_core.lib import StringTemplate +from ayon_core.pipeline import Anatomy, get_current_project_name from ayon_nuke.api import plugin @@ -103,6 +104,26 @@ def _create_nodes_order(self, nodes_order: dict): self.log.warning(e) continue + # check if `file` in knob name + print(f"{k}: {v}") + if k == "file": + file_path = v + project_name = get_current_project_name() + anatomy = Anatomy(project_name=project_name) + _template_data = { + "root": anatomy.roots, + } + success, rootless_path = \ + anatomy.find_root_template_from_path(file_path) + + self.log.info(f"rootless_path: {rootless_path}") + if success: + abs_resources_path = StringTemplate.format_strict_template( + rootless_path, _template_data + ) + v = abs_resources_path + self.log.info(f"File path: {abs_resources_path}") + # Set node attribute values if isinstance(v, list) and len(v) > 4: node[k].setAnimated() From 56d0c985642e40fe8364d1d65a4e30c68acfef75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Je=C5=BEek?= Date: Tue, 21 Apr 2026 08:56:55 +0200 Subject: [PATCH 2/2] improve comment --- client/ayon_nuke/plugins/load/load_effects.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/client/ayon_nuke/plugins/load/load_effects.py b/client/ayon_nuke/plugins/load/load_effects.py index b92876ad21..8089a236e2 100644 --- a/client/ayon_nuke/plugins/load/load_effects.py +++ b/client/ayon_nuke/plugins/load/load_effects.py @@ -29,8 +29,7 @@ def on_update(self, group_node, namespace, context): return group_node def connect_read_node(self, group_node, namespace, product_name): - """ - Finds read node and selects it + """Finds read node and selects it Arguments: group_node (nuke.Node): Group node to connect to. @@ -41,7 +40,7 @@ def connect_read_node(self, group_node, namespace, product_name): nuke node: node is selected None: if nothing found """ - search_name = "{0}_{1}".format(namespace, product_name) + search_name = f"{namespace}_{product_name}" read_node = next( ( @@ -66,9 +65,8 @@ def connect_read_node(self, group_node, namespace, product_name): def _load_effects_to_group( self, context: dict, group_node: nuke.Node) -> str: """Load the json file and create nodes inside the group node""" - file = self.filepath_from_context(context).replace("\\", "/") - with open(file, "r") as f: + with open(file) as f: json_f = json.load(f) # get correct order of nodes by positions on track and subtrack @@ -86,7 +84,6 @@ def _load_effects_to_group( def _create_nodes_order(self, nodes_order: dict): workfile_first_frame = int(nuke.root()["first_frame"].getValue()) - # create input node pre_node = nuke.createNode("Input") pre_node["name"].setValue("rgb") @@ -104,8 +101,8 @@ def _create_nodes_order(self, nodes_order: dict): self.log.warning(e) continue - # check if `file` in knob name - print(f"{k}: {v}") + # check if `file` in knob name then format the path + # so it is multiplatform compatible if k == "file": file_path = v project_name = get_current_project_name() @@ -172,7 +169,6 @@ def _get_item( if track_index == val["trackIndex"]} - class LoadEffectsInputProcess(LoadEffects): """Loading colorspace soft effect exported from nukestudio""" @@ -190,4 +186,4 @@ def on_load(self, group_node, namespace, context): def on_update(self, group_node, namespace, context): # No post-process on update # Only overridden to avoid behavior of LoadEffects - return group_node \ No newline at end of file + return group_node