Skip to content

Commit

Permalink
update 'collect_scene_placeholders' to cache by identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
MustafaJafar committed Jul 10, 2024
1 parent 7c3284e commit b75b8cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
12 changes: 6 additions & 6 deletions client/ayon_houdini/api/workfile_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,21 @@ def create_placeholder(self, placeholder_data):
imprint(placeholder_node, placeholder_data)

def collect_scene_placeholders(self):
# Read the cache
# Read the cache by identifier
placeholder_nodes = self.builder.get_shared_populate_data(
"placeholder_nodes"
self.identifier
)
if placeholder_nodes is None:
placeholder_nodes = {}
placeholder_nodes = []

nodes = lsattr("plugin_identifier", self.identifier)

for node in nodes:
placeholder_nodes[node.path()] = node
placeholder_nodes.append(node)

# Set the cache
# Set the cache by identifier
self.builder.set_shared_populate_data(
"placeholder_nodes", placeholder_nodes
self.identifier, placeholder_nodes
)

return placeholder_nodes
Expand Down
10 changes: 3 additions & 7 deletions client/ayon_houdini/plugins/workfile_build/create_placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,12 @@ def get_placeholder_node_name(self, placeholder_data):

def collect_placeholders(self):
output = []
scene_placeholders = self.collect_scene_placeholders()
for node_name, node in scene_placeholders.items():
plugin_identifier = node.evalParm("plugin_identifier")
if plugin_identifier != self.identifier:
continue
create_placeholders = self.collect_scene_placeholders()

for node in create_placeholders:
placeholder_data = read(node)

output.append(
CreatePlaceholderItem(node_name, placeholder_data, self)
CreatePlaceholderItem(node.path(), placeholder_data, self)
)

return output
Expand Down

0 comments on commit b75b8cb

Please sign in to comment.