Skip to content

Commit

Permalink
Updated update to allow for sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamphues committed Aug 29, 2020
1 parent 3ac6ca1 commit d4b6777
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions hooks/tk-houdini_scene_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ def scan_scene(self):
# get a list of all regular alembic nodes in the file
alembic_nodes = hou.nodeType(hou.sopNodeTypeCategory(), "alembic").instances()

# get a list of all regular file nodes in the file
file_nodes = hou.nodeType(hou.sopNodeTypeCategory(), "file").instances()
# get a tuple of all regular file nodes in the file
file_nodes_unfiltered = hou.nodeType(hou.sopNodeTypeCategory(), "file").instances()

# refine tuple of all regular file nodes to exclude file nodes inside locked digital asset
file_nodes = tuple(file_node for file_node in file_nodes_unfiltered if not file_node.isInsideLockedHDA())

# return an item for each alembic node found. the breakdown app will check
# the paths of each looking for a template match and a newer version
Expand Down Expand Up @@ -88,7 +91,7 @@ def update(self, items):
generated by the scan_scene hook above. The path key now holds
the that each node should be updated *to* rather than the current path.
"""
frame_pattern = re.compile("(%0(\d)d)")
frame_pattern_path = re.compile("(%0(\d)d)")

engine = self.parent.engine

Expand All @@ -114,15 +117,15 @@ def update(self, items):
# update the file node file parameter to the new path
if node_type == 'file':

frame_match = re.search(frame_pattern, file_path)
frame_match_path = re.search(frame_pattern_path, file_path)

if frame_match:
full_frame_spec = frame_match.group(1)
padding = frame_match.group(2)
if frame_match_path:
full_frame_spec = frame_match_path.group(1)
padding = frame_match_path.group(2)
file_path = file_path.replace(full_frame_spec, "$F%s" % (padding,))

file_node = hou.node(node_path)
engine.log_debug(
"Updating file node '%s' to: %s" % (node_path, file_path)
)
file_node.parm("file").set(file_path)
file_node.parm("file").set(file_path)

0 comments on commit d4b6777

Please sign in to comment.