Skip to content

Commit ccca512

Browse files
committed
Remove old VecDVec2
1 parent 9b8f9bf commit ccca512

5 files changed

Lines changed: 0 additions & 112 deletions

File tree

editor/src/messages/portfolio/document/node_graph/node_properties.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ pub(crate) fn property_from_type(
214214
// PRIMITIVE COLLECTION TYPES
215215
// ==========================
216216
Some(x) if x == TypeId::of::<Vec<f64>>() => array_of_number_widget(default_info, TextInput::default()).into(),
217-
Some(x) if x == TypeId::of::<Vec<DVec2>>() => array_of_vec2_widget(default_info, TextInput::default()).into(),
218217
// ===========
219218
// TABLE TYPES
220219
// ===========
@@ -796,38 +795,6 @@ pub fn array_of_number_widget(parameter_widgets_info: ParameterWidgetsInfo, text
796795
widgets
797796
}
798797

799-
pub fn array_of_vec2_widget(parameter_widgets_info: ParameterWidgetsInfo, text_props: TextInput) -> Vec<WidgetInstance> {
800-
let ParameterWidgetsInfo { document_node, node_id, index, .. } = parameter_widgets_info;
801-
802-
let mut widgets = start_widgets(parameter_widgets_info);
803-
804-
let from_string = |string: &str| {
805-
string
806-
.split(|c: char| !c.is_alphanumeric() && !matches!(c, '.' | '+' | '-'))
807-
.filter(|x| !x.is_empty())
808-
.map(|x| x.parse::<f64>().ok())
809-
.collect::<Option<Vec<_>>>()
810-
.map(|numbers| numbers.chunks_exact(2).map(|values| DVec2::new(values[0], values[1])).collect())
811-
.map(TaggedValue::VecDVec2)
812-
};
813-
814-
let Some(document_node) = document_node else { return Vec::new() };
815-
let Some(input) = document_node.inputs.get(index) else {
816-
log::warn!("A widget failed to be built because its node's input index is invalid.");
817-
return vec![];
818-
};
819-
if let Some(TaggedValue::VecDVec2(x)) = &input.as_non_exposed_value() {
820-
widgets.extend_from_slice(&[
821-
Separator::new(SeparatorStyle::Unrelated).widget_instance(),
822-
text_props
823-
.value(x.iter().map(|v| format!("({}, {})", v.x, v.y)).collect::<Vec<_>>().join(", "))
824-
.on_update(optionally_update_value(move |x: &TextInput| from_string(&x.value), node_id, index))
825-
.widget_instance(),
826-
])
827-
}
828-
widgets
829-
}
830-
831798
pub fn font_inputs(parameter_widgets_info: ParameterWidgetsInfo) -> (Vec<WidgetInstance>, Option<Vec<WidgetInstance>>) {
832799
let ParameterWidgetsInfo {
833800
cached_data,

editor/src/messages/portfolio/document/node_graph/utility_types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ impl FrontendGraphDataType {
2828
| TaggedValue::DVec2(_)
2929
| TaggedValue::F64Array4(_)
3030
| TaggedValue::VecF64(_)
31-
| TaggedValue::VecDVec2(_)
3231
| TaggedValue::DAffine2(_) => Self::Number,
3332
TaggedValue::Artboard(_) => Self::Artboard,
3433
TaggedValue::Graphic(_) => Self::Graphic,

editor/src/messages/portfolio/document/utility_types/network_interface/resolved_types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ impl TypeSource {
6060
| TaggedValue::DVec2(_)
6161
| TaggedValue::F64Array4(_)
6262
| TaggedValue::VecF64(_)
63-
| TaggedValue::VecDVec2(_)
6463
| TaggedValue::DAffine2(_) => FrontendGraphDataType::Number,
6564
TaggedValue::Artboard(_) => FrontendGraphDataType::Artboard,
6665
TaggedValue::Graphic(_) => FrontendGraphDataType::Graphic,

editor/src/messages/portfolio/document_migration.rs

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ use glam::{DVec2, IVec2};
99
use graph_craft::document::DocumentNode;
1010
use graph_craft::document::{DocumentNodeImplementation, NodeInput, value::TaggedValue};
1111
use graphene_std::ProtoNodeIdentifier;
12-
use graphene_std::subpath::Subpath;
1312
use graphene_std::text::{TextAlign, TypesettingConfig};
1413
use graphene_std::transform::ScaleType;
1514
use graphene_std::uuid::NodeId;
16-
use graphene_std::vector::Vector;
1715
use graphene_std::vector::style::{PaintOrder, StrokeAlign};
1816
use std::collections::HashMap;
1917
use std::f64::consts::PI;
@@ -1113,80 +1111,6 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
11131111
document.network_interface.set_input(&InputConnector::node(*node_id, 9), old_inputs[4].clone(), network_path);
11141112
}
11151113

1116-
// Upgrade the old "Spline" node to the new "Spline" node
1117-
if reference == DefinitionIdentifier::ProtoNode(graphene_std::vector::spline::IDENTIFIER)
1118-
|| reference == DefinitionIdentifier::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::generator_nodes::SplineNode"))
1119-
|| reference == DefinitionIdentifier::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::SplineNode"))
1120-
|| reference == DefinitionIdentifier::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::SplinesFromPointsNode"))
1121-
{
1122-
// Retrieve the proto node identifier and verify it is the old "Spline" node, otherwise skip it if this is the new "Spline" node
1123-
let identifier = document
1124-
.network_interface
1125-
.implementation(node_id, network_path)
1126-
.and_then(|implementation| implementation.get_proto_node());
1127-
if identifier.map(|identifier| identifier.as_str()) != Some("graphene_core::vector::generator_nodes::SplineNode") {
1128-
return None;
1129-
}
1130-
1131-
// Obtain the document node for the given node ID, extract the vector points, and create a Vector path from the list of points
1132-
let node = document.network_interface.document_node(node_id, network_path)?;
1133-
let Some(TaggedValue::VecDVec2(points)) = node.inputs.get(1).and_then(|tagged_value| tagged_value.as_value()) else {
1134-
log::error!("The old Spline node's input at index 1 is not a TaggedValue::VecDVec2");
1135-
return None;
1136-
};
1137-
let vector = Vector::from_subpath(Subpath::from_anchors(points.to_vec(), false));
1138-
1139-
// Retrieve the output connectors linked to the "Spline" node's output connector
1140-
let Some(spline_outputs) = document.network_interface.outward_wires(network_path)?.get(&OutputConnector::node(*node_id, 0)).cloned() else {
1141-
log::error!("Vec of InputConnector Spline node is connected to its output connector 0.");
1142-
return None;
1143-
};
1144-
1145-
// Get the node's current position in the graph
1146-
let Some(node_position) = document.network_interface.position(node_id, network_path) else {
1147-
log::error!("Could not get position of spline node.");
1148-
return None;
1149-
};
1150-
1151-
// Get the "Path" node definition and fill it in with the Vector path and default vector modification
1152-
let Some(path_node_type) = resolve_network_node_type("Path") else {
1153-
log::error!("Path node does not exist.");
1154-
return None;
1155-
};
1156-
let modification = Box::new(graphene_std::vector::VectorModification::create_from_vector(&vector));
1157-
let path_node = path_node_type.node_template_input_override([None, Some(NodeInput::value(TaggedValue::VectorModification(modification), false))]);
1158-
1159-
// Get the "Spline" node definition and wire it up with the "Path" node as input
1160-
let Some(spline_node_type) = resolve_proto_node_type(graphene_std::vector::spline::IDENTIFIER) else {
1161-
log::error!("Spline node does not exist.");
1162-
return None;
1163-
};
1164-
let spline_node = spline_node_type.node_template_input_override([Some(NodeInput::node(NodeId(1), 0))]);
1165-
1166-
// Create a new node group with the "Path" and "Spline" nodes and generate new node IDs for them
1167-
let nodes = vec![(NodeId(1), path_node), (NodeId(0), spline_node)];
1168-
let new_ids = nodes.iter().map(|(id, _)| (*id, NodeId::new())).collect::<HashMap<_, _>>();
1169-
let new_spline_id = *new_ids.get(&NodeId(0))?;
1170-
let new_path_id = *new_ids.get(&NodeId(1))?;
1171-
1172-
// Remove the old "Spline" node from the document
1173-
document.network_interface.delete_nodes(vec![*node_id], false, network_path);
1174-
1175-
// Insert the new "Path" and "Spline" nodes into the network interface with generated IDs
1176-
document.network_interface.insert_node_group(nodes.clone(), new_ids, network_path);
1177-
1178-
// Reposition the new "Spline" node to match the original "Spline" node's position
1179-
document.network_interface.shift_node(&new_spline_id, node_position, network_path);
1180-
1181-
// Reposition the new "Path" node with an offset relative to the original "Spline" node's position
1182-
document.network_interface.shift_node(&new_path_id, node_position + IVec2::new(-7, 0), network_path);
1183-
1184-
// Redirect each output connection from the old node to the new "Spline" node's output connector
1185-
for input_connector in spline_outputs {
1186-
document.network_interface.set_input(&input_connector, NodeInput::node(new_spline_id, 0), network_path);
1187-
}
1188-
}
1189-
11901114
// Upgrade Text node to include line height and character spacing, which were previously hardcoded to 1, from https://github.com/GraphiteEditor/Graphite/pull/2016
11911115
if reference == DefinitionIdentifier::ProtoNode(graphene_std::text::text::IDENTIFIER) && inputs_count == 8 {
11921116
let mut template: NodeTemplate = resolve_document_node_type(&reference)?.default_node_template();

node-graph/graph-craft/src/document/value.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ tagged_value! {
180180
// ========================
181181
#[serde(alias = "VecF32")] // TODO: Eventually remove this alias document upgrade code
182182
VecF64(Vec<f64>),
183-
VecDVec2(Vec<DVec2>),
184183
F64Array4([f64; 4]),
185184
NodePath(Vec<NodeId>),
186185
// ===========

0 commit comments

Comments
 (0)