Skip to content

Commit

Permalink
Fix write node creation from broken Anatomy. (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-ynput authored Aug 19, 2024
1 parent d4c3ace commit 698a7c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
13 changes: 6 additions & 7 deletions client/ayon_nuke/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def check_product_name_exists(nodes, product_name):
False)


def format_anatomy(data):
def get_work_default_directory(data):
''' Helping function for formatting of anatomy paths
Arguments:
Expand Down Expand Up @@ -924,7 +924,10 @@ def format_anatomy(data):
},
"frame": "#" * frame_padding,
})
return anatomy.format(data)

work_default_dir_template = anatomy.get_template_item("work", "default", "directory")
normalized_dir = work_default_dir_template.format_strict(data).normalized()
return str(normalized_dir).replace("\\", "/")


def script_name():
Expand Down Expand Up @@ -1100,13 +1103,9 @@ def create_write_node(
"imageio_writes": imageio_writes,
"ext": ext
})
anatomy_filled = format_anatomy(data)

# build file path to workfiles
fdir = str(
anatomy_filled["work"]["default"]["directory"]
).replace("\\", "/")
data["work"] = fdir
data["work"] = get_work_default_directory(data)
fpath = StringTemplate(data["fpath_template"]).format_strict(data)

# create directory
Expand Down
8 changes: 2 additions & 6 deletions client/ayon_nuke/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
list_instances,
remove_instance
)
from ayon_nuke.api.lib import format_anatomy
from ayon_nuke.api.lib import get_work_default_directory


def _collect_and_cache_nodes(creator):
Expand Down Expand Up @@ -1275,13 +1275,9 @@ def update_write_node_filepath(created_inst, changes):
"{work}/renders/nuke/{subset}/{subset}.{frame}.{ext}"),
"ext": write_node["file_type"].value()
})
anatomy_filled = format_anatomy(formatting_data)

# build file path to workfiles
fdir = str(
anatomy_filled["work"]["default"]["directory"]
).replace("\\", "/")
formatting_data["work"] = fdir
formatting_data["work"] = get_work_default_directory(formatting_data)
fpath = StringTemplate(formatting_data["fpath_template"]).format_strict(
formatting_data)
write_node["file"].setValue(fpath)

0 comments on commit 698a7c0

Please sign in to comment.