Guest User

Untitled

a guest
May 24th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. def append_threshold(data=bpy.data, use_fake_user=False):
  2. in_sockets = [
  3. {'default_value': 0.5},
  4. {'name': 'Lower',
  5. 'default_value': 0.0},
  6. {'name': 'Upper',
  7. 'default_value': 1.0}
  8. ]
  9.  
  10. out_sockets = [
  11. {'default_value': 0.5}
  12. ]
  13.  
  14. thresh_group = append_group_node(name='Threshold', data=data, use_fake_user=use_fake_user, in_sockets=in_sockets, out_sockets=out_sockets)
  15.  
  16. # Create nodes.
  17. nodes = thresh_group.nodes
  18. inbounds = append_group_inst(nodes=nodes, group_name='InBounds', data=data, group_creation_func=append_inbounds, data=data, use_fake_user=use_fake_user)
  19. mult = append_math_node(nodes, operation='MULTIPLY')
  20.  
  21. # Link nodes.
  22. links = thresh_group.links
  23. links.new(mult.inputs[0], inbounds.outputs[0])
  24.  
  25. # Link to group inputs.
  26. thresh_input = thresh_group.nodes['Group Input']
  27. links.new(mult.inputs[1], thresh_input.outputs[0])
  28. links.new(inbounds.inputs[0], thresh_input.outputs[0])
  29. links.new(inbounds.inputs[1], thresh_input.outputs[1])
  30. links.new(inbounds.inputs[2], thresh_input.outputs[2])
  31.  
  32. # Link to group outputs.
  33. thresh_output = thresh_group.nodes['Group Output']
  34. links.new(thresh_output.inputs[0], mult.outputs[0])
Add Comment
Please, Sign In to add comment