From 998cbaa69ab59fc30619fc4ee09825f62d3a32a6 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 28 Jun 2026 18:55:36 -0700 Subject: [PATCH 1/4] Box the `value` field of `NodeGraphMessage::SetInputValue` --- .../document/node_graph/node_graph_message.rs | 2 +- .../node_graph/node_graph_message_handler.rs | 2 +- .../document/node_graph/node_properties.rs | 37 +++++++++++-------- .../storage_tests/round_trip_tests.rs | 2 +- .../graph_modification_utils.rs | 14 +++++-- .../tool/tool_messages/gradient_tool.rs | 9 +++-- .../messages/tool/tool_messages/text_tool.rs | 6 +-- 7 files changed, 44 insertions(+), 28 deletions(-) diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs index 011065fd78..d7df7271fc 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs @@ -157,7 +157,7 @@ pub enum NodeGraphMessage { SetInputValue { node_id: NodeId, input_index: usize, - value: TaggedValue, + value: Box, }, SetInput { input_connector: InputConnector, diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index 970dc4faa5..5ebfb798de 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -1762,7 +1762,7 @@ impl<'a> MessageHandler> for NodeG .any(|id| *r == DefinitionIdentifier::ProtoNode(id)) }); - let input = NodeInput::value(value, false); + let input = NodeInput::value(*value, false); responses.add(NodeGraphMessage::SetInput { input_connector: InputConnector::node(node_id, input_index), input, diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index b61c33de82..c01f6cf3e0 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -47,7 +47,12 @@ pub(crate) fn string_properties(text: &str) -> Vec { fn optionally_update_value(value: impl Fn(&T) -> Option + 'static + Send + Sync, node_id: NodeId, input_index: usize) -> impl Fn(&T) -> Message + 'static + Send + Sync { move |input_value: &T| match value(input_value) { - Some(value) => NodeGraphMessage::SetInputValue { node_id, input_index, value }.into(), + Some(value) => NodeGraphMessage::SetInputValue { + node_id, + input_index, + value: value.into(), + } + .into(), None => Message::NoOp, } } @@ -901,7 +906,7 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec>::INDEX, - value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color), + value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color).into(), } .into(), ]; @@ -2586,7 +2591,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte NodeGraphMessage::SetInputValue { node_id, input_index: BackupColorInput::INDEX, - value: TaggedValue::Color(color), + value: TaggedValue::Color(color).into(), } .into(), ); @@ -2599,13 +2604,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte NodeGraphMessage::SetInputValue { node_id, input_index: FillInput::>::INDEX, - value: TaggedValue::Gradient(gradient.clone()), + value: TaggedValue::Gradient(gradient.clone()).into(), } .into(), NodeGraphMessage::SetInputValue { node_id, input_index: BackupGradientInput::INDEX, - value: TaggedValue::Gradient(gradient), + value: TaggedValue::Gradient(gradient).into(), } .into(), ]), @@ -2714,13 +2719,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte NodeGraphMessage::SetInputValue { node_id, input_index: HasTransformInput::INDEX, - value: TaggedValue::Bool(true), + value: TaggedValue::Bool(true).into(), } .into(), NodeGraphMessage::SetInputValue { node_id, input_index: TransformInput::INDEX, - value: TaggedValue::DAffine2(new_transform), + value: TaggedValue::DAffine2(new_transform).into(), } .into(), ]), diff --git a/editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs b/editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs index 5fe5c77c37..ed23c3a8bb 100644 --- a/editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs +++ b/editor/src/messages/portfolio/document/storage_tests/round_trip_tests.rs @@ -747,7 +747,7 @@ async fn none_fill_survives_document_reopen() { .handle_message(NodeGraphMessage::SetInputValue { node_id: fill_node_id, input_index: graphene_std::vector::fill::FillInput::>::INDEX, - value: graph_craft::document::value::TaggedValue::no_paint(), + value: graph_craft::document::value::TaggedValue::no_paint().into(), }) .await; assert!(fill_paint_value(editor.active_document()).is_no_paint(), "the None pick should store as no_paint"); diff --git a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs index 08341fdd89..7184cc5151 100644 --- a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs +++ b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs @@ -615,7 +615,11 @@ pub fn set_stroke_weight_for_selected_layers(weight: f64, document: &DocumentMes if let Some(node_id) = get_stroke_id(layer, &document.network_interface) { let input_index = graphene_std::vector::stroke::WeightInput::INDEX; let value = TaggedValue::F64(weight); - responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value }); + responses.add(NodeGraphMessage::SetInputValue { + node_id, + input_index, + value: value.into(), + }); } else if weight > 0. { let color = Some(Color::BLACK); let stroke = graphene_std::vector::style::Stroke::default().with_weight(weight); @@ -834,7 +838,11 @@ pub fn set_stroke_color_for_selected_layers(color: Option, weight: f64, d if let Some(node_id) = get_stroke_id(layer, &document.network_interface) { let input_index = graphene_std::vector::stroke::PaintInput::>::INDEX; let value = color.map_or_else(TaggedValue::no_paint, TaggedValue::Color); - responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value }); + responses.add(NodeGraphMessage::SetInputValue { + node_id, + input_index, + value: value.into(), + }); } else { let stroke = graphene_std::vector::style::Stroke::new(weight); responses.add(GraphOperationMessage::StrokeSet { layer, color, stroke }); @@ -904,7 +912,7 @@ pub fn set_proto_node_input_for_selected_layers( responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, - value: value.clone(), + value: value.clone().into(), }); } } diff --git a/editor/src/messages/tool/tool_messages/gradient_tool.rs b/editor/src/messages/tool/tool_messages/gradient_tool.rs index 940d7e6552..ebcb54a0a6 100644 --- a/editor/src/messages/tool/tool_messages/gradient_tool.rs +++ b/editor/src/messages/tool/tool_messages/gradient_tool.rs @@ -2159,7 +2159,8 @@ mod test_gradient { midpoint: 0.5, color: Color::BLUE, }, - ])), + ])) + .into(), }) .await; @@ -2196,7 +2197,8 @@ mod test_gradient { midpoint: 0.5, color: Color::BLUE, }, - ])), + ])) + .into(), }) .await; @@ -2839,7 +2841,8 @@ mod test_gradient { midpoint: 0.5, color: Color::BLUE, }, - ])), + ])) + .into(), }) .await; diff --git a/editor/src/messages/tool/tool_messages/text_tool.rs b/editor/src/messages/tool/tool_messages/text_tool.rs index d88c8c29fc..7642ae9442 100644 --- a/editor/src/messages/tool/tool_messages/text_tool.rs +++ b/editor/src/messages/tool/tool_messages/text_tool.rs @@ -118,7 +118,7 @@ fn create_text_widgets(tool: &TextTool, font_catalog: &FontCatalog, document: &D NodeGraphMessage::SetInputValue { node_id, input_index: graphene_std::text::text::FontInput::INDEX, - value: TaggedValue::Resource(resource_id), + value: TaggedValue::Resource(resource_id).into(), } .into(), ]), @@ -349,7 +349,7 @@ impl<'a> MessageHandler> for Text responses.add(NodeGraphMessage::SetInputValue { node_id, input_index: graphene_std::text::text::SizeInput::INDEX, - value: TaggedValue::F64(font_size), + value: TaggedValue::F64(font_size).into(), }); } } @@ -364,7 +364,7 @@ impl<'a> MessageHandler> for Text responses.add(NodeGraphMessage::SetInputValue { node_id, input_index: graphene_std::text::text::AlignInput::INDEX, - value: TaggedValue::TextAlign(align), + value: TaggedValue::TextAlign(align).into(), }); } } From e916b7b7b55cea55e42cb5f6089a368d2e470f5f Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 28 Jun 2026 19:00:32 -0700 Subject: [PATCH 2/4] Box the `ExecutionResponse` variant of `NodeGraphUpdate` --- editor/src/node_graph_executor.rs | 4 ++-- editor/src/node_graph_executor/runtime.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index c58203f714..d7f341d1f6 100644 --- a/editor/src/node_graph_executor.rs +++ b/editor/src/node_graph_executor.rs @@ -48,7 +48,7 @@ pub struct CompilationResponse { } pub enum NodeGraphUpdate { - ExecutionResponse(ExecutionResponse), + ExecutionResponse(Box), CompilationResponse(CompilationResponse), EyedropperPreview(Raster), NodeGraphUpdateMessage(NodeGraphUpdateMessage), @@ -365,7 +365,7 @@ impl NodeGraphExecutor { responses: existing_responses, vector_modify, inspect_result, - } = execution_response; + } = *execution_response; while let Some(&(queued_execution_id, _)) = self.futures.front() { if queued_execution_id < execution_id { diff --git a/editor/src/node_graph_executor/runtime.rs b/editor/src/node_graph_executor/runtime.rs index d4be4156de..b7cf3591d5 100644 --- a/editor/src/node_graph_executor/runtime.rs +++ b/editor/src/node_graph_executor/runtime.rs @@ -102,7 +102,7 @@ impl InternalNodeGraphUpdateSender { } fn send_execution_response(&self, response: ExecutionResponse) { - self.0.send(NodeGraphUpdate::ExecutionResponse(response)).expect("Failed to send response") + self.0.send(NodeGraphUpdate::ExecutionResponse(Box::new(response))).expect("Failed to send response") } fn send_eyedropper_preview(&self, raster: Raster) { From 28473b1516c0b261efbbb669d3b7a3811c8c3a0a Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 28 Jun 2026 19:02:25 -0700 Subject: [PATCH 3/4] Box the `Layer` variant of `NodeTypeClickTargets` --- .../document/utility_types/network_interface/caches.rs | 4 ++-- .../document/utility_types/network_interface/types.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/caches.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/caches.rs index d0463b9fd3..eb12f2dcf5 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/caches.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/caches.rs @@ -1106,12 +1106,12 @@ impl NodeNetworkInterface { DocumentNodeClickTargets { node_click_target, port_click_targets, - node_type_metadata: NodeTypeClickTargets::Layer(LayerClickTargets { + node_type_metadata: NodeTypeClickTargets::Layer(Box::new(LayerClickTargets { visibility_click_target, lock_click_target, grip_click_target, name_click_target, - }), + })), } }; diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs index 716708ef0e..c04e7a52cc 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs @@ -736,7 +736,7 @@ pub struct DocumentNodeClickTargets { #[derive(Debug, Clone)] pub enum NodeTypeClickTargets { - Layer(LayerClickTargets), + Layer(Box), Node, // No transient click targets are stored exclusively for nodes } From 480e5c09bc0d616a365f0208b06d8d518fbc9611 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 28 Jun 2026 19:08:22 -0700 Subject: [PATCH 4/4] Box the `Scope` variant of `ParsedValueSource` --- node-graph/node-macro/src/codegen.rs | 2 +- node-graph/node-macro/src/parsing.rs | 4 ++-- node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/node-graph/node-macro/src/codegen.rs b/node-graph/node-macro/src/codegen.rs index d1d6f15181..8d31963295 100644 --- a/node-graph/node-macro/src/codegen.rs +++ b/node-graph/node-macro/src/codegen.rs @@ -179,7 +179,7 @@ pub(crate) fn generate_node_code(crate_ident: &CrateIdent, parsed: &ParsedNodeFn } } ParsedValueSource::Scope(data) => { - if let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(_), .. }) = data { + if let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(_), .. }) = data.as_ref() { quote!(RegistryValueSource::Scope(#data)) } else { quote!(RegistryValueSource::Scope(#data.as_static_str())) diff --git a/node-graph/node-macro/src/parsing.rs b/node-graph/node-macro/src/parsing.rs index c484f6db47..c74992c75b 100644 --- a/node-graph/node-macro/src/parsing.rs +++ b/node-graph/node-macro/src/parsing.rs @@ -65,7 +65,7 @@ pub enum ParsedValueSource { #[default] None, Default(TokenStream2), - Scope(Expr), + Scope(Box), } // #[widget(ParsedWidgetOverride::Hidden)] @@ -815,7 +815,7 @@ fn parse_field(pat_ident: PatIdent, ty: Type, attrs: &[Attribute]) -> syn::Resul let value_source = match (default_value, scope) { (Some(_), Some(_)) => return Err(Error::new_spanned(&pat_ident, "Cannot have both `default` and `scope` attributes")), (Some(default_value), _) => ParsedValueSource::Default(default_value), - (_, Some(scope)) => ParsedValueSource::Scope(scope), + (_, Some(scope)) => ParsedValueSource::Scope(Box::new(scope)), _ => ParsedValueSource::None, }; diff --git a/node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs b/node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs index bd4ab4c547..e689817aea 100644 --- a/node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs +++ b/node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs @@ -241,7 +241,7 @@ impl PerPixelAdjustCodegen<'_> { ty: ParsedFieldType::classify(RegularParsedField { ty: parse_quote!(#gcore::list::Item<&'a WgpuExecutor>), exposed: true, - value_source: ParsedValueSource::Scope(parse_quote!("graphene_std::platform_application_io::WgpuExecutorNode")), + value_source: ParsedValueSource::Scope(Box::new(parse_quote!("graphene_std::platform_application_io::WgpuExecutorNode"))), number_soft_min: None, number_soft_max: None, number_hard_min: None,