Houdini 20.5 Nodes Geometry nodes

Switch geometry node

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 four 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 python expression in the Select Input parameter:

1 if hou.pwd().inputs()[1].geometry() else 0

With this python expression, the switch will use the second input, unless it has an error, in which case it will switch to the first input. It tests if the second input (index 1) successfully cooks with geometry before returning its index.

However, the above expression doesn’t check if the geometry is empty. For example, when an Object Merge fails to find the given node path, it generates a warning and outputs empty geometry instead. We can enhance the expression to take this into account like this:

geo = hou.pwd().inputs()[1].geometry() 
1 if geo and geo.point(0) else 0

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.

Geometry nodes