Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write node creation while broken project Anatomy. #12

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)