Guest User

Untitled

a guest
Jan 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. def modifiers_by_name(obj, name):
  2. """ Find all modifiers with a specific name in obj """
  3. return [x for x in obj.modifiers if x.name == name]
  4.  
  5. def modifiers_by_type(obj, typename):
  6. """ Find all modifiers with a specific type in obj """
  7. return [x for x in obj.modifiers if x.type == typename]
  8.  
  9. # move all "Screw" modifiers to the top
  10. for modifier in reversed(modifiers_by_type(obj, "SCREW")):
  11. # while modifier not on top
  12. while obj.modifiers.find(modifier.name) != 0:
  13. # move it one more to the top.
  14. bpy.ops.object.modifier_move_up(modifier=modifier.name)
Add Comment
Please, Sign In to add comment