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 8e864f66a2..d8d54ca872 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 @@ -149,7 +149,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 c9023c732d..4f41b841b6 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 @@ -1764,6 +1764,7 @@ impl<'a> MessageHandler> for NodeG NodeGraphMessage::SetInputValue { node_id, input_index, value } => { use graphene_std::vector::generator_nodes::*; + let value = *value; let is_fill = matches!(value, TaggedValue::Fill(_)); let reference = network_interface.reference(&node_id, selection_network_path); let is_text_node = reference.as_ref().is_some_and(|r| *r == DefinitionIdentifier::ProtoNode(graphene_std::text::text::IDENTIFIER)); 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 6ce0789861..bfcc0aa861 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -41,7 +41,10 @@ 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) => { + let value = Box::new(value); + NodeGraphMessage::SetInputValue { node_id, input_index, value }.into() + } None => Message::NoOp, } } @@ -831,7 +834,7 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec::INDEX, - value: TaggedValue::F64(uniform_val), + value: Box::new(TaggedValue::F64(uniform_val)), } .into(), ]), @@ -2198,13 +2201,13 @@ pub(crate) fn rectangle_properties(node_id: NodeId, context: &mut NodeProperties NodeGraphMessage::SetInputValue { node_id, input_index: IndividualCornerRadiiInput::INDEX, - value: TaggedValue::Bool(true), + value: Box::new(TaggedValue::Bool(true)), } .into(), NodeGraphMessage::SetInputValue { node_id, input_index: CornerRadiusInput::::INDEX, - value: TaggedValue::F64Array(individual_val_for_switch.clone()), + value: Box::new(TaggedValue::F64Array(individual_val_for_switch.clone())), } .into(), ]), @@ -2454,13 +2457,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte NodeGraphMessage::SetInputValue { node_id, input_index: backup_index, - value: backup_value, + value: Box::new(backup_value), } .into(), NodeGraphMessage::SetInputValue { node_id, input_index: FillInput::::INDEX, - value: TaggedValue::Fill(new_fill), + value: Box::new(TaggedValue::Fill(new_fill)), } .into(), ]), diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface.rs b/editor/src/messages/portfolio/document/utility_types/network_interface.rs index cdd8ef06a7..86d62d41da 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -2694,12 +2694,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, - }), + })), } }; @@ -6771,7 +6771,7 @@ pub struct LayerTransientMetadata { #[derive(Debug, Clone)] pub enum NodeTypeClickTargets { - Layer(LayerClickTargets), + Layer(Box), Node, // No transient click targets are stored exclusively for nodes } 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 cac806fa1a..34c926c809 100644 --- a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs +++ b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs @@ -677,7 +677,7 @@ pub fn set_stroke_weight_for_selected_layers(weight: f64, document: &DocumentMes for layer in layers { 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); + let value = Box::new(TaggedValue::F64(weight)); responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value }); } else if weight > 0. { let stroke = graphene_std::vector::style::Stroke::default().with_weight(weight); @@ -817,7 +817,7 @@ pub fn set_stroke_color_for_selected_layers(color: Option, weight: f64, d for layer in layers { if let Some(node_id) = get_stroke_id(layer, &document.network_interface) { let input_index = graphene_std::vector::stroke::ColorInput::INDEX; - let value = TaggedValue::Color(color); + let value = Box::new(TaggedValue::Color(color)); responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value }); } else { let stroke = graphene_std::vector::style::Stroke::new(color, weight); @@ -885,11 +885,8 @@ pub fn set_proto_node_input_for_selected_layers( let Some(node_id) = NodeGraphLayer::new(layer, &document.network_interface).upstream_node_id_from_name(&identifier) else { continue; }; - responses.add(NodeGraphMessage::SetInputValue { - node_id, - input_index, - value: value.clone(), - }); + let value = Box::new(value.clone()); + responses.add(NodeGraphMessage::SetInputValue { node_id, input_index, value }); } } diff --git a/editor/src/messages/tool/tool_messages/gradient_tool.rs b/editor/src/messages/tool/tool_messages/gradient_tool.rs index c667ecd052..91922016a0 100644 --- a/editor/src/messages/tool/tool_messages/gradient_tool.rs +++ b/editor/src/messages/tool/tool_messages/gradient_tool.rs @@ -1992,7 +1992,7 @@ mod test_gradient { .handle_message(NodeGraphMessage::SetInputValue { node_id: gradient_node_id, input_index: 1, - value: TaggedValue::Gradient(GradientStops::new([ + value: Box::new(TaggedValue::Gradient(GradientStops::new([ GradientStop { position: 0., midpoint: 0.5, @@ -2003,7 +2003,7 @@ mod test_gradient { midpoint: 0.5, color: Color::BLUE, }, - ])), + ]))), }) .await; @@ -2585,7 +2585,7 @@ mod test_gradient { .handle_message(NodeGraphMessage::SetInputValue { node_id: gradient_value_id, input_index: 1, - value: TaggedValue::Gradient(GradientStops::new([ + value: Box::new(TaggedValue::Gradient(GradientStops::new([ GradientStop { position: 0., midpoint: 0.5, @@ -2596,7 +2596,7 @@ mod test_gradient { midpoint: 0.5, color: Color::BLUE, }, - ])), + ]))), }) .await; diff --git a/editor/src/messages/tool/tool_messages/text_tool.rs b/editor/src/messages/tool/tool_messages/text_tool.rs index 29155ce22c..930be4fb23 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: Box::new(TaggedValue::Resource(resource_id)), } .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: Box::new(TaggedValue::F64(font_size)), }); } } @@ -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: Box::new(TaggedValue::TextAlign(align)), }); } } diff --git a/editor/src/node_graph_executor.rs b/editor/src/node_graph_executor.rs index 67048f72e8..e53ca317cf 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), @@ -352,7 +352,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 d799b3817d..22836aaf42 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) { diff --git a/node-graph/node-macro/src/codegen.rs b/node-graph/node-macro/src/codegen.rs index b3b04da441..1fd1007712 100644 --- a/node-graph/node-macro/src/codegen.rs +++ b/node-graph/node-macro/src/codegen.rs @@ -173,7 +173,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 f0641685aa..4842ef8544 100644 --- a/node-graph/node-macro/src/parsing.rs +++ b/node-graph/node-macro/src/parsing.rs @@ -63,7 +63,7 @@ pub enum ParsedValueSource { #[default] None, Default(TokenStream2), - Scope(Expr), + Scope(Box), } // #[widget(ParsedWidgetOverride::Hidden)] @@ -676,7 +676,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 20ee1ec731..e59aeff957 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 @@ -233,7 +233,7 @@ impl PerPixelAdjustCodegen<'_> { ty: ParsedFieldType::Regular(RegularParsedField { ty: parse_quote!(&'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,