Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- # create a group
- # crear un grupo
- test_group = bpy.data.node_groups.new('testGroup', 'ShaderNodeTree')
- # create group inputs
- # crear entradas de grupo
- group_inputs = test_group.nodes.new('NodeGroupInput')
- group_inputs.location = (-350,0)
- test_group.inputs.new('NodeSocketFloat','in_to_greater')
- test_group.inputs.new('NodeSocketFloat','in_to_less')
- # create group outputs
- # crear salidas grupales
- group_outputs = test_group.nodes.new('NodeGroupOutput')
- group_outputs.location = (300,0)
- test_group.outputs.new('NodeSocketFloat','out_result')
- # create nodes to be inside of the group
- # crear nodos para estar dentro del grupo
- # you can delete these nodes or change them to be the nodes you want
- # puede eliminar estos nodos o cambiarlos para que sean los nodos que desee
- node_add = test_group.nodes.new('ShaderNodeMath')
- node_add.operation = 'ADD'
- node_add.location = (100,0)
- node_greater = test_group.nodes.new('ShaderNodeMath')
- node_greater.operation = 'GREATER_THAN'
- node_greater.label = 'greater'
- node_greater.location = (-100,100)
- node_less = test_group.nodes.new('ShaderNodeMath')
- node_less.operation = 'LESS_THAN'
- node_less.label = 'less'
- node_less.location = (-100,-100)
- # link the nodes together
- # enlazar los nodos juntos
- test_group.links.new(node_add.inputs[0], node_greater.outputs[0])
- test_group.links.new(node_add.inputs[1], node_less.outputs[0])
- # link the inputs
- # vincular las entradas
- test_group.links.new(group_inputs.outputs['in_to_greater'], node_greater.inputs[0])
- test_group.links.new(group_inputs.outputs['in_to_less'], node_less.inputs[0])
- # link the output
- # vincular la salida
- test_group.links.new(node_add.outputs[0], group_outputs.inputs['out_result'])
Advertisement
Add Comment
Please, Sign In to add comment