Driver Help

Can anybody help me with a driver I’m working on. I want to make a custom property for a model I’m making that is set as an integer type property. What I want to do is have it so that when the value is set to 1 the model will blink with a shape key. then when it is set to two it will wink left with a shape key. Then when set to 3 it will wink right with a shape key. However I’m not sure how to go about this or if it is even possible at all.

Yes it is possible. You need a driver for each shape key - scripted expression
1 if prop == 1 else 0
1 if prop == 2 else 0
1 if prop == 3 else 0

Drver.blend (104.3 KB)

2 Likes

After rereading your question I see that you only have 2 key-frames wink right and wink left.

You want to Blink (activate both) on “1” wink right on “2” and wink left on “3”. “0” = eyes open.
(yea …I got the winks the wrong way round!)

This is also possible with only 2 drivers.

1 if prop == 1 else 1 if prop == 2 else 0

1 if prop == 1 else 1 if prop == 3 else 0

Drver.blend (104.3 KB)

I love drivers :slightly_smiling_face:

2 Likes

Wow! That’s amazing thank you so much! How does one find the information needed for driver equations like those? Is there like a list somewhere or is it python or just math? Like how did you discover how to do that?

Yes these are basic python expressions, drivers will accept a few simple expressions without having to enable “Python script execution” or import modules (the basic ones are already available).

Take a look at this page there is a list of accepted operators and functions

https://docs.blender.org/manual/en/latest/animation/drivers/drivers_panel.html#simple-expressions

If (like me) you are not used to programming it is best to stick to these simple expressions for the moment.

If you are interested in programming and want to add more complex stuff you can also import other python modules, I think you would have to enable python script execution so do be careful!
“With great power comes great responsibility”

There are many tutorials to get you introduced to drivers and simple expressions.

Google “Blender drivers python expressions”

If you want information on a specific aspect you can Google “Blender drivers if else” for example.

Apart from the videos some “stack exchange” or “blender artists” answers are very good as well.

1 Like