From bd3b441796d7b2ca32d5391a807e953dda1a4223 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Thu, 16 Jul 2026 02:52:39 -0700 Subject: [PATCH] Consolidate the rank promotion and cache chain registrations behind one value-type list --- .../interpreted-executor/src/node_registry.rs | 149 ++++++++---------- 1 file changed, 69 insertions(+), 80 deletions(-) diff --git a/node-graph/interpreted-executor/src/node_registry.rs b/node-graph/interpreted-executor/src/node_registry.rs index c7f0bc5c80..162f4a54e3 100644 --- a/node-graph/interpreted-executor/src/node_registry.rs +++ b/node-graph/interpreted-executor/src/node_registry.rs @@ -4,6 +4,7 @@ use graph_craft::application_io::PlatformEditorApi; use graph_craft::application_io::resource::Resource; use graph_craft::document::value::RenderOutput; use graph_craft::proto::{NodeConstructor, TypeErasedBox}; +use graphene_std::animation::RealTimeMode; use graphene_std::any::DynAnyNode; use graphene_std::brush::brush_stroke::BrushTrace; use graphene_std::extract_xy::XY; @@ -17,11 +18,14 @@ use graphene_std::raster::color::Color; use graphene_std::raster::*; use graphene_std::raster::{CPU, Raster}; use graphene_std::render_node::RenderIntermediate; +use graphene_std::text::{Font, TextAlign}; use graphene_std::text_nodes::StringCapitalization; use graphene_std::transform::{Footprint, ReferencePoint, ScaleType}; -use graphene_std::vector::misc::{BooleanOperation, BoxCorners, CentroidType, ExtrudeJoiningAlgorithm, InterpolationDistribution, MergeByDistanceAlgorithm, PointSpacingType, RowsOrColumns}; +use graphene_std::vector::misc::{ + ArcType, BooleanOperation, BoxCorners, CentroidType, ExtrudeJoiningAlgorithm, GridType, InterpolationDistribution, MergeByDistanceAlgorithm, PointSpacingType, RowsOrColumns, SpiralType, +}; use graphene_std::vector::style::{DashPattern, GradientSpreadMethod, GradientType, PaintOrder, StrokeAlign, StrokeCap, StrokeJoin}; -use graphene_std::vector::{Vector, VectorModification}; +use graphene_std::vector::{QRCodeErrorCorrectionLevel, Vector, VectorModification}; use graphene_std::{Artboard, Context, Graphic, NodeIO, NodeIOTypes, ProtoNodeIdentifier, concrete, fn_type_fut, future}; use node_registry_macros::async_node; use std::collections::HashMap; @@ -314,6 +318,58 @@ fn node_registry() -> HashMap { + $register!( + i32, + i64, + BlendMode, + StrokeJoin, + StrokeAlign, + StrokeCap, + PaintOrder, + GradientType, + GradientSpreadMethod, + DashPattern, + BoxCorners, + MergeByDistanceAlgorithm, + ExtrudeJoiningAlgorithm, + PointSpacingType, + StringCapitalization, + LuminanceCalculation, + RedGreenBlue, + RedGreenBlueAlpha, + RelativeAbsolute, + SelectiveColorChoice, + BrushTrace, + XY, + ScaleType, + ReferencePoint, + CentroidType, + BooleanOperation, + NoiseType, + FractalType, + CellularDistanceFunction, + CellularReturnType, + DomainWarpType, + RealTimeMode, + GridType, + ArcType, + SpiralType, + TextAlign, + QRCodeErrorCorrectionLevel, + Font, + InterpolationDistribution, + RowsOrColumns, + Resource, + ) + }; + } + // Primary element types (graphical data and scalars) get promotion adapters here; their monitor/memoize rows are the + // explicit ones near the top of the registry, so they are deliberately absent from the shared value-type list above node_types.extend(rank_adapter_nodes!( Vector, Raster, @@ -324,44 +380,18 @@ fn node_registry() -> HashMap, - XY, - ScaleType, Footprint, - ReferencePoint, - CentroidType, - BooleanOperation, - InterpolationDistribution, - RowsOrColumns, Artboard, - Resource, )); + node_types.extend(ranked_value_types!(rank_adapter_nodes)); + // The nested-generic `Box` registers directly rather than through the shared callback, since the + // extra macro layer mangles the `stringify!` whitespace in its adapter identifier; its cache chain is likewise direct below + node_types.extend(rank_adapter_nodes!(Box)); #[cfg(feature = "gpu")] node_types.extend(rank_adapter_nodes!(Raster)); // Type-erased rows for the `ListDyn` connectors (`Read Attribute`, `List Length`): any `List` wire erases its element type @@ -421,9 +451,9 @@ fn node_registry() -> HashMap)); - // The compiler wraps a ranked connector's broadcast sibling in a Memoize plus context nullification pair, and the editor's test - // instrumentation monitors any wire, so all three must pass through every ranked element type the hand lists above omit. - // The identifiers are passed explicitly because `stringify!` mangles whitespace when the path tokens come through this nested macro layer. + // The memoize + monitor + context-nullification triple for each value type in the shared list above: the compiler wraps + // a ranked connector's broadcast sibling in a Memoize + context-nullification pair, and test instrumentation monitors any wire. + // Node identifiers are passed explicitly since `stringify!` would mangle the path's whitespace through this nested macro. macro_rules! cache_chain_nodes { (each: $value:ty) => {{ let entries: Vec<(ProtoNodeIdentifier, NodeConstructor, NodeIOTypes)> = vec![ @@ -442,50 +472,9 @@ fn node_registry() -> HashMap, - graphene_std::text::Font, - InterpolationDistribution, - RowsOrColumns, - Resource, - )); + node_types.extend(ranked_value_types!(cache_chain_nodes)); + // The direct counterpart to `Box`'s promotion adapter above (see that note) + node_types.extend(cache_chain_nodes!(Box)); // A position wire may feed a ranked vector connector, each position becoming a single-anchor vector node_types.extend(input_adapter_row!(from_element: DVec2, element: Vector)); // A string wire may feed the ranked `Item` dash connector by parsing each element into a dash pattern