From 3ac6ca11fe17c7512da4b57d3a7196b51ff8c836 Mon Sep 17 00:00:00 2001 From: Bo Kamphues Date: Sat, 29 Aug 2020 14:42:08 +0200 Subject: [PATCH] Updated update function to allow for sequences --- hooks/tk-houdini_scene_operations.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hooks/tk-houdini_scene_operations.py b/hooks/tk-houdini_scene_operations.py index 1186d0c..1d92c71 100644 --- a/hooks/tk-houdini_scene_operations.py +++ b/hooks/tk-houdini_scene_operations.py @@ -13,6 +13,7 @@ from tank import Hook import hou +import re class BreakdownSceneOperations(Hook): @@ -87,6 +88,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)") engine = self.parent.engine @@ -111,6 +113,13 @@ 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) + + if frame_match: + full_frame_spec = frame_match.group(1) + padding = frame_match.group(2) + file_path = file_path.replace(full_frame_spec, "$F%s" % (padding,)) file_node = hou.node(node_path) engine.log_debug(