0
$\begingroup$

I am trying to "enable" a contraint by the state of another constraint using drivers. I want to be able to check if a contraint is enabled or not and then set the state of another constraint. For example I have a "Shrinkwrap" and a "Child of" constraint and I want to set up a driver to the "Child of" constraint using a scripted expression. In the expression I want to chech if the other ("Shrinkwrap") constraint is enabled or not and then set the "Child of" constraint accordingly. I am attempting to do that by setting a scripted expression as follows:

Expression: False if pose.bones["Bone.003"].constraints["Shrinkwrap"].enabled ==True else True

The problem is that I get an error saying: '''NameError: name 'pose' is not defined''' which should not be the case as "pose" is a module loaded with blender at start up.Is there a way to make this work, or am I approaching this the wrong way?

$\endgroup$

1 Answer 1

1
$\begingroup$

If you want to enable a constraint when another one is disabled, you can just put not followed by the path to the constraint's state. Since this is a boolean, it will return the opposite value.

So instead of

False if pose.bones["Bone.003"].constraints["Shrinkwrap"].enabled ==True else True

Use:

not pose.bones["Bone"].constraints["Shrinkwrap"].enabled`
$\endgroup$

You must log in to answer this question.

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