Selection Nodes#
Clarisse provides a set of powerful Selection nodes to procedurally select items based on rules:
- The Rule Set which defines a collection and hierarchy of rules.
- The Extract node which selects procedurally items based on rules to create soft-connection to items.
- The Switch node which allows to switch between multiple input connections according to a value or an expression.
New to Clarisse?
Many nodes in Clarisse use rules to target items in your scenes. To learn more about rule syntax please refer to Rule-based Inclusion/Exclusion.
Rule Set#
A Rule Set is a collection of procedural rules used by many different nodes in Clarisse to procedurally target items located in contexts. It is possible to connect multiple rule sets together to define a hierarchy of rule sets.
Attribute | Description |
---|---|
Rules | Define the rules that target items. This field supports multiple rules. |
Filter | Set the class (or type) of the items to target. |
Inputs | Set children rule sets. |
Note
It is possible to extract rule set nodes from nodes that uses rules such as Extract, Isolate or Prune nodes.
Extract#
One of the issue that can occur when making direct connections to items located in a context, is that the connection breaks if the connected item is deleted, removed or renamed. In order to solve this issue, Clarisse provides the Extract node. The Extract node allows you to target and output a specific item using a rule from an input context. This node is key to create robust and procedural builds.
Attribute | Description |
---|---|
Input Context | Input Context to extract the item from. |
Filter | Specify the class (or type) of items for which the rule is evaluated. For example, if you set the filter to Camera, the rule will only target items inheriting from the Camera class. When no filter is specified, rule is applied to all items whatever their classes. |
Rules | Define rules that target the resulting item. This field supports multiple rules. Rule evaluation stops as soon as a matching item is found. |
Rule Set | Set a rule set to use for rule resolution. |
Rule Set Mode | When set to Override (default value), the node only evaluates rules defined in the input Rule Set. When set to Merge, the rule set is merged to the rules defined by the node. |
Action | Description |
---|---|
Extract Rules | Create a new Rule Set node that includes all the rules defined in the node. |
When should you use an Extract node?#
Let’s say you are using a ReadAbc to bring a camera in. You decide to explicitly connect this camera to a Render Scene in your build. Let’s imagine now that sometimes later, this camera gets renamed in the pipeline. As a result, when the build is loaded, Clarisse will break the connection from the Render Scene to the camera as it doesn’t find it anymore.
This is where the Extract node comes to the rescue. To solve this issue, you just need to create an Extract node, connect it to the ReadAbc that brings the camera in and set its Filter attributes to Camera and Rules to *
. That way, the build isn’t broken as the Extract node acts as a proxy and will always output the first camera it finds in the ReadAbc.
Note
In the event the extract node fails to resolve an item from its rule, the extract node returns a null item. In other words using an extract node ensured connections in your build are never severed.
The Extract node also allows you to non-sequentially create procedural builds without actually having any asset or item. Consider the following example.
In this example, we have two empty ReadAbc read_env
and read_cam
which are supposed to bring respectively an environment and a camera into our build. However as you can see in this example, it is not possible to connect a camera from read_cam to the Render Scene as read_cam
doesn’t actually define any item!
To resolve this, we simply have to insert an Extract node with its Filter set to Camera.
Our build is now complete even if we don’t have any camera yet!
Switch#
The Switch node is a very useful node which allows you switch between multiple input connections. The output node resulting from a Switch node is selected according to the label set in the Active Input Label attribute.
If the label set in Active Input Label attribute matches a label bound to one input, then the matching input node is returned by the Switch. If no input matches the label then the Switch node returns the node set in Default Input.
Attribute | Description |
---|---|
Inputs | List of item and their associated labels that can be returned by the switch. |
Active Input Label | Set the label of the input connection that should be returned by the Switch. |
Default Input | Set the default output item returned by the switch when Active Input Label doesn’t match any input label. |
Example#
Let’s create a Switch that we will call cameraSelect
, connect 3 cameras cameraShot1
, cameraShot2
, cameraShot3
to Inputs attribute of our switch and another camera cameraDefault
connected to Default Input. Here is what we get:
As we didn’t set any Active Input Label nor attached any label values to our inputs, cameraSelect
always returns cameraDefault
.
Now using the Attribute Editor let’s add the following labels shot1
, shot2
, shot3
to our inputs such as this:
If we know change the Active Input Label value to shot3
such as this:
Our switch will now output cameraShot3
as seen here:
Of course, it is possible to create an expression to bind Active Input Label to a global variable named $SHOT
for example. As you can see, the switch is extremely useful to create dynamic and procedural builds that can react to expressions.