I have a modifier that I want to put at the top of the modifier stack.
How can I do this in python?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Suppose you have two modifiers like this:
Note that the second modifier is named "Subsurf". You can move it up like this:
You may need to set the active object first, as described in this answer:
my_object = bpy.context.scene.objects['Cube'] bpy.context.scene.objects.active = my_object
If your modifier is in an unknown position in the stack, you can use a loop like this to bring it to the top:
while my_object.modifiers.name != "Subsurf": bpy.ops.object.modifier_move_up(modifier="Subsurf")