Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub enum NodeGraphMessage {
SetInputValue {
node_id: NodeId,
input_index: usize,
value: TaggedValue,
value: Box<TaggedValue>,
},
SetInput {
input_connector: InputConnector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ pub(crate) fn string_properties(text: &str) -> Vec<LayoutGroup> {

fn optionally_update_value<T>(value: impl Fn(&T) -> Option<TaggedValue> + '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,
}
}
Expand Down Expand Up @@ -901,7 +906,7 @@ pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec<WidgetI
NodeGraphMessage::SetInputValue {
node_id,
input_index: graphene_std::text::text::FontInput::INDEX,
value: TaggedValue::Resource(resource_id),
value: TaggedValue::Resource(resource_id).into(),
}
.into(),
]),
Expand Down Expand Up @@ -1478,7 +1483,7 @@ fn build_shared_spectrum_section(node_id: NodeId, context: &mut NodePropertiesCo
NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: TaggedValue::F32(percent.clamp(0., 100.) as f32),
value: TaggedValue::F32(percent.clamp(0., 100.) as f32).into(),
}
.into()
}
Expand Down Expand Up @@ -1635,7 +1640,7 @@ fn spectrum_slider_row(
NodeGraphMessage::SetInputValue {
node_id,
input_index,
value: TaggedValue::F32(position_to_value(new_position).clamp(value_min, value_max) as f32),
value: TaggedValue::F32(position_to_value(new_position).clamp(value_min, value_max) as f32).into(),
}
.into()
})
Expand Down Expand Up @@ -2189,13 +2194,13 @@ pub(crate) fn string_capitalization_properties(node_id: NodeId, context: &mut No
NodeGraphMessage::SetInputValue {
node_id,
input_index: UseJoinerInput::INDEX,
value: TaggedValue::Bool(true),
value: TaggedValue::Bool(true).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: JoinerInput::INDEX,
value: TaggedValue::String(value.clone()),
value: TaggedValue::String(value.clone()).into(),
}
.into(),
]),
Expand Down Expand Up @@ -2250,13 +2255,13 @@ pub(crate) fn rectangle_properties(node_id: NodeId, context: &mut NodeProperties
NodeGraphMessage::SetInputValue {
node_id,
input_index: IndividualCornerRadiiInput::INDEX,
value: TaggedValue::Bool(false),
value: TaggedValue::Bool(false).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: CornerRadiusInput::INDEX,
value: TaggedValue::BoxCorners(BoxCorners::from(uniform_val)),
value: TaggedValue::BoxCorners(BoxCorners::from(uniform_val)).into(),
}
.into(),
]),
Expand All @@ -2269,13 +2274,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: TaggedValue::Bool(true).into(),
}
.into(),
NodeGraphMessage::SetInputValue {
node_id,
input_index: CornerRadiusInput::INDEX,
value: TaggedValue::BoxCorners(BoxCorners::from(corner_values.to_vec())),
value: TaggedValue::BoxCorners(BoxCorners::from(corner_values.to_vec())).into(),
}
.into(),
]),
Expand Down Expand Up @@ -2577,7 +2582,7 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: FillInput::<List<Graphic>>::INDEX,
value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color),
value: color.map_or_else(TaggedValue::no_paint, TaggedValue::Color).into(),
}
.into(),
];
Expand All @@ -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(),
);
Expand All @@ -2599,13 +2604,13 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
NodeGraphMessage::SetInputValue {
node_id,
input_index: FillInput::<List<Graphic>>::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(),
]),
Expand Down Expand Up @@ -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(),
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<graphene_std::list::List<graphene_std::Graphic>>::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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
})),
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ pub struct DocumentNodeClickTargets {

#[derive(Debug, Clone)]
pub enum NodeTypeClickTargets {
Layer(LayerClickTargets),
Layer(Box<LayerClickTargets>),
Node, // No transient click targets are stored exclusively for nodes
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -834,7 +838,11 @@ pub fn set_stroke_color_for_selected_layers(color: Option<Color>, weight: f64, d
if let Some(node_id) = get_stroke_id(layer, &document.network_interface) {
let input_index = graphene_std::vector::stroke::PaintInput::<List<Graphic>>::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 });
Expand Down Expand Up @@ -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(),
});
}
}
Expand Down
9 changes: 6 additions & 3 deletions editor/src/messages/tool/tool_messages/gradient_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;

Expand Down Expand Up @@ -2196,7 +2197,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;

Expand Down Expand Up @@ -2839,7 +2841,8 @@ mod test_gradient {
midpoint: 0.5,
color: Color::BLUE,
},
])),
]))
.into(),
})
.await;

Expand Down
6 changes: 3 additions & 3 deletions editor/src/messages/tool/tool_messages/text_tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]),
Expand Down Expand Up @@ -349,7 +349,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> 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(),
});
}
}
Expand All @@ -364,7 +364,7 @@ impl<'a> MessageHandler<ToolMessage, &mut ToolActionMessageContext<'a>> 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(),
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions editor/src/node_graph_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct CompilationResponse {
}

pub enum NodeGraphUpdate {
ExecutionResponse(ExecutionResponse),
ExecutionResponse(Box<ExecutionResponse>),
CompilationResponse(CompilationResponse),
EyedropperPreview(Raster<CPU>),
NodeGraphUpdateMessage(NodeGraphUpdateMessage),
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion editor/src/node_graph_executor/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CPU>) {
Expand Down
2 changes: 1 addition & 1 deletion node-graph/node-macro/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
4 changes: 2 additions & 2 deletions node-graph/node-macro/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub enum ParsedValueSource {
#[default]
None,
Default(TokenStream2),
Scope(Expr),
Scope(Box<Expr>),
}

// #[widget(ParsedWidgetOverride::Hidden)]
Expand Down Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion node-graph/node-macro/src/shader_nodes/per_pixel_adjust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading