From 94d16aa98c16a296705deec01ec1a76a0317f6d3 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 26 Jul 2024 20:20:33 +0800 Subject: [PATCH] move update_write_node_filepath after try exception --- client/ayon_nuke/api/plugin.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/ayon_nuke/api/plugin.py b/client/ayon_nuke/api/plugin.py index d4ddd91..689bb10 100644 --- a/client/ayon_nuke/api/plugin.py +++ b/client/ayon_nuke/api/plugin.py @@ -315,7 +315,11 @@ def update_instances(self, update_list): for created_inst, changes in update_list: instance_node = created_inst.transient_data["node"] - update_write_node_filepath(created_inst, changes) + # update instance node name if product name changed + if "productName" in changes.changed_keys: + instance_node["name"].setValue( + changes["productName"].new_value + ) # in case node is not existing anymore (user erased it manually) try: instance_node.fullName() @@ -323,6 +327,8 @@ def update_instances(self, update_list): self.remove_instances([created_inst]) continue + update_write_node_filepath(created_inst, changes) + set_node_data( instance_node, INSTANCE_DATA_KNOB, @@ -1249,7 +1255,7 @@ def exposed_write_knobs(settings, plugin_name, instance_node): def update_write_node_filepath(created_inst, changes): """Update instance node on context changes. - + Whenever any of productName, folderPath, task or productType changes then update: - output filepath of the write node @@ -1278,5 +1284,4 @@ def update_write_node_filepath(created_inst, changes): formatting_data["work"] = fdir fpath = StringTemplate(formatting_data["fpath_template"]).format_strict( formatting_data) - write_node["file"].setValue(fpath) - instance_node["name"].setValue(formatting_data["productName"]) + write_node["file"].setValue(fpath) \ No newline at end of file