# How to make constraint permanent once disabled?

I have got a beautiful bone constraint:

I would like to be able to enable and disable this constraint without the bone reverting to the original position.

By default, the bone appears to return to it's original starting position when influence is set to 0 or visibility is set to off.

So, for example:

• Constraint is "on" or "enabled" - bone follows Hand.L as expected
• Constraint is "off" - bone stays where it is at this exact moment and does not move.

I would like to be able to 'apply' the constraint without actually deleting the constraint, as I am intending to turn it on and off frequently during animation.

• Hit the X to the right of influence slider. It "applies" the constraint and sets influence to 0 – batFINGER Mar 25 at 10:59
• @batFINGER I can't believe I didn't see that. Seems to work! – Joehot200 Mar 25 at 11:02
• Note it may change behaviour when setting influence back to 1 since there is a new location / rotation etc depending on constraint. – batFINGER Mar 25 at 11:03
• @batFINGER It might be a little off-topic now, but I'm also trying to do this with a script. If I set the influence directly, Blender will show me the code in the bottom left of the 'scripting' tab to type to change it, however when I hit the X button nothing shows up at all. – Joehot200 Mar 25 at 11:07

Disable and Keep Transform

Hit the X to the right of influence slider. It "applies" the constraint and sets influence to 0

Script Equivalent, copy the transform, ie the world matrix, set the constraint influence to zero (disable) and reset the matrix world.

import bpy

ob = bpy.context.object
constraint = ob.constraints.get("Copy Location")
if constraint:
mw = ob.matrix_world.copy()
constraint.influence = 0
ob.matrix_world = mw

• Cheers for the answer, it's a great help. One last question - since I have to do this for bones, how do I set the matrix_world? bone.matrix_world = mw seems to with objects, but not with bones. – Joehot200 Mar 25 at 19:39