1
$\begingroup$

I have got a beautiful bone constraint:

enter image description here

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.

$\endgroup$
4
  • 1
    $\begingroup$ Hit the X to the right of influence slider. It "applies" the constraint and sets influence to 0 $\endgroup$
    – batFINGER
    Commented Mar 25, 2020 at 10:59
  • $\begingroup$ @batFINGER I can't believe I didn't see that. Seems to work! $\endgroup$
    – Joehot200
    Commented Mar 25, 2020 at 11:02
  • 1
    $\begingroup$ Note it may change behaviour when setting influence back to 1 since there is a new location / rotation etc depending on constraint. $\endgroup$
    – batFINGER
    Commented Mar 25, 2020 at 11:03
  • $\begingroup$ @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. $\endgroup$
    – Joehot200
    Commented Mar 25, 2020 at 11:07

2 Answers 2

4
$\begingroup$

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
$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – Joehot200
    Commented Mar 25, 2020 at 19:39
  • $\begingroup$ The pose bone matrix eg context.active_pose_bone.matrix is akin to the object matrix world for pose bones. $\endgroup$
    – batFINGER
    Commented Jul 24, 2021 at 16:22
3
$\begingroup$

There is button here. look -

button to apply constraint in blender

because the button looks like a cross, its purpose is not obvious. I myself have hardly noticed this.

After applying it will look like this:

constraint after applying

$\endgroup$
1
  • $\begingroup$ Thank you! this truly is one of the most questionable UI design decisions Blender has had. I completely glossed over this "button" because I thought it must mean instantly zeroing out the Influence or something... I never even hovered over it to check what it actually does. Wow. $\endgroup$
    – BuzzKirill
    Commented Nov 6, 2021 at 7:09

You must log in to answer this question.

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