disable enable all constraints with one click, can somebody help out?

Hello,

I got a request if somebody here that knows python has a bit of free time.
is there a way to make a script to enable or disable all the constraints of a skeleton?
I’m no programmer so I cant do this my self, if somebody here would do this I would
be eternally grateful :slight_smile:

I already know you can use the hot key crtl+alt c to delete all the constraints, what I’m looking for a way to just disable all of them with one click instead having to click the little eye symbol on each bone to disable one by one.

This is would be handy to check how your constraints are affecting a skeleton on a global way, i found I this to should be useful when adding constraints for the purpose of coping the loc and rot of one skeleton to another skeleton which is what I’m doing
nowadays.

not a lot of experience with armatures but select your objects and try something like this…


import bpy
for obj in bpy.context.selected_objects:
    bpy.context.scene.objects.active = obj
    for con in obj.constraints:
        con.mute = True

edit: and set to False later to enable the constraints again… tell me if it doesn t work

And if you don’t want to use python because you are not a coder you can use drivers too but you will have to create one driver for each constraint you want to disable/enable.

liero : First thanks for taking the time to give at shot at figuring this out form me, I need to learn some python but I’m more on the modeling side of things so getting a bit of help on the tec side is much appreciated!

I tried to select all the bones in both pose mode and the whole armature in object mode and then paste and run the script on the script editor while selecting the armature and nothing happened, I attached the blend file where in doing my experiments, basically Armature.001 moves and the other follows, what i want is for the rotation constraints on Armature to be disabled so they remain there while being inactive.

constraits.blend (429 KB)

sliv: Yeah but I don’t want to create those drivers one by one when there’s most likely a way to tell the console to just turn off the visibility of those constraints, the idea is to save me some time on a mechanical task.

hi, sorry it didn’t work, not a clue about bones stuff yet :no:
try this instead, but I don’t if it works as you were expecting
set influence to 1 to reset…


import bpy
obj = bpy.context.object
for bone in obj.pose.bones:
    for con in bone.constraints:
        con.influence = 0

3 Likes

It almost does, its decreasing the influence of all the constraints to 0 which visually gives the same result as muting/disabling the constraints, this is GREAT! i can use this on more than one way to test how my constraints are working, but is there a way to just mute them? as in like when I click the little eye icon on the top right window of the constraints?

Thanks for your time and expertise! :slight_smile:

yep, just change the con.influence=0 line to con.mute=True as in first script
and then back to con.mute=False

but seems to do the same thing here
glad to help anyway…!