Results 1 to 6 of 6
  1. #1

    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.

    Click image for larger version. 

Name:	Unbenannt.JPG 
Views:	6 
Size:	133.1 KB 
ID:	494017

    Click image for larger version. 

Name:	Unbenannt1.JPG 
Views:	4 
Size:	20.9 KB 
ID:	494018

    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
    Last edited by VANDERHORST; 07-Aug-17 at 10:24.



  2. #2
    Member Hadriscus's Avatar
    Join Date
    Apr 2012
    Location
    Massilia, France
    Posts
    1,288
    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 : http://pasteall.org/blend/index.php?id=47374 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.

    Hadrien



  3. #3
    Thanks a lot

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

    Click image for larger version. 

Name:	Unbenannt.JPG 
Views:	5 
Size:	141.8 KB 
ID:	494040



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

    Click image for larger version. 

Name:	Unbenannt.JPG 
Views:	5 
Size:	219.6 KB 
ID:	494049

    have to investigate more time


    AAAhhhhhh got it has to be inside.....

    Name:  Unbenannt.JPG
Views: 20
Size:  19.4 KB
    Last edited by VANDERHORST; 07-Aug-17 at 09:30.



  5. #5
    Member Hadriscus's Avatar
    Join Date
    Apr 2012
    Location
    Massilia, France
    Posts
    1,288
    Cool ! All is good ?



  6. #6
    yep all is fine at the moment but im sure knew problems will come
    thanks again



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •