Skip to content

Commit

Permalink
fixed publish updates issues with tk-multi-breakdown hook. Added a co…
Browse files Browse the repository at this point in the history
…uple of missing imports in tk-multi-loader2 hook.
  • Loading branch information
diegogarciahuerta committed Aug 12, 2019
1 parent 90caf9c commit eace773
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 22 additions & 2 deletions hooks/tk-multi-breakdown/tk-natron_scene_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@
__email__ = "[email protected]"




class NatronBreakdownSceneResource(str):
"""
Helper Class to store metadata per update item.
tk-multi-breakdown requires item['node'] to be a str. This is what is displayed in
the list of recognized items to update. We want to add metadata to each item
as what we want to pass to update is the parameter and not the node itself.
python friendly object + __repr__ magic method.
"""

def __new__(cls, node, parameter):
text = "%s" % node
obj = str.__new__(cls, text)
obj.parameter = parameter
return obj


class BreakdownSceneOperations(Hook):
"""
Breakdown operations for Natron.
Expand Down Expand Up @@ -59,7 +78,7 @@ def scan_scene(self):
file_param = node.getParam('filename')
ref_path = file_param.getValue()
ref_path = ref_path.replace("/", os.path.sep)
refs.append({"attr": node, "type": "file", "path": ref_path})
refs.append({"node": NatronBreakdownSceneResource(node, file_param), "type": "file", "path": ref_path})

return refs

Expand All @@ -79,7 +98,8 @@ def update(self, items):
engine = self.parent.engine

for i in items:
node = i["attr"]
node = i["node"]
attr = node.parameter
node_type = i["type"]
new_path = i["path"]

Expand Down
2 changes: 2 additions & 0 deletions hooks/tk-multi-loader2/tk-natron_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import os
import sgtk
import re
import glob
from sgtk.errors import TankError

import NatronGui
Expand Down

0 comments on commit eace773

Please sign in to comment.