Skip to content

Add input/output data flow system for node-based visual scripting#7

Draft
Copilot wants to merge 16 commits intodevelopfrom
copilot/update-node-linking-functionality
Draft

Add input/output data flow system for node-based visual scripting#7
Copilot wants to merge 16 commits intodevelopfrom
copilot/update-node-linking-functionality

Conversation

Copy link

Copilot AI commented Feb 2, 2026

Extends the sequential execution model with parallel data flow. Nodes can now define typed input/output slots that pass values between nodes, independent of execution order (Previous/Next).

Data Structures

TriggerNode extended with:

  • Guid Id - unique identifier for link references
  • List<InputVariable> Inputs - typed input slots with optional source link
  • List<OutputVariable> Outputs - typed output slots
  • DynamicArguments - fallback values when inputs unlinked
  • List<string> AllowedEventModes - validation metadata

InputVariable structure:

public class InputVariable {
    public string Name { get; set; }
    public string Type { get; set; }
    public Guid? LinkedOutputNodeId { get; set; }
    public string LinkedOutputName { get; set; }
    public bool IsLinked => LinkedOutputNodeId.HasValue;
}

Metadata Format

Added !Inputs, !Outputs, !EventModes tags to Lua catalog:

-- !Inputs "newPosition, Vector3, Position to set"
-- !Outputs "position, Vector3, Current position"  
-- !EventModes "OnLoop"

ScriptingUtils parses metadata into InputVariableLayout/OutputVariableLayout, populates NodeFunction. VisibleNodeBase.ResetArguments transfers to TriggerNode instances.

Connection Management

NodeEditor API:

  • LinkInputToOutput(sourceNode, outputName, targetNode, inputName) - creates data link
  • UnlinkInput(node, inputName) - removes link, falls back to argument
  • ValidateNodeEventMode(node, eventMode) - shows warning dialog if incompatible

Priority rule: Linked input value overrides manual argument value. Input name matches function parameter name for binding.

Interactive UI

Grip layout follows then/else pattern - horizontal spreading at same Y:

    [in1]     ○     [in2]      ← y=0 (inputs left/right, Previous center)
  ┌──────────────────────┐
  │       NODE           │
  └──────────────────────┘
   [out1]    ○    [out2]      ← y=Height (outputs left/right, Next center)

SpawnGrips() distributes inputs/outputs across left/right thirds, Previous/Next at center. Grip array: [inputs..., Previous, outputs..., Next, Else].

Mouse handlers extended:

  • Drag from output grip → drop on input grip creates link
  • ValidConnection() prevents invalid connections (input→input, to already-linked input)
  • GripToConnectionMode() maps grip index to dynamic ConnectionMode enum (InputBase+N, OutputBase+M)
  • UpdateArgumentControlStates() disables UI controls for linked inputs

Visual feedback:

  • DrawInputOutputLabels() renders slot names (inputs above node, outputs below)
  • DrawInputOutputLinks() draws connection lines from source output to target input

Bug Fixes

  • Null guards in SpawnGrips()/GripToConnectionMode() for initialization sequence (Node null during InitializeComponent→SetSize→OnResize)
  • Input labels positioned above node (y = node.Y - offset) instead of below
  • Grip separation: inputs y=-18, outputs y=Height+6 prevents overlap with Previous/Next

Documentation

Added guides: Sample Input-Output Nodes.lua, HOW_TO_USE_INPUTS_OUTPUTS.md, MULTIPLE_INPUTS_OUTPUTS_EXAMPLE.md, FAQ_INPUT_LINKING.md, PARAMETER_MAPPING.md

Original prompt

Based on the source code and the current understanding of the Tomb Editor's node system, the following observations and next steps can help finalize your requirements:

Observations
Existing Node Linking Functionality:

Nodes are linked sequentially, and a node can only have one Next node. There is special handling for conditional nodes (e.g., Else links).
The NodeEditor class has methods for managing node linking (e.g., LinkToSelectedNode, LinkSelectedNodes) and graphical updates (e.g., DrawVisibleNodeLink).
Data Structure to Represent Nodes:

