Skip to content

Commit

Permalink
Add support for Houdini Solaris Sublayer nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
gillesvink committed Nov 18, 2021
1 parent 65a9f95 commit d0ca648
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions hooks/tk-houdini_scene_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def scan_scene(self):
hou.lopNodeTypeCategory(), "reference"
).instances()

sublayer_nodes = hou.nodeType(
hou.lopNodeTypeCategory(), "sublayer"
).instances()

# refine tuple of all regular file nodes to exclude file nodes inside locked digital asset
file_nodes = tuple(
file_node
Expand Down Expand Up @@ -95,6 +99,15 @@ def scan_scene(self):
{"node": reference_node.path(), "type": "reference", "path": file_path}
)

# search in all sublayer node
for sublayer_node in sublayer_nodes:
file_parm = sublayer_node.parm("filepath1")
file_path = os.path.normpath(file_parm.eval())

items.append(
{"node": sublayer_node.path(), "type": "sublayer", "path": file_path}
)

return items

def update(self, items):
Expand Down Expand Up @@ -154,3 +167,11 @@ def update(self, items):
"Updating file node '%s' to: %s" % (node_path, file_path)
)
reference_node.parm("filepath1").set(file_path)

# update the sublayer node paramter to the new path
if node_type == "sublayer":
sublayer_node = hou.node(node_path)
engine.log_debug(
"Updating file node '%s' to: %s" % (node_path, file_path)
)
sublayer_node.parm("filepath1").set(file_path)

0 comments on commit d0ca648

Please sign in to comment.