[Bf-extensions-cvs] [159356cb] master: OscurarTools: New Feature in renderTokens, now support compositor output filepath
Eugenio Pignataro
noreply at git.blender.org
Mon May 11 22:22:49 CEST 2020
Commit: 159356cb41f1f9052fbfa77095530046622e2d1d
Author: Eugenio Pignataro
Date: Mon May 11 17:22:43 2020 -0300
Branches: master
https://developer.blender.org/rBA159356cb41f1f9052fbfa77095530046622e2d1d
OscurarTools: New Feature in renderTokens, now support compositor output filepath
===================================================================
M oscurart_tools/render/render_tokens.py
===================================================================
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
More information about the Bf-extensions-cvs
mailing list