Skip to content

Commit

Permalink
move update_write_node_filepath after try exception
Browse files Browse the repository at this point in the history
  • Loading branch information
moonyuet committed Jul 26, 2024
1 parent ad9bda6 commit 94d16aa
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions client/ayon_nuke/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,20 @@ 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()
except ValueError:
self.remove_instances([created_inst])
continue

update_write_node_filepath(created_inst, changes)

set_node_data(
instance_node,
INSTANCE_DATA_KNOB,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit 94d16aa

Please sign in to comment.