Feat – Engine gets 'active node ports’, enabling performant 'Switch' node#191
Draft
tobyspark wants to merge 4 commits into
Draft
Feat – Engine gets 'active node ports’, enabling performant 'Switch' node#191tobyspark wants to merge 4 commits into
tobyspark wants to merge 4 commits into
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.