Switch

The Ultimate Houdini node reference

Visit the Node Bible

To learn more, please log in or sign up for free to explore the Node Bible.
Write your awesome label here.

Switch

Write your awesome label here.

The Switch allows you to control which node tree will be output from the connected inputs.  

Drag to resize

Summary:

    The Switch node is responsible for deciding which node tree ought to be used.  You can visually tell which input is being used by seeing the solid line that's activated.  If the connected input has a dotted line, then it is not active.  This gets used all the time when building HDAs, creating effects that are triggered by something, or previewing multiple node tree setups conveniently.  The first input has an index of 0, the next input has an index of 1, and so on....

Drag to resize

Main Parameters:


Select Input:

--  This correlates with the index that is activated.  To control this, you'll want to utilize expressions which control the index that's being used.  Most of the time, when writing expressions, you'll want to say that something is either "true" (where the index val = 1) or "false" (where the index val = 0).  You can also achieve these true/false conditions with the Switchif node.

--  If, however, you want to procedurally switch for an index beyond 1, it is recommended that you calculate the input value in vex with a wrangle and then copy --> paste rel reference the resulting index value to the switch.  A great example of this can be found by exploring this forum post:

https://www.sidefx.com/forum/topic/75962/

--  Also, don't forget that you can always keyframe the index value as well.