Conditional Expressions Thesis

By Robert Campbell

With expressions you can control an input of one object with another object.  When you apply the expression it locks out the value of the object that is being affected.  This can be helpful in rigging a character but could also hurt a rig.  With conditional expressions you can set the expressions to change what is being controlled depending on different variables.

The target of the expression will still be locked out but you can at least change what is being controlled in the expression.  In rigging I used this to create a Reverse Foot CTL instead of having to use set driven keys to create a reverse foot.

Here is the expression editor


I would suggest setting the editor to By Expression Name.  It’s a little easier to switch between the different expressions you create




This rig has a reverse foot set up using groups instead of set driven keys.  Here is the tutorial if you want to create one

Conditional Expressions work similarly to normal scripting but a few things are different.  With normal scripting you would need to declare the different variable for your script.  But with expressions if you want it to update in real time you can’t use variables.  DO NOT USE VARIABLES.

For this condition to work I had the ReverseFootCTL orient constraint to the ReverseBase and LegCTL.  Both the ReverseBase and LegCTL are nodes that are a part of the group based revers foot.  All of this is parented under the FootCTL so that the foot still moves and acts like a normal foot rig.  The expressing then switches between the two constraints depending on which way you rotate the main CTL.

This is the expression that I created for the ReverseFootCTL.

if (LeftReverseFootCTL.rotateX > 0){

LReverseBase_orientConstraint1.LeftReverseFootCTLW0 = 1;

LLegCTL_orientConstraint1.LeftReverseFootCTLW0 = 0;



LReverseBase_orientConstraint1.LeftReverseFootCTLW0 = 0;

LLegCTL_orientConstraint1.LeftReverseFootCTLW0 = 1;


If the ReversFootCTL moves in a positive rotation the ReverseBase constraint would turn on and the LegCTL constraint would turn off.  If you rotate in a negative rotation the constraints would switch.


The  main control rotated in the positive direction


The main control rotated in the negative direction