Nodes likely belong to a class like TriggerNode. It already supports Previous and Next properties, but it does not seem to have properties for input/output variables or metadata attributes.
Dynamic Inputs and Arguments:

The current system does not explicitly support dynamic variables for inputs or outputs. Arguments are also not clearly exposed for modification or visualization.
Event Metadata:

The NodeEditor_DefaultEventMode property suggests that some default for event mode is configurable, but the node classes and their editor features would need updates for event-type checks.
Finalized Requirements Draft

  1. Linking System Overhaul
    Support for Multiple Input and Output Variables:
    Nodes should have explicit fields for input and output variable slots (e.g., List Inputs, List Outputs).
    Dynamic Argument Fallback:
    If no linked input is available, the field should fall back to read user-defined arguments.
    Arguments should visibly show whether their value is user-set or dynamically linked from another node.

  2. Graphical Node Editor Updates
    UI Changes:
    When linking nodes:
    Display clear labels (e.g., “Input variable linked to Output A of Node X” or “Input not linked – using Argument Y”).
    Update the node’s settings dynamically in the UI when an input link is created or removed.
    Node Highlighting:
    Visually emphasize input/output slots to facilitate linking.
    Error and Information Warnings:
    When arguments are used instead of links, provide a subtle notification.

  3. Metadata Signature for Event Compatibility
    Introduce a metadata attribute AllowedEventModes: List for each node type.
    Examples: ["OnVolumeEnter", "OnLoop", "Global"].
    Validation on Usage:
    When placing a node in an event context:
    Show a warning (e.g., “Node not explicitly designed for Global events”), but allow placement.
    Integration with Current Workflow:
    Metadata validation should integrate seamlessly into the editor's default behaviors.
    Required Changes to Code

  4. Extend TriggerNode
    C#
    public class TriggerNode
    {
    public List Inputs { get; set; }
    public List Outputs { get; set; }

    public DynamicData DynamicArguments { get; set; }
    public List AllowedEventModes { get; set; }
    // ...
    }

  5. Modify NodeEditor for UI Behavior
    Update LinkToSelectedNode and LinkSelectedNodes to handle input/output variables.
    Add logic to switch arguments dynamically between user-defined and linked states.

  6. Add Metadata Checks During Node Placement
    Check AllowedEventModes before placing a node in the editor:
    C#
    if (!AllowedEventModes.Contains(currentEventMode))
    {
    ShowWarning("Node not supported for this event. Proceed with caution.");
    }
    These updates should encapsulate all aspects of your requirements. Would you like me to draft any specific code or further refine any details?


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 2, 2026 16:51
…ystem

Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
…prove hash code calculation

Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title [WIP] Update node linking functionality in the Tomb Editor Add input/output variable system and event mode validation to node graph Feb 2, 2026
Copilot AI requested a review from TrainWrack February 2, 2026 16:55
Copilot AI and others added 3 commits February 2, 2026 17:37
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
… modes

Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Add input/output variable system and event mode validation to node graph Add node input/output variable system with event mode restrictions Feb 2, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Add node input/output variable system with event mode restrictions Add examples for multi-input/output node linking Feb 2, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Add examples for multi-input/output node linking Document input/argument resolution priority in node system Feb 2, 2026
Copilot stopped work on behalf of TrainWrack due to an error February 2, 2026 20:50
Copilot stopped work on behalf of TrainWrack due to an error February 2, 2026 20:54
Copilot AI and others added 2 commits February 3, 2026 02:23
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Document input/argument resolution priority in node system Fix Id setter accessibility and document input-to-parameter mapping Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Fix Id setter accessibility and document input-to-parameter mapping Implement UI rendering and validation for node input/output system Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Implement UI rendering and validation for node input/output system Implement input/output data flow system for visual scripting nodes Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Implement input/output data flow system for visual scripting nodes Fix NullReferenceException in node initialization Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Fix NullReferenceException in node initialization Fix grip overlap preventing multi-slot input/output connections Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Fix grip overlap preventing multi-slot input/output connections Add input/output variable linking system for node-based visual scripting Feb 3, 2026
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Copilot AI changed the title Add input/output variable linking system for node-based visual scripting Add input/output data flow system for node-based visual scripting Feb 3, 2026
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.

2 participants