Visible if: display/hide inputs and outputs with conditions
When Exposing Parameters, you may want to hide or show parameters based on the status of other parameters. For example a slider only showing when a Button is turned on; it has no effect otherwise and might confuse user.
With Visible If you can add conditions to parameter visibility, keeping a clean, functional UI.Visible If works for Parameters as well as for Input and Output nodes (connections) on Graphs. Complex conditions are possible, but you need to write your own logical expressions for Visible If.
Visible If functionality work inside the Substance 3D ecosystem. Some Integrations such as Maya support it as well, but not all of them. If unsupported, the parameters will always be visible.
Writing "visible if" expressions
Accessing input parameters
Any Visible If Expression will need to use at least one input, this can be done through the following syntax:
input["identifier"]
Available operators
The "Visible if" fields accepts the following parameters:
- Boolean, Float and Integer inputs.
- true and false values (case sensitive, no caps!)
- .x : access the subparameter
- && : and
- || : or
- ! : not
- <, >, <=, >=, ==, != : comparison
- () : brackets
Must always evaluate to booleans
A Visible If Expression is used as the condition for an "IF" statement, that means it must always result in true or false. An Integer or Float value will result in an error.
- For a Boolean input, you can directly evaluate it as the condition. A simple button with a boolean value requires no more than this. See below examples, first case.
- For any parameter value other than booleans, you must add additional comparison operators. See above for comparison operators, below for examples.
Examples
Condition ("If") | Formula | Note |
---|---|---|
"MyInput" is set to True |
| MyInput is a boolean |
"MyInput" is set to False |
| MyInput is a boolean |
The value of "MyInput" is lower than 3 |
| MyInput is a Float1 or Integer1 |
The value of "param1" is equal to 2 |
| param1 is a Float1 or Integer1 |
The Y value of "MyInput" is lower than 3 |
| MyInput is a Floatx or Integerx where x>=1 |
"param1" OR "param2" is set to True |
| param1 and param2 are booleans |
"param1" is higher than 0 AND "param2" is higher than 1 |
| param1 and param2 are a Float1 or Integer1 |