I'm running into walls trying to reorder the bone constraints stack on blender 2.78.
I have an armature for which I want to re-order bone constraints on every bone. The way to do this seems to be to use
bpy.ops.constraint.move_up(constraint=name, owner='BONE')
Where name
is the name of the constraint.
I'm assuming I need to be in pose mode and I need to select the bone I want to operate on, so:
bpy.ops.object.mode_set(mode = 'POSE')
bone = bpy.context.active_object.pose.bones['the_bone_i_want']
bone.bone.select = True
bpy.ops.constraint.move_up(constraint=name, owner='BONE')
This produces a RuntimeError: Operator bpy.ops.constraint.move_up.poll() Context missing 'constraint'
OK, so I'm in the wrong context. Why? Which context has the necessary constraint?
I also thought about changing the active area to the properties beforehand, like this:
bpy.context.area.type = 'PROPERTIES'
This does change the active area, but doesn't get rid of the error message.
Can anyone point out what I'm doing wrong, or give me a way to reorder bone constraints that works?