diff options
author | Eugenio Pignataro <info@oscurart.com.ar> | 2020-05-11 23:22:43 +0300 |
---|---|---|
committer | Eugenio Pignataro <info@oscurart.com.ar> | 2020-05-11 23:22:43 +0300 |
commit | 159356cb41f1f9052fbfa77095530046622e2d1d (patch) | |
tree | 3b35f2f4b59ffea8a62a8de7d22a3d90500fd057 | |
parent | 35889df2a2fe337519270444ff2c7e1f769dcefb (diff) |
OscurarTools: New Feature in renderTokens, now support compositor output filepath
-rw-r--r-- | oscurart_tools/render/render_tokens.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/oscurart_tools/render/render_tokens.py b/oscurart_tools/render/render_tokens.py index 2ac8404e..12c27b15 100644 --- a/oscurart_tools/render/render_tokens.py +++ b/oscurart_tools/render/render_tokens.py @@ -25,6 +25,7 @@ from bpy.app.handlers import persistent @persistent def replaceTokens (dummy): global renpath + global nodeDict tokens = { "$Scene":bpy.context.scene.name, "$File":os.path.basename(bpy.data.filepath).split(".")[0], @@ -32,6 +33,15 @@ def replaceTokens (dummy): "$Camera":bpy.context.scene.camera.name} renpath = bpy.context.scene.render.filepath + + nodeDict = [] + #compositor nodes + for node in bpy.context.scene.node_tree.nodes: + if node.type == "OUTPUT_FILE": + nodeDict.append([node,node.base_path]) + node.base_path = node.base_path.replace("$Scene",tokens["$Scene"]).replace("$File",tokens["$File"]).replace("$ViewLayer",tokens["$ViewLayer"]).replace("$Camera",tokens["$Camera"]) + + bpy.context.scene.render.filepath = renpath.replace("$Scene",tokens["$Scene"]).replace("$File",tokens["$File"]).replace("$ViewLayer",tokens["$ViewLayer"]).replace("$Camera",tokens["$Camera"]) print(bpy.context.scene.render.filepath) @@ -41,6 +51,10 @@ def replaceTokens (dummy): def restoreTokens (dummy): global renpath bpy.context.scene.render.filepath = renpath + + #restore nodes + for node in nodeDict: + node[0].base_path = node[1] # //RENDER/$Scene/$File/$ViewLayer/$Camera |