Skip to content

Commit 123108c

Browse files
committed
Promote vector meshes from experimental by removing it from preferences
1 parent e73e524 commit 123108c

File tree

12 files changed

+71
-133
lines changed

12 files changed

+71
-133
lines changed

editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -256,29 +256,6 @@ impl PreferencesDialogMessageHandler {
256256
.widget_instance(),
257257
];
258258

259-
let checkbox_id = CheckboxId::new();
260-
let vector_mesh_description = "
261-
Allow the Pen tool to produce branching geometry, where more than two segments may be connected to one anchor point.\n\
262-
\n\
263-
Currently, vector meshes do not properly render strokes (branching joins) and fills (multiple regions).
264-
"
265-
.trim();
266-
let vector_meshes = vec![
267-
Separator::new(SeparatorType::Unrelated).widget_instance(),
268-
Separator::new(SeparatorType::Unrelated).widget_instance(),
269-
CheckboxInput::new(preferences.vector_meshes)
270-
.tooltip_label("Vector Meshes")
271-
.tooltip_description(vector_mesh_description)
272-
.on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::VectorMeshes { enabled: checkbox_input.checked }.into())
273-
.for_label(checkbox_id)
274-
.widget_instance(),
275-
TextLabel::new("Vector Meshes")
276-
.tooltip_label("Vector Meshes")
277-
.tooltip_description(vector_mesh_description)
278-
.for_checkbox(checkbox_id)
279-
.widget_instance(),
280-
];
281-
282259
let checkbox_id = CheckboxId::new();
283260
let brush_tool_description = "
284261
Enable the Brush tool to support basic raster-based layer painting.\n\
@@ -304,7 +281,7 @@ impl PreferencesDialogMessageHandler {
304281
.widget_instance(),
305282
];
306283

307-
rows.extend_from_slice(&[header, node_graph_wires_label, graph_wire_style, use_vello, vector_meshes, brush_tool]);
284+
rows.extend_from_slice(&[header, node_graph_wires_label, graph_wire_style, use_vello, brush_tool]);
308285
}
309286

310287
Layout(rows.into_iter().map(|r| LayoutGroup::Row { widgets: r }).collect())

editor/src/messages/portfolio/document/overlays/utility_functions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::consts::HIDE_HANDLE_DISTANCE;
33
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
44
use crate::messages::portfolio::document::utility_types::network_interface::NodeNetworkInterface;
55
use crate::messages::tool::common_functionality::shape_editor::{SelectedLayerState, ShapeState};
6-
use crate::messages::tool::tool_messages::tool_prelude::{DocumentMessageHandler, PreferencesMessageHandler};
6+
use crate::messages::tool::tool_messages::tool_prelude::DocumentMessageHandler;
77
use glam::{DAffine2, DVec2};
88
use graphene_std::subpath::{Bezier, BezierHandles};
99
use graphene_std::text::{Font, FontCache, TextAlign, TextContext, TypesettingConfig};
@@ -200,7 +200,7 @@ pub fn path_overlays(document: &DocumentMessageHandler, draw_handles: DrawHandle
200200
}
201201
}
202202

