Switch-If

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-If

Write your awesome label here.

The Switch-If acts just like the switch node.  It allows you to choose which node tree you would like to use between two inputs based on some sort of criteria.

Drag to resize

Summary:

    The Switch-If node acts just like the Switch SOP except that it only allows you to use two inputs, and it provides you a nice set of built-in criteria for switching between input 0 and 1.  "This node also lets you test certain aspects of the incoming geometry, and also combine multiple tests using "All conditions true" (AND) or "Any conditions true" (OR) logic."  That means you can run multiple tests on the incoming geometry for determining when it switches over to the second input.

Drag to resize

Main Parameters:


Use Second Input If:

--  All Conditions True
    ** All tests must be true for it to switch to the second input.

--  Any Condition True
    **  If one test rings true, then it switches to the second input.

--  All Conditions False
    **  All tests must return "false" for it to switch over to the second input.

--  Any Condition False
    **  If one test rings false, then it switches to the second input.

Test Input:

--  When running tests, which input should this node look at?  As an example, if you want to see if an attribute returns a string value of "foo", then you'll need to tell the Switch-If node where it should look for this attribute.  It could try reading it from the first input, the second input, or a Spare Input 0.

--  If you are using "Spare Input 0", then you'll want to drag-and-drop the node's path to the spare input 0 parameter.  You'll see this connected by a purple dotted wire.

Test Type:

--  Expression
    **   The expression that you place in the "Enable" box will return either true or false.  You can keyframe that or write an expression.  As an example, you could say something like $F>20 and the resulting value will be true starting on frame 21+  This basically acts just like an expression that you would place within a switch node.

--  Attribute Presence
    **  This checks to see if an attribute (or multiple attributes) are present or absent.  You can specify multiple attributes by typing them in the "Attributes" box.  Just be sue to separate out attribute names with a space and do not use commas.  "All attributes present" means that all the attributes that you place in that box need to be there in order for the second input to be used.  "Any attributes present" means that it just need to match one of the attributes that you put in that Attributes box.  

--  Element Count
    **  This is super useful when you want to return a true or false based on the number of points, primitives, or vertices.  You can also tell it to look at a specific group of points/prims/verts when counting with the "In Group" field.  And you can specify the Equal to, Not equal to, grater than, etc... along with the point count in the value parameter.

--  Attribute Value
    **  If you want to trigger the True/False, based on an attribute value, then you can do so here.  

--  Input Wired
    **  This returns "True" if you decide to wire something into the Spare Input 0.