Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def append_threshold(data=bpy.data, use_fake_user=False):
- in_sockets = [
- {'default_value': 0.5},
- {'name': 'Lower',
- 'default_value': 0.0},
- {'name': 'Upper',
- 'default_value': 1.0}
- ]
- out_sockets = [
- {'default_value': 0.5}
- ]
- thresh_group = append_group_node(name='Threshold', data=data, use_fake_user=use_fake_user, in_sockets=in_sockets, out_sockets=out_sockets)
- # Create nodes.
- nodes = thresh_group.nodes
- inbounds = append_group_inst(nodes=nodes, group_name='InBounds', data=data, group_creation_func=append_inbounds, data=data, use_fake_user=use_fake_user)
- mult = append_math_node(nodes, operation='MULTIPLY')
- # Link nodes.
- links = thresh_group.links
- links.new(mult.inputs[0], inbounds.outputs[0])
- # Link to group inputs.
- thresh_input = thresh_group.nodes['Group Input']
- links.new(mult.inputs[1], thresh_input.outputs[0])
- links.new(inbounds.inputs[0], thresh_input.outputs[0])
- links.new(inbounds.inputs[1], thresh_input.outputs[1])
- links.new(inbounds.inputs[2], thresh_input.outputs[2])
- # Link to group outputs.
- thresh_output = thresh_group.nodes['Group Output']
- links.new(thresh_output.inputs[0], mult.outputs[0])
Add Comment
Please, Sign In to add comment