203-
pub fn path_endpoint_overlays(document: &DocumentMessageHandler, shape_editor: &mut ShapeState, overlay_context: &mut OverlayContext, preferences: &PreferencesMessageHandler) {
203+
pub fn path_endpoint_overlays(document: &DocumentMessageHandler, shape_editor: &mut ShapeState, overlay_context: &mut OverlayContext) {
204204
if !overlay_context.visibility_settings.anchors() {
205205
return;
206206
}
@@ -213,7 +213,7 @@ pub fn path_endpoint_overlays(document: &DocumentMessageHandler, shape_editor: &
213213
let selected = shape_editor.selected_shape_state.get(&layer);
214214
let is_selected = |selected: Option<&SelectedLayerState>, point: ManipulatorPointId| selected.is_some_and(|selected| selected.is_point_selected(point));
215215

216-
for point in vector.extendable_points(preferences.vector_meshes) {
216+
for point in vector.extendable_points() {
217217
let Some(position) = vector.point_domain.position_from_id(point) else { continue };
218218
let position = transform.transform_point2(position);
219219
overlay_context.manipulator_anchor(position, is_selected(selected, ManipulatorPointId::Anchor(point)), None);

editor/src/messages/preferences/preferences_message.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ pub enum PreferencesMessage {
1212
// Per-preference messages
1313
UseVello { use_vello: bool },
1414
SelectionMode { selection_mode: SelectionMode },
15-
VectorMeshes { enabled: bool },
1615
BrushTool { enabled: bool },
1716
ModifyLayout { zoom_with_scroll: bool },
1817
GraphWireStyle { style: GraphWireStyle },

editor/src/messages/preferences/preferences_message_handler.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub struct PreferencesMessageHandler {
1717
pub selection_mode: SelectionMode,
1818
pub zoom_with_scroll: bool,
1919
pub use_vello: bool,
20-
pub vector_meshes: bool,
2120
pub brush_tool: bool,
2221
pub graph_wire_style: GraphWireStyle,
2322
pub viewport_zoom_wheel_rate: f64,
@@ -46,7 +45,6 @@ impl Default for PreferencesMessageHandler {
4645
selection_mode: SelectionMode::Touched,
4746
zoom_with_scroll: matches!(MappingVariant::default(), MappingVariant::ZoomWithScroll),
4847
use_vello: EditorPreferences::default().use_vello,
49-
vector_meshes: false,
5048
brush_tool: false,
5149
graph_wire_style: GraphWireStyle::default(),
5250
viewport_zoom_wheel_rate: VIEWPORT_ZOOM_WHEEL_RATE,
@@ -87,9 +85,6 @@ impl MessageHandler<PreferencesMessage, PreferencesMessageContext<'_>> for Prefe
8785
responses.add(PortfolioMessage::UpdateVelloPreference);
8886
responses.add(PortfolioMessage::EditorPreferences);
8987
}
90-
PreferencesMessage::VectorMeshes { enabled } => {
91-
self.vector_meshes = enabled;
92-
}
9388
PreferencesMessage::BrushTool { enabled } => {
9489
self.brush_tool = enabled;
9590

editor/src/messages/tool/common_functionality/shape_editor.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl ShapeState {
421421
(point.as_handle().is_some() && self.ignore_handles) || (point.as_anchor().is_some() && self.ignore_anchors)
422422
}
423423

424-
pub fn close_selected_path(&self, document: &DocumentMessageHandler, responses: &mut VecDeque<Message>, vector_meshes: bool) {
424+
pub fn close_selected_path(&self, document: &DocumentMessageHandler, responses: &mut VecDeque<Message>) {
425425
// First collect all selected anchor points across all layers
426426
let all_selected_points: Vec<(LayerNodeIdentifier, PointId)> = self
427427
.selected_shape_state
@@ -446,14 +446,6 @@ impl ShapeState {
446446
let (layer1, start_point) = all_selected_points[0];
447447
let (layer2, end_point) = all_selected_points[1];
448448

449-
let Some(vector1) = document.network_interface.compute_modified_vector(layer1) else { return };
450-
let Some(vector2) = document.network_interface.compute_modified_vector(layer2) else { return };
451-
452-
// If vector meshes is not selected then only for endpoints, otherwise normally applicable
453-
if !vector_meshes && (vector1.all_connected(start_point).count() != 1 || vector2.all_connected(end_point).count() != 1) {
454-
return;
455-
}
456-
457449
if layer1 == layer2 {
458450
if start_point == end_point {
459451
return;

editor/src/messages/tool/common_functionality/utility_functions.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,8 @@ use graphene_std::vector::{HandleExt, PointId, SegmentId, Vector, VectorModifica
2222
use kurbo::{CubicBez, DEFAULT_ACCURACY, Line, ParamCurve, PathSeg, Point, QuadBez, Shape};
2323

2424
/// Determines if a path should be extended. Goal in viewport space. Returns the path and if it is extending from the start, if applicable.
25-
pub fn should_extend(
26-
document: &DocumentMessageHandler,
27-
goal: DVec2,
28-
tolerance: f64,
29-
layers: impl Iterator<Item = LayerNodeIdentifier>,
30-
preferences: &PreferencesMessageHandler,
31-
) -> Option<(LayerNodeIdentifier, PointId, DVec2)> {
32-
closest_point(document, goal, tolerance, layers, |_| false, preferences)
25+
pub fn should_extend(document: &DocumentMessageHandler, goal: DVec2, tolerance: f64, layers: impl Iterator<Item = LayerNodeIdentifier>) -> Option<(LayerNodeIdentifier, PointId, DVec2)> {
26+
closest_point(document, goal, tolerance, layers, |_| false)
3327
}
3428

3529
/// Determine the closest point to the goal point under max_distance.
@@ -40,7 +34,6 @@ pub fn closest_point<T>(
4034
max_distance: f64,
4135
layers: impl Iterator<Item = LayerNodeIdentifier>,
4236
exclude: T,
43-
preferences: &PreferencesMessageHandler,
4437
) -> Option<(LayerNodeIdentifier, PointId, DVec2)>
4538
where
4639
T: Fn(PointId) -> bool,
@@ -50,7 +43,7 @@ where
5043
for layer in layers {
5144
let viewspace = document.metadata().transform_to_viewport(layer);
5245
let Some(vector) = document.network_interface.compute_modified_vector(layer) else { continue };
53-
for id in vector.extendable_points(preferences.vector_meshes) {
46+
for id in vector.extendable_points() {
5447
if exclude(id) {
5548
continue;
5649
}

editor/src/messages/tool/tool_messages/freehand_tool.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,14 @@ impl Fsm for FreehandToolFsmState {
236236
global_tool_data,
237237
input,
238238
shape_editor,
239-
preferences,
240239
viewport,
241240
..
242241
} = tool_action_data;
243242

244243
let ToolMessage::Freehand(event) = event else { return self };
245244
match (self, event) {
246245
(_, FreehandToolMessage::Overlays { context: mut overlay_context }) => {
247-
path_endpoint_overlays(document, shape_editor, &mut overlay_context, tool_action_data.preferences);
246+
path_endpoint_overlays(document, shape_editor, &mut overlay_context);
248247

249248
self
250249
}
@@ -258,7 +257,7 @@ impl Fsm for FreehandToolFsmState {
258257
// Extend an endpoint of the selected path
259258
let selected_nodes = document.network_interface.selected_nodes();
260259
let tolerance = crate::consts::SNAP_POINT_TOLERANCE;
261-
if let Some((layer, point, position)) = should_extend(document, input.mouse.position, tolerance, selected_nodes.selected_layers(document.metadata()), preferences) {
260+
if let Some((layer, point, position)) = should_extend(document, input.mouse.position, tolerance, selected_nodes.selected_layers(document.metadata())) {
262261
tool_data.layer = Some(layer);
263262
tool_data.end_point = Some((position, point));
264263

@@ -519,7 +518,7 @@ mod test_freehand {
519518
initial_segment_count
520519
);
521520

522-
let extendable_points = initial_vector.extendable_points(false).collect::<Vec<_>>();
521+
let extendable_points = initial_vector.extendable_points().collect::<Vec<_>>();
523522
assert!(!extendable_points.is_empty(), "No extendable points found in the path");
524523

525524
let endpoint_id = extendable_points[0];

editor/src/messages/tool/tool_messages/path_tool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ impl PathToolData {
823823
.filter(|handle| handle.length(&vector) < 1e-6)
824824
.map(|handle| handle.to_manipulator_point())
825825
.collect::<Vec<_>>();
826-
let endpoint = vector.extendable_points(false).any(|anchor| point == anchor);
826+
let endpoint = vector.extendable_points_no_vector_meshes().any(|anchor| point == anchor);
827827

828828
if drag_zero_handle && (handles.len() == 1 && !endpoint) {
829829
shape_editor.deselect_all_points();
@@ -2662,7 +2662,7 @@ impl Fsm for PathToolFsmState {
26622662
}
26632663
(_, PathToolMessage::ClosePath) => {
26642664
responses.add(DocumentMessage::AddTransaction);
2665-
shape_editor.close_selected_path(document, responses, tool_action_data.preferences.vector_meshes);
2665+
shape_editor.close_selected_path(document, responses);
26662666
responses.add(DocumentMessage::EndTransaction);
26672667

26682668
responses.add(OverlaysMessage::Draw);

0 commit comments

Comments
 (0)