Is there any way to set a modifier or constraints index in the stack without using bpy.ops?
The idea is to easily reformat the stack order of constraint. An example could be to re-order constraints alphabetically


1 Answer 1


Sadly no. I ran in to the same limitation when trying to sort logic bricks.

The constraints, modifiers, and logic bricks are all read only collections.
The only way to reorder them is through the ops operators, moving one at a time, up or down one place. (which stinks for any scripting)

For constraints it is:

bpy.ops.constraint.move_up(constraint="constraintName", owner='OBJECT')
bpy.ops.constraint.move_down(constraint="constraintName", owner='OBJECT')

For modifier it is:


For logic bricks it is:

bpy.ops.logic.sensor_move(sensor="logicBrickName", object="objName", direction='UP')
bpy.ops.logic.actuator_move(actuator="logicBrickName", object="objName", direction='UP')
bpy.ops.logic.controller_move(controller="logicBrickName", object="objName", direction='UP')

bpy.ops.logic.sensor_move(sensor="logicBrickName", object="objName", direction='DOWN')
bpy.ops.logic.actuator_move(actuator="logicBrickName", object="objName", direction='DOWN')
bpy.ops.logic.controller_move(controller="logicBrickName", object="objName", direction='DOWN')

You probably would not want to reorder constraints or modifiers alphabetically. Both constraints and modifiers work from the top down, the order effects the out come.

Here is an example with the exact same modifiers and default settings, just the order is reversed. Stack order makes a huge difference. object showing modifier order

object showing modifier order reversed

  • $\begingroup$ Thanks for the answer, that's what i thought. About alphabetical order, that was just an example to explain the need ;). Waiting before validation, in case someone come with a magic solution! $\endgroup$
    – Boris
    Oct 5, 2015 at 0:24
  • $\begingroup$ I would love a "magic solution," but have looked (I made a logic brick addon) and there is none. :( $\endgroup$
    – David
    Oct 5, 2015 at 13:37
  • 1
    $\begingroup$ Seems right, nothin magic happened. Thanks again $\endgroup$
    – Boris
    Oct 6, 2015 at 13:53
  • $\begingroup$ @David is there anyway I can put the modifier at the top of the stack? $\endgroup$
    – Omar Emara
    Feb 8, 2016 at 10:57
  • $\begingroup$ @OmarAhmad short answer is yes. But it takes more python then I could fit in to a comment. ask a question, and I'll answer with the script. $\endgroup$
    – David
    Feb 8, 2016 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .