Page MenuHome

Add a simple Switch node
Closed, ResolvedPublicTO DO

Description

Implement a simple *first iteration* of a switch node that only supports to be based on a boolean primary input to switch between two secondary inputs.
(It is planned to get this based on an index integer with variable amount of secondary inputs, but there needs to be a solid design for that first. The multi-input socket is currently not suitable when the order matters.)

The name of the output socket should depend on the set type.

The enum to choose the type of the output and secondary inputs should contain the following options:

  • Float (default)
  • Integer
  • Boolean
  • Vector
  • Color
  • String
  • Geometry
  • Object
  • Collection

Implementation:

Revisions and Commits

Related Objects

Event Timeline

imho switch node need integer variable as index input (not binary thing)
and multiinput socket for:
Integer
Boolean
Vector
Color
String
Geometry
Object
Collection

imho switch node need integer variable as index input (not binary thing)
and multiinput socket for:
Integer
Boolean
Vector
Color
String
Geometry
Object
Collection

Hard agree! It should still handle binary switches but being able to switch between many different versions of geometry is just as crucial if not more than the merge node accepting more than one item.

@Some User (someuser) @astrand130
Note:

simple first iteration

It is planned to support a variable amount of inputs in the future, but there needs to be a solid design for that first. The multi-input socket is currently not suitable when the order matters.
For now this is just a first step to get the binary functionality as a node faster.

I updated the description of the task to make this more clear.

Posting this mockup of how a more advanced version of this node would be. (shared it on blender.chat but keeping it here for later reference)

Basic design on the left. Possible look when connected on the right, with a subtle highlight on the matching socket. And socket number displayed when connected.

Posting this mockup of how a more advanced version of this node would be. (shared it on blender.chat but keeping it here for later reference)

Basic design on the left. Possible look when connected on the right, with a subtle highlight on the matching socket. And socket number displayed when connected.

I think it should not have separate input sockets as we've already got the multi input sockets with the Join node. Perhaps it could have the multi input socket and highlight the connecting noodle to show which one is selected?
That might be slightly an accessibility concern if it's not clear which input is live or how to reorder inputs but maybe better than adding another UI design.

please add this in the shader node too!

please add this in the shader node too!

I think in shader nodes, we already have the Mix RGB and Mix Shader for similar usage. It is just that in Geometry Nodes' context, a "switch" makes more sense than a "mix", imho

please add this in the shader node too!

I think in shader nodes, we already have the Mix RGB and Mix Shader for similar usage. It is just that in Geometry Nodes' context, a "switch" makes more sense than a "mix", imho

Of course the mix node can do the job. It's just like the relationship between "switch case" and "if else" in programming languages. It tides up the node tree and make it more readable and much eaiser to manage.
In shader nodes, say I want to make a material for 100 photo, which are made of the same paper, the only difference is that their content differs. In this example you could tweak one as standard and use it to duplicate 100 materials. What if you want to change the roughness or any other mat?
Then comes the mix node, use object id as the mix factor to recursivly mix between 100 photo. While the node tree will be to long to read and manage.

There is some discussion regarding the name.

Dalai Felinto (dfelinto) changed the task status from Needs Triage to Confirmed.Mon, May 3, 2:36 PM
Dalai Felinto (dfelinto) closed this task as Resolved.Mon, May 10, 2:02 PM