Add a simple Switch node #85374

Closed
opened 2021-02-04 13:18:51 +01:00 by Simon Thommes · 23 comments
Member

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.)

image.png

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:

{F10051197, size=full}

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.) ![image.png](https://archive.blender.org/developer/F9630343/image.png) 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: {[F10051197](https://archive.blender.org/developer/F10051197/image.png), size=full}
Author
Member

Added subscriber: @SimonThommes

Added subscriber: @SimonThommes

Added subscriber: @someuser

Added subscriber: @someuser

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
Contributor

Added subscriber: @KenzieMac130

Added subscriber: @KenzieMac130
Contributor

In #85374#1107044, @someuser wrote:
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.

> In #85374#1107044, @someuser wrote: > 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.
Author
Member

@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.

@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.

Added subscriber: @MiroHorvath

Added subscriber: @MiroHorvath
Eitan Traurig self-assigned this 2021-02-17 19:41:52 +01:00
Member

Added subscriber: @pablovazquez

Added subscriber: @pablovazquez
Member

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.
{F9813701, size=full}

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. {[F9813701](https://archive.blender.org/developer/F9813701/image.png), size=full}

Added subscriber: @Erindale

Added subscriber: @Erindale

In #85374#1114542, @pablovazquez wrote:
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.
{F9813701, size=25}

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.

> In #85374#1114542, @pablovazquez wrote: > 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. > {[F9813701](https://archive.blender.org/developer/F9813701/image.png), size=25} 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.

Added subscriber: @satishgoda1

Added subscriber: @satishgoda1

Added subscriber: @guitargeek

Added subscriber: @guitargeek

This issue was referenced by 799f532f46

This issue was referenced by 799f532f4698ff07353a384ed99131042b5e05de

Added subscriber: @baoyu

Added subscriber: @baoyu

please add this in the shader node too!

please add this in the shader node too!
Contributor

Added subscriber: @Eary

Added subscriber: @Eary
Contributor

In #85374#1150079, @baoyu wrote:
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

> In #85374#1150079, @baoyu wrote: > 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

In #85374#1150095, @Eary wrote:

In #85374#1150079, @baoyu wrote:
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.

> In #85374#1150095, @Eary wrote: >> In #85374#1150079, @baoyu wrote: >> 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.

Added subscriber: @dfelinto

Added subscriber: @dfelinto

There is some discussion regarding the name.

There is some discussion regarding the name.

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
12 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#85374
No description provided.