I’m writing a script which accepts an stl file, call it foo.stl. I have imported it, set an origin, scaled it, moved it, rendered it and everything works. I have 2 render layers, one is a shadow pass. I have composited everything nicely and it looks great. I have 4 ‘File Output’ nodes in the compositing, each is a different mix of alpha and layers. I want to be able to name them, through python, so one filename would be ‘foo-full-alpha.png’, another ‘foo-shadow-only.png’ Any hints on how to access those filenames programmatically?
You can access the node tree with bpy.context.scene.node_tree.nodes[‘node name’]. You should also give your nodes a name.
Ok, thanks. Naturally I saw your post after searching through some old dev logs. I didn’t realize you could name nodes. FTR it’s in the node properties panel on the right (hit n)
I was able to do what I wanted with this little snipped found here, which is
Basic idea is this:
filename = 'foo'
for scene in bpy.data.scenes:
for node in scene.node_tree.nodes:
if node.type == 'OUTPUT_FILE':
node.base_path = "//" + filename