Dev:IT/2.5/Py/Scripts/Cookbook/Code snippets/Nodes
< Dev:IT | 2.5/Py/Scripts/Cookbook/Code snippets
2011年5月15日 (日) 05:18時点におけるwiki>ValterVBによる版 (Created page with "{{Page/Header|2.5x|Dev:IT/2.5/Py/Scripts/Cookbook/Code_snippets/Simulations|Dev:IT/2.5/Py/Scripts/Cookbook/Code_snippets/Batch_run|100}} =Nodi= Questo programma crea una rete di...")
Nodi
Questo programma crea una rete di nodi.
#---------------------------------------------------
# File nodes.py
#---------------------------------------------------
import bpy, math
# switch on nodes
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
links = tree.links
# clear default nodes
for n in tree.nodes:
tree.nodes.remove(n)
# create input render layer node
rl = tree.nodes.new('R_LAYERS')
rl.location = 0,200
# create SEP_RGBA node
sep = tree.nodes.new('SEPRGBA')
sep.name = "Split"
sep.location = 200,200
links.new(rl.outputs[0],sep.inputs[0]) # image-image
# create VIEWER node
viewer = tree.nodes.new('VIEWER')
viewer.label = "Alpha"
viewer.location = 400,400
links.new(sep.outputs[3],viewer.inputs[0]) # A-image
# create COMBRGBA node
comb = tree.nodes.new('COMBRGBA')
comb.label = "Cyan"
comb.location = 400,200
links.new(sep.outputs[1],comb.inputs[2]) # G - B
links.new(sep.outputs[2],comb.inputs[1]) # B - G
# create HUE_SAT node
hs = tree.nodes.new('HUE_SAT')
hs.label = "Violet"
hs.location = 600,200
hs.color_hue = 0.75
hs.color_saturation = 1.5
links.new(comb.outputs[0],hs.inputs[1]) # image-image
# create output node
comp = tree.nodes.new('COMPOSITE')
comp.location = 600,400
links.new(hs.outputs[0],comp.inputs[0]) # image-image