refactor: separate NodeTree data from rendering with snapshot-based evaluation#1484
refactor: separate NodeTree data from rendering with snapshot-based evaluation#1484
Conversation
… subclasses in SourceGenerator
…eTreeEvaluator, InputSocketHelper)
…ew rendering system
… RandomFloat) for new rendering system
…t, Rect, RelativePoint, Size) for new rendering system
There was a problem hiding this comment.
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>, andNodeRenderContextclasses - Updated source generator to detect socket properties in Node subclasses and generate automatic
ItemValuebindings - Removed legacy evaluation system (
NodeTreeEvaluator,NodeEvaluationContext,InputSocketHelper) and updated all node implementations to useResource.Update()pattern - Modified base classes:
NodeTreeModelnow inherits fromEngineObject, socket interfaces simplified by removingReceive()and evaluation methods - Added nullable string support to
TryParsemethods and madeRenderContext.Getvirtual 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.
There was a problem hiding this comment.
💡 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".
…tyBackedInputSocket
…odeTreeModel and GroupNode
|
No TODO comments were found. |
Minimum allowed line rate is |
Description
This PR redesigns the NodeTree evaluation system to use a snapshot-based approach, separating data from rendering:
NodeTreeSnapshot,ItemValue,NodeRenderContext) underNodeTree/Rendering/ItemValueHelperfor creating type-specificIItemValueinstancesSourceGeneratorto detect socket properties in Node subclasses and generateItemValuebindings automaticallyIInputSocketandINodeIteminterfaces by removing runtime value passing methodsNodeEvaluationContext,NodeTreeEvaluator,InputSocketHelper)RenderContext.Getmethod virtual for extensibilityBreaking changes
IInputSocket.Receive()method removedINodeItem.Value,PreEvaluate(),Evaluate(),PostEvaluate()removedINodeItem.CreateItemValue()added as replacementISupportSetValueNodeIteminterface removedNodeEvaluationContext,NodeTreeEvaluator,InputSocketHelperclasses removedFixed issues
None