1
$\begingroup$

I'm trying to set up a driver for an object that uses an integer property from a panel in a custom addon as its data path, to basically control the visibility of the object within a range. So for example, if the slider is set to 1, make the object visible, but if its 0 or any number higher than 1 then hide it. So Far I've managed to find expressions that set up a min and max such as:

max(0, 1 - var)

but it only works until it hits it max and then it stays visible. I'm still new to expressions, what could I add to this to make it a range basically, or would it be better if its an if statement?

Thank you

$\endgroup$
2
$\begingroup$

You can use the expression var != 1 which will evaluate to False if var is 1 or True in any other case.

Example :

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ awesome! thank you I actually just found this expression works too, but it seems to be a more complicated version of yours hahaha 1 if 1-var else var == 0, though I'm still trying to understand how my expression worked lol $\endgroup$ – bgall44 Jun 26 '20 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.