Skip to main content
1 of 5
Noob Cat
  • 1.4k
  • 3
  • 25
  • 67

How to move up or down a modifier?

I assume that this operation is not clear to me. When I add a new modifier, I would like a modifier (which I have already identified) to be moved to the bottom of the list of existing modifiers. I am trying to move it, but I see that it does not work if the object in question, where the "Smooth" modifier is present, is not moved. On the contrary, if the object in question is active, it is moved perfectly to the bottom.

I am using:

#ob = my object, not necessarily it must be selected, it is found by a function
#smooth = #my modifier (found through a function)
for m in ob.modifiers:
    bpy.ops.object.modifier_move_down(modifier = smooth.name)

This only works if the active object is ob

Do I have to overwrite the context?

I saw a similar answer to this question, but I'm not sure it's my case, I would like to understand better.Although it appears that I am not getting any errors in my case

Noob Cat
  • 1.4k
  • 3
  • 25
  • 67