How do i create a custom property to turn a constraint on and off?

I’m trying to create a sort of FK/IK switch on a rig I am working on.

I added some constraints to a few of the bones that make up an ik system.

By turning off the ik constraint and then turning on a few other constraints I have a system I am happy with.

Is there a way to create a custom property that will do these steps for me with a slider?

Thanks

I learned how to work with custom properties and how to tweak the blender interface using python with this tutorial.

Thanks sliv,
Going to look into this a little more later. (I’m at work and can’t focus on it fully right now)

But after glancing through this it made me think of something.

Can a bone drive an action without the action be assigned to any other bones as a constraint? How can that be done, if possible? Would you need to make a script?

Unless I don’t understand what you want, add a driver to each of the factors you want to control and set the custom property to drive them. One driver can then turn on/off as many constraints as you set it to.

Hi Richard,

Is it possible to get the custom property to drive an action?

I just made a quick arm rig here at lunch.

The inluence of the ik constraint and a few other constraints are keyframed.

The keyframes are in an action.

It would be handy to have the action driven by a bone.

Basically it would be very handy if I could put an action constraint onto the action itself.

Could a custom property do that?

If so it would be a very simple process to turn ik/fk on and off.

Right now it works great - except for the fact that I can’t get a bone to drive the action which affects the influences.

I understand that the influences should be driven and not keyframed.

It just seems like it should be possible the way I am doing it. And if it worked, it would save a ton of time.

I don’t understand why you want to use some actions to control your IK/FK switching.
Anyway, you can add a driver to almost all the values in blender so you can add a driver on the value in the action editor you want to control then a driver can be used with custom properties or “transform chanel”, means translation, rotation or scale of an object or of a bone along one of the three axis.

Little example : with a first object’s translation along the X axis we’re going to control a second object’s rotation along the Z axis.

In an empty scene create two objects : a monkey and a cube

Select the monkey, add a driver on the rotation along the Z axis : in the 3D view on the transform panel right clic on the Z axis rotation value and select “Add Single Driver”

Now you need a graph editor, in the header change the mode from FCurve editor to Drivers.

On the list you can see your driver, it’s called “Z Euler Rotation (Monkey)”

Press N to show the option panel, on the Drivers panel change the type value from “scripted expression” to “averaged value”, lower in this panel “transform chanel” is the default value (you could pick “Single Property” if you wanted to use a custom property)

A field is named “Od/bone:” ; clic on this field and select the cube.

X location is activated, If you clic on it you can change it to more transform chanels.

Now if you move the cube along the X axis, the monkey will turn around the Z axis.

Some things can still be tweaked in the modifiers panel in the graph editor :

  • if you change the 1.000 value to -1.000, the monkey will turn the other way
  • if you change this value to a value bigger or smaller than 1 the monkey will turn faster or slower.
  • if you change the 0.000 value, the monkey will start his rotation with an offset.

“et voilà” I hope this could help to understanding how to control something with a transform chanel through drivers

Thanks sliv,

I understand drivers. I was just trying to find an even simpler solution to a switch. One that is very quick to implement.

It seemed like a good idea to try animating the influence with an action and then having a bone in the armature drive that action.
At keyframe 1 the IK constraint influence is 1, and at keyframe 11 the influence is 0 for example.

It is actually the same thing as using drivers, I guess, it just seemed like I had cut the time way down to get it working.

Problem is now I do not know of a way to get the bone I would like to use as a switch to drive the action. Since I can’t seem to find a place to assign a driver to an action.

I guess what I am looking for now - is simply for a way to have a bone drive an action when it is translated in whatever chosen axis.

I know that I can choose the Action constraint on bones, but the action I want to play through relates to constraint values only, and so assigning an action constraint doesn’t work.

Ok sorry I have misunderstood the problem.
Hitherto, I have used actions only to work on animation, I’ve never tried to use them for rigging.
Actually I do not work a lot on rigging myself.
Since I discovered rigify, I’ve only used it for my rigging and I’ve only used drivers, custom properties and interface tweaking in order to add some features/bones to the rigify’s automatic rig.