-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
58 lines (47 loc) · 1.91 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
File Cache node App for use with Toolkit's Houdini engine.
"""
import sgtk
class TkCacheNodeApp(sgtk.platform.Application):
def init_app(self):
"""Initialize the app."""
tk_houdini_cachenode = self.import_module("tk_houdini_cachenode")
self.handler = tk_houdini_cachenode.TkCacheNodeHandler(self)
def get_nodes(self):
"""
Returns a list of hou.node objects for each tk cache node.
Example usage::
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> app = eng.apps["tk-houdini-cache"]
>>> tk_cache_nodes = app.get_nodes()
"""
self.log_debug("Retrieving tk-houdini-cache nodes...")
tk_houdini_cache = self.import_module("tk_houdini_cachenode")
nodes = tk_houdini_cache.TkCacheNodeHandler.get_nodes()
self.log_debug("Found %s tk-houdini-cache nodes." % (len(nodes),))
return nodes
def get_output_path(self, node):
"""
Returns the evaluated output path for the supplied node.
Example usage::
>>> import sgtk
>>> eng = sgtk.platform.current_engine()
>>> app = eng.apps["tk-houdini-cachenode"]
>>> output_path = app.get_output_path(tk_cache_node)
"""
self.log_debug("Retrieving output path for %s" % (node,))
tk_houdini_cache = self.import_module("tk_houdini_cachenode")
output_path = tk_houdini_cache.TkCacheNodeHandler.get_output_path(node)
self.log_debug("Retrieved output path: %s" % (output_path,))
return output_path
def get_work_file_template(self):
"""
Returns the configured work file template for the app.
"""
return self.get_template("output_cache_template")
def get_publish_file_template(self):
"""
Returns the configured publish file template for the app.
"""
return self.get_template("output_publish_template")