Saving z-value via python?

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
_patrice_
Posts: 0
Joined: Tue Feb 28, 2012 6:13 pm

Saving z-value via python?

Post by _patrice_ » Sun Aug 18, 2013 2:31 pm

Hey everyone,

I need to script some render workflows and therefore I also need to save the z-values for each rendered camera perspective. I know how to do it using the node editor manually, but I really struggle doing it in python. I guess the only thing is to setup a "Render Layer", a "Composite" and an additional "File Output Node" but I can't find any useful examples or tutorials. I found a few things how to create a node but these examples seems to be old and doesn't work on 2.68.

i.e. this doesn't work anymore:

Code: Select all

# switch on nodes
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree

# clear default nodes
for n in tree.nodes:
    tree.nodes.remove(n)

# create input render layer  node
rl = tree.nodes.new('R_LAYERS')      

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
RuntimeError: Error: Node type R_LAYERS undefined 
I had a look into the API Reference for 2.64 but cannot find anything that helps me.

Each hint that helps me would be very nice.

Post Reply