Skip to content

Add Blueprint-style execution flow with white arrow pins - #33

Merged
Konstantysz merged 20 commits into
mainfrom
feature/execution-flow-pins
Nov 22, 2025
Merged

Add Blueprint-style execution flow with white arrow pins#33
Konstantysz merged 20 commits into
mainfrom
feature/execution-flow-pins

Conversation

@Konstantysz

Copy link
Copy Markdown
Owner

Summary

Implements Unreal Engine Blueprint-style execution flow system with visual white execution pins (rendered as arrows) to control node execution order, separate from data flow connections.

Key Changes

Core Infrastructure

  • Node base class: Added execution pin management (CreateExecutionInputPin/OutputPin, GetExecutionInputPins/OutputPins)
  • NodeEditor orchestration: Implements execution flow traversal with automatic entry point detection (nodes with execution outputs but no inputs)
  • Type system: New PinType enum (Execution/Data) and PinDataType::Execution for proper type differentiation

Visual Rendering

  • Execution pins as arrows: White triangle arrows (→) rendered in dedicated horizontal row at top of nodes
  • Data pins as circles: Colored circles remain in vertical columns below execution row
  • Separate rendering paths: RenderExecutionPinRow() for horizontal arrow layout, RenderPinsInColumn() for vertical data pins
  • Position detection: Updated FindPinAtPosition() and GetPinWorldPosition() to handle execution pins in horizontal row vs data pins in columns

Node Integration

  • All 15 Vision nodes: Added execution input ("Execute") and output ("Then") pins to ImageInput, Grayscale, Threshold, Canny, CvtColor, MedianBlur, Sobel, Morphology, Resize, SplitChannels, MergeChannels, ImageOutput, Preview
  • Automatic entry points: Nodes with only execution outputs (e.g., ImageInput) auto-detected as graph entry points—no separate BeginPlay node needed

Technical Details

Execution Flow Logic (NodeEditor.cpp):

  1. Build execution connection map from white wire connections
  2. Detect entry points: nodes with execution outputs but no execution inputs
  3. BFS traversal following execution connections to build ordered execution path
  4. Execute nodes in order, processing data flow at each step

Rendering Architecture:

  • Execution pins: Horizontal row, white arrows, positioned at (nodeX ± padding, titleY + padding + rowHeight/2)
  • Data pins: Vertical columns, colored circles, offset by executionRowHeight + spacing when execution pins present
  • Arrow geometry: Right-pointing triangle with vertices (x+size/2, y), (x-size/2, y-size/2), (x-size/2, y+size/2)

Visual Consistency:

  • White execution wires control "what executes next"
  • Colored data wires control "what data flows where"
  • Matches Unreal Engine Blueprint visual language

Testing

  • Execution pins render correctly as white arrows
  • Data pins render correctly as colored circles below execution row
  • Hover/active states work for both pin types
  • Pin position detection accurate for both execution and data pins
  • All Vision nodes have execution pins without breaking existing functionality
  • Entry point auto-detection works (nodes without execution inputs)

Breaking Changes

None. Existing graphs without execution connections continue to work via data-only topological execution.

Future Work

  • Conditional execution nodes (Branch, ForEach, While)
  • Multi-output execution nodes (Sequence, Switch)
  • Execution pin validation rules (prevent invalid connections)

@github-actions

github-actions Bot commented Nov 21, 2025

Copy link
Copy Markdown

📊 Test Coverage Report

✅ Coverage report generated successfully

Coverage Statistics

Metric Coverage
Lines 82.82%
Functions 87.98%
Regions 90.16%

📁 Full HTML Report

Konstantysz

This comment was marked as resolved.

Konstantysz

This comment was marked as resolved.

- Removed dead code: currentNodeIndex was declared but never used
- Added override keyword to GetType() methods in test classes
- Remove existing execution connections before adding new ones
- Prevents invalid graphs from API calls and deserialization
- Makes cycles mathematically impossible
- Data connections maintain 1:N behavior (one input, many outputs)
- Acquire graphMutex to prevent race conditions
- Ensures safe access to nodes and connections during plan compilation
- Uses recursive_mutex so nesting with Execute() is safe
- Change storage from vector to unordered_set
- Replace std::find with count() for lookups
- Use insert() instead of push_back()
- Get methods convert back to vector for API compatibility
- Verify execution order size matches expected node count
- Provides fail-safe even if 1:1 enforcement has bugs
- Catches edge cases and regressions early
- Test execution flow follows execution connections not data dependencies
- Test 1:1 enforcement for both input and output execution pins
- Test entry point detection (nodes with output but no input)
- Test data connections still allow 1:N (multiple outputs)
- Test error when execution pins are unconnected
- Test cycle prevention through 1:1 enforcement
- Test defensive cycle detection validation
- Test mixed graphs with legacy nodes still work
- 11 new test cases covering all critical execution flow scenarios
@Konstantysz
Konstantysz merged commit d8ec8bf into main Nov 22, 2025
7 checks passed
@Konstantysz
Konstantysz deleted the feature/execution-flow-pins branch November 22, 2025 07:41
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