Skip to content

Feat – Engine gets 'active node ports’, enabling performant 'Switch' node#191

Draft
tobyspark wants to merge 4 commits into
Fabric-Project:mainfrom
tobyspark:feat-activeNodePorts-switch-node
Draft

Feat – Engine gets 'active node ports’, enabling performant 'Switch' node#191
tobyspark wants to merge 4 commits into
Fabric-Project:mainfrom
tobyspark:feat-activeNodePorts-switch-node

Conversation

@tobyspark

Copy link
Copy Markdown
Contributor

A node to switch between various inputs, per an index input.

Ideally this should “turn on and off” the different branches of the graph connected to the switch node. The GraphRenderer previously would traverse all input ports of a node, this PR adds the concept of ‘active ports’ to make this possible.

Introduces activeInputNodes() on Node — an open method the graph renderer
uses instead of inputNodes to determine which upstream nodes to evaluate.
Default returns all inputs (no behaviour change for existing nodes).

SwitchNode overrides this to only pull the branch matching the selected
index, so unselected upstream subgraphs are never executed.
Settings view (gear icon) allows configuring:
- Input count (2–16) with dynamic port add/remove
- Port type (Any, Bool, Int, Float, String, Vector 2/3/4, Color, Image)

Typed inputs use ParameterPort with inspector widgets (input fields,
color picker, buttons) so values can be set directly. Fixes dynamic
port management to use registry keys consistently.
@tobyspark tobyspark marked this pull request as draft March 14, 2026 00:47
@tobyspark

Copy link
Copy Markdown
Contributor Author

Marked as draft. This will definitely need some more testing and likely some discussion. In QC-speak, this node is ‘multiplexer’, and that might yet be a better name. Switch is more discoverable, but doesn’t pair with the opposite ‘demultiplexer’.

FWIW, I made this along the way doing my app, but ended up not needing it as I hardcoded the logic I needed this node for elsewhere. Used multiplexers all the time in QC though.

When the port type is known (not Virtual), forward values directly
between typed NodePort<T> instances instead of going through the
PortValue box/unbox path. Avoids indirect enum heap allocation per
switch per connection per frame.
Host apps need to configure SwitchNode programmatically (e.g. building
a source selection pipeline), not just via the settings view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant