Some questions about driver scripted expression


Hi folks,

at the moment driver scripted expression give me a hard time and hopefully someone can help to figure out how does it work.

Here are the questions.

  1. How can this expression can be written in the text editor (python) instead of the small textarea ?
  2. How can be another if else statement (var if (var<4.461+var_neg) else (4.461+var_neg)) added to the first one ?

Thanks in advanced

(Hadriscus) #2

Hi Vanderhorst,

for anything more than one-liners you need to use the text editor - python works with identation and there can be no indentation on a single line. Your condition must be in the body of your function inside the text editor, and you need to call it through the text field in the driver panel. Example : Press play and move ctrl2 to see how the scale of the object is affected by either ctrl1 or ctrl2 depending which one is closer. The expression calls the function with its name and sends it the x locations of both the bones, added as variables in the driver panel. The function then returns the distance of the closest bone and this value is mapped to the driver curve.



Thanks a lot

after a lot of tries and errors i figured it out with your help and made my first small babysteps.


tried to add another statment but no luck dont know how to add the second if statment

have to investigate more time

AAAhhhhhh got it has to be inside…

(Hadriscus) #5

Cool ! :slight_smile: All is good ?


yep all is fine at the moment but im sure knew problems will come:eyebrowlift:
thanks again