Houdini 11 Nodes Surface nodes

Switches between network branches based on an expression or keyframe animation.

This node passes the input specified in the Select input parameter to the output. The input numbering starts at 0. You can control the parameter with an expression or animate it.

For example, you could use the expression $F - 1 to switch to the first input at frame 1, the second input at frame 2, and so on. Use the expression ($F >= 5) to use the first input for the first five frames, and the second input afterward (boolean operators such as >= return 0 for false and 1 for true, so the switch will select input 0 when the expression is false and input 1 when the expression is true).

Tip

Often, you can use a Switch in a network that could potentially have errors to bypass the failing nodes. One way to do this is to use the following expression in the Select input parameter:

if (strmatch("*Error:*", run("opinfo " + opfullpath("../" + opinput(".", 1)))), 0, 1)
With this expression, the switch will use the second input, unless it has an error, in which case it will switch to the first input.

The expression gets the operator info string (using run expression function to call the opinfo HScript command) of the second input (opinput(".", 1). The inputs are zero-based, so 1 refers to the second input). If strmatch finds an error string, the if function returns 0 (use first input), otherwise it returns 1 (use second input).

Parameters

Select Input

The input number (starting at 0) to pass to the output. You can use an expression to control this or animate the parameter value.