-
Notifications
You must be signed in to change notification settings - Fork 33
Fixing effect loader for macos resources #245
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -28,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. | ||||||||||||||||||||||||||||||||
|
|
@@ -40,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( | ||||||||||||||||||||||||||||||||
| ( | ||||||||||||||||||||||||||||||||
|
|
@@ -65,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 | ||||||||||||||||||||||||||||||||
|
|
@@ -85,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") | ||||||||||||||||||||||||||||||||
|
|
@@ -103,6 +101,26 @@ def _create_nodes_order(self, nodes_order: dict): | |||||||||||||||||||||||||||||||
| self.log.warning(e) | ||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # 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() | ||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 things:
Rather prepare the anatomy ahead in project_entity = context["project"]
anatomy = Anatomy(
project_entity["name"], project_entity=project_entity
) |
||||||||||||||||||||||||||||||||
| anatomy = Anatomy(project_name=project_name) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+108
to
+109
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should use the project from which we're loading. Mostly would be current project, but you can also load from library project. The project entity is stored in project_entity = context["project"]
anatomy = Anatomy(project_entity["name"], project_entity=project_entity)Also could happen only once for the whole load logic in case the anatomy would be created multiple times.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Side note: Why is this actually happening? The loaded "files" can have loaded other files? That might be a mess. Imagine having file that is e.g. ocio file defined with environment variables instead of anatomy roots, it would just collapse. |
||||||||||||||||||||||||||||||||
| _template_data = { | ||||||||||||||||||||||||||||||||
|
Comment on lines
+107
to
+110
|
||||||||||||||||||||||||||||||||
| "root": anatomy.roots, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+108
to
+112
|
||||||||||||||||||||||||||||||||
| success, rootless_path = \ | ||||||||||||||||||||||||||||||||
| anatomy.find_root_template_from_path(file_path) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+113
to
+114
|
||||||||||||||||||||||||||||||||
| success, rootless_path = \ | |
| anatomy.find_root_template_from_path(file_path) | |
| success, rootless_path = ( | |
| anatomy.find_root_template_from_path(file_path) | |
| ) |
Copilot
AI
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These info logs will run for every file knob and will emit resolved absolute paths, which can be very noisy in normal usage. Consider lowering to debug (and/or logging only on failure) so routine loads don’t flood logs.
| 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}") | |
| self.log.debug(f"rootless_path: {rootless_path}") | |
| if success: | |
| abs_resources_path = StringTemplate.format_strict_template( | |
| rootless_path, _template_data | |
| ) | |
| v = abs_resources_path | |
| self.log.debug(f"File path: {abs_resources_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.log.info(f"File path: {abs_resources_path}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.