Skip to content

Comments

refactor: separate NodeTree data from rendering with snapshot-based evaluation#1484

Merged
yuto-trd merged 32 commits intomainfrom
yuto-trd/nodetree-data-split
Feb 15, 2026
Merged

refactor: separate NodeTree data from rendering with snapshot-based evaluation#1484
yuto-trd merged 32 commits intomainfrom
yuto-trd/nodetree-data-split

Conversation

@yuto-trd
Copy link
Member

Description

This PR redesigns the NodeTree evaluation system to use a snapshot-based approach, separating data from rendering:

  • Add new rendering infrastructure (NodeTreeSnapshot, ItemValue, NodeRenderContext) under NodeTree/Rendering/
  • Add ItemValueHelper for creating type-specific IItemValue instances
  • Update SourceGenerator to detect socket properties in Node subclasses and generate ItemValue bindings automatically
  • Simplify IInputSocket and INodeItem interfaces by removing runtime value passing methods
  • Remove legacy evaluation system (NodeEvaluationContext, NodeTreeEvaluator, InputSocketHelper)
  • Update all Node implementations to use the new rendering system
  • Make RenderContext.Get method virtual for extensibility

Breaking changes

  • IInputSocket.Receive() method removed
  • INodeItem.Value, PreEvaluate(), Evaluate(), PostEvaluate() removed
  • INodeItem.CreateItemValue() added as replacement
  • ISupportSetValueNodeItem interface removed
  • NodeEvaluationContext, NodeTreeEvaluator, InputSocketHelper classes removed

Fixed issues

None

…t, Rect, RelativePoint, Size) for new rendering system
Copilot AI review requested due to automatic review settings February 14, 2026 19:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a major refactoring of the NodeTree evaluation system, transitioning from a mutable evaluation context pattern to an immutable snapshot-based approach. The new architecture separates data from rendering logic through three key components: NodeTreeSnapshot (manages topology and evaluation order), ItemValue (type-safe value containers), and NodeRenderContext (rendering-specific context).

Changes:

  • Introduced snapshot-based rendering infrastructure with NodeTreeSnapshot, ItemValue<T>, and NodeRenderContext classes
  • Updated source generator to detect socket properties in Node subclasses and generate automatic ItemValue bindings
  • Removed legacy evaluation system (NodeTreeEvaluator, NodeEvaluationContext, InputSocketHelper) and updated all node implementations to use Resource.Update() pattern
  • Modified base classes: NodeTreeModel now inherits from EngineObject, socket interfaces simplified by removing Receive() and evaluation methods
  • Added nullable string support to TryParse methods and made RenderContext.Get virtual for extensibility

Reviewed changes

Copilot reviewed 66 out of 66 changed files in this pull request and generated 29 comments.

Show a summary per file
File Description
NodeTreeSnapshot.cs Core snapshot class implementing topological sort, resource building, and value propagation
NodeRenderContext.cs Rendering context providing socket value access and renderable collection
ItemValue.cs, IItemValue.cs Generic value container with type conversion and disposal support
ItemValueHelper.cs Type-specific receiver registration for automatic type conversions
ConnectionSnapshot.cs Lightweight struct for connection data in snapshots
Node.cs Added Resource partial class with socket value binding infrastructure
Various Node implementations Updated 20+ nodes to use Resource.Update() pattern instead of Evaluate()
EngineObjectResourceGenerator.cs Extended to detect socket properties and generate bindings
InputSocket.cs, OutputSocket.cs Removed value propagation logic, simplified to data holders
NodeTreeEvaluator.cs, NodeEvaluationContext.cs Removed legacy evaluation system
TryParse methods Updated signatures to accept nullable strings
RenderContext.cs Made Get method virtual for extensibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9b76ddd76a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions
Copy link
Contributor

No TODO comments were found.

@github-actions
Copy link
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
Beutl.Editor 82% 76% 870
Beutl.Extensibility 14% 16% 100
Beutl.Operators 2% 0% 120
Beutl.Language 0% 20% 943
Beutl.ProjectSystem 13% 7% 2887
Beutl.Threading 98% 86% 122
Beutl.Engine 21% 19% 13751
Beutl.Configuration 39% 19% 288
Beutl.Utilities 73% 67% 358
Beutl.Core 40% 36% 2966
Summary 25% (13304 / 54059) 24% (3677 / 15473) 22405

Minimum allowed line rate is 0%

@yuto-trd yuto-trd merged commit 905cb4a into main Feb 15, 2026
4 checks passed
@yuto-trd yuto-trd deleted the yuto-trd/nodetree-data-split branch February 15, 2026 08:07
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