Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def append_approx(data=bpy.data, use_fake_user=False):
- in_sockets = [
- {'name': 'A'},
- {'name': 'B'},
- {'name': 'Tolerance',
- 'default_value': 0.0001,
- 'min_value': 0.0}
- ]
- out_sockets = [
- {'name': 'Boolean',
- 'min_value': 0.0,
- 'max_value': 1.0}
- ]
- # Create group.
- approx_group = append_group_node(name='Approx', data=data, use_fake_user=use_fake_user, in_sockets=in_sockets, out_sockets=out_sockets)
- # Create math nodes.
- nodes = approx_group.nodes
- subt = append_math_node(nodes, operation='SUBTRACT')
- absv = append_math_node(nodes, operation='ABSOLUTE')
- gt = append_math_node(nodes, operation='GREATER_THAN')
- # Link nodes.
- links = approx_group.links
- links.new(absv.inputs[0], subt.outputs[0])
- links.new(gt.inputs[1], absv.outputs[0])
- # Link to group inputs.
- app_input = approx_group.nodes['Group Input']
- links.new(subt.inputs[0], app_input.outputs[0])
- links.new(subt.inputs[1], app_input.outputs[1])
- links.new(gt.inputs[0], app_input.outputs[2])
- # Link to group outputs.
- app_output = approx_group.nodes['Group Output']
- links.new(app_output.inputs[0], gt.outputs[0])
- return approx_group
Add Comment
Please, Sign In to add comment