Skip to content

Commit c15a386

Browse files
committed
Fixes
1 parent dda4591 commit c15a386

File tree

40 files changed

+224
-166
lines changed

40 files changed

+224
-166
lines changed

editor/src/messages/layout/utility_types/widgets/input_widgets.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use crate::messages::input_mapper::utility_types::misc::ActionKeys;
22
use crate::messages::layout::utility_types::widget_prelude::*;
33

4-
use graphene_core::{Color, raster::curve::Curve};
4+
use graphene_core::raster::curve::Curve;
5+
use graphene_core::Color;
56
use graphite_proc_macros::WidgetBuilder;
67

78
use derivative::*;

editor/src/messages/portfolio/document/graph_operation/transform_utils.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use crate::messages::portfolio::document::utility_types::network_interface::{InputConnector, NodeNetworkInterface};
22

33
use bezier_rs::Subpath;
4-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
4+
use graph_craft::document::value::TaggedValue;
5+
use graph_craft::document::{NodeId, NodeInput};
56
use graphene_core::vector::PointId;
67

78
use glam::{DAffine2, DVec2};
@@ -89,7 +90,11 @@ pub fn get_current_transform(inputs: &[NodeInput]) -> DAffine2 {
8990

9091
/// Extract the current normalized pivot from the layer
9192
pub fn get_current_normalized_pivot(inputs: &[NodeInput]) -> DVec2 {
92-
if let Some(&TaggedValue::DVec2(pivot)) = inputs[5].as_value() { pivot } else { DVec2::splat(0.5) }
93+
if let Some(&TaggedValue::DVec2(pivot)) = inputs[5].as_value() {
94+
pivot
95+
} else {
96+
DVec2::splat(0.5)
97+
}
9398
}
9499

95100
/// ![](https://files.keavon.com/-/OptimisticSpotlessTinamou/capture.png)

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

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ use super::misc::PTZ;
33
use super::nodes::SelectedNodes;
44
use crate::consts::{EXPORTS_TO_RIGHT_EDGE_PIXEL_GAP, EXPORTS_TO_TOP_EDGE_PIXEL_GAP, GRID_SIZE, IMPORTS_TO_LEFT_EDGE_PIXEL_GAP, IMPORTS_TO_TOP_EDGE_PIXEL_GAP};
55
use crate::messages::portfolio::document::graph_operation::utility_types::ModifyInputsContext;
6-
use crate::messages::portfolio::document::node_graph::document_node_definitions::{DocumentNodeDefinition, resolve_document_node_type};
6+
use crate::messages::portfolio::document::node_graph::document_node_definitions::{resolve_document_node_type, DocumentNodeDefinition};
77
use crate::messages::portfolio::document::node_graph::utility_types::{Direction, FrontendClickTargets, FrontendGraphDataType, FrontendGraphInput, FrontendGraphOutput};
88
use crate::messages::tool::common_functionality::graph_modification_utils;
99
use crate::messages::tool::tool_messages::tool_prelude::NumberInputMode;
1010

1111
use bezier_rs::Subpath;
12-
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput, NodeNetwork, OldDocumentNodeImplementation, OldNodeNetwork, value::TaggedValue};
13-
use graph_craft::{Type, concrete};
12+
use graph_craft::document::value::TaggedValue;
13+
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeId, NodeInput, NodeNetwork, OldDocumentNodeImplementation, OldNodeNetwork};
14+
use graph_craft::{concrete, Type};
1415
use graphene_std::renderer::{ClickTarget, Quad};
1516
use graphene_std::transform::Footprint;
1617
use graphene_std::vector::{PointId, VectorData, VectorModificationType};
17-
use interpreted_executor::{dynamic_executor::ResolvedDocumentNodeTypes, node_registry::NODE_REGISTRY};
18+
use interpreted_executor::dynamic_executor::ResolvedDocumentNodeTypes;
19+
use interpreted_executor::node_registry::NODE_REGISTRY;
1820

1921
use glam::{DAffine2, DVec2, IVec2};
20-
use serde_json::{Value, json};
22+
use serde_json::{json, Value};
2123
use std::collections::{HashMap, HashSet, VecDeque};
2224
use std::hash::{DefaultHasher, Hash, Hasher};
2325

@@ -656,7 +658,11 @@ impl NodeNetworkInterface {
656658
// For example a node input of (Footprint) -> VectorData would not be compatible with () -> VectorData
657659
node_io.inputs[iterator_index].clone().nested_type() == input_type || node_io.inputs[iterator_index] == input_type
658660
});
659-
if valid_implementation { node_io.inputs.get(*input_index).cloned() } else { None }
661+
if valid_implementation {
662+
node_io.inputs.get(*input_index).cloned()
663+
} else {
664+
None
665+
}
660666
})
661667
.collect::<Vec<_>>()
662668
}
@@ -2677,7 +2683,11 @@ impl NodeNetworkInterface {
26772683
let Some(downstream_node_id) = downstream_node_connectors.iter().find_map(|input_connector| {
26782684
if let InputConnector::Node { node_id, input_index } = input_connector {
26792685
let downstream_input_index = if self.is_layer(node_id, network_path) { 1 } else { 0 };
2680-
if *input_index == downstream_input_index { Some(node_id) } else { None }
2686+
if *input_index == downstream_input_index {
2687+
Some(node_id)
2688+
} else {
2689+
None
2690+
}
26812691
} else {
26822692
None
26832693
}
@@ -2924,7 +2934,11 @@ impl NodeNetworkInterface {
29242934
log::error!("Could not get node_metadata for node {node_id}");
29252935
return None;
29262936
};
2927-
if !node_metadata.persistent_metadata.is_layer() { Some(*node_id) } else { None }
2937+
if !node_metadata.persistent_metadata.is_layer() {
2938+
Some(*node_id)
2939+
} else {
2940+
None
2941+
}
29282942
})
29292943
.or_else(|| clicked_nodes.into_iter().next())
29302944
}
@@ -3155,10 +3169,13 @@ impl NodeNetworkInterface {
31553169
// Only load structure if there is a root node
31563170
let Some(root_node) = self.root_node(&[]) else { return };
31573171

3158-
let Some(first_root_layer) = self
3159-
.upstream_flow_back_from_nodes(vec![root_node.node_id], &[], FlowType::PrimaryFlow)
3160-
.find_map(|node_id| if self.is_layer(&node_id, &[]) { Some(LayerNodeIdentifier::new(node_id, self, &[])) } else { None })
3161-
else {
3172+
let Some(first_root_layer) = self.upstream_flow_back_from_nodes(vec![root_node.node_id], &[], FlowType::PrimaryFlow).find_map(|node_id| {
3173+
if self.is_layer(&node_id, &[]) {
3174+
Some(LayerNodeIdentifier::new(node_id, self, &[]))
3175+
} else {
3176+
None
3177+
}
3178+
}) else {
31623179
return;
31633180
};
31643181
// Should refer to output node
@@ -4725,7 +4742,9 @@ impl NodeNetworkInterface {
47254742
}
47264743
*position = NodePosition::Chain;
47274744
self.transaction_modified();
4728-
} else {
4745+
}
4746+
// If there is an upstream layer then stop breaking the chain
4747+
else {
47294748
log::error!("Could not set chain position for layer node {node_id}");
47304749
}
47314750
self.unload_upstream_node_click_targets(vec![*node_id], network_path);
@@ -5112,7 +5131,11 @@ impl NodeNetworkInterface {
51125131
stack_dependents_with_position.sort_unstable_by(|a, b| {
51135132
a.1.signum().cmp(&b.1.signum()).then_with(|| {
51145133
// If the node has a positive offset, then it is shifted up, so shift the top nodes first
5115-
if a.1.signum() == 1 { a.2.cmp(&b.2) } else { b.2.cmp(&a.2) }
5134+
if a.1.signum() == 1 {
5135+
a.2.cmp(&b.2)
5136+
} else {
5137+
b.2.cmp(&a.2)
5138+
}
51165139
})
51175140
});
51185141

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ use crate::messages::prelude::*;
66

77
use bezier_rs::Subpath;
88
use graph_craft::concrete;
9-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
10-
use graphene_core::Color;
11-
use graphene_core::raster::BlendMode;
9+
use graph_craft::document::value::TaggedValue;
10+
use graph_craft::document::{NodeId, NodeInput};
1211
use graphene_core::raster::image::ImageFrameTable;
12+
use graphene_core::raster::BlendMode;
1313
use graphene_core::text::{Font, TypesettingConfig};
1414
use graphene_core::vector::style::Gradient;
15+
use graphene_core::Color;
1516
use graphene_std::vector::{ManipulatorPointId, PointId, SegmentId, VectorModificationType};
1617

1718
use glam::DVec2;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
use crate::messages::input_mapper::utility_types::input_keyboard::Key;
2+
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
13
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
24
use crate::messages::prelude::*;
35
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapConstraint, SnapData, SnapManager, SnapTypeConfiguration};
4-
use crate::messages::{input_mapper::utility_types::input_keyboard::Key, portfolio::document::graph_operation::utility_types::TransformIn};
56
use glam::{DAffine2, DVec2, Vec2Swizzles};
67

78
#[derive(Clone, Debug, Default)]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use crate::messages::tool::common_functionality::graph_modification_utils;
1010
use crate::messages::tool::common_functionality::resize::Resize;
1111
use crate::messages::tool::common_functionality::snapping::SnapData;
1212

13-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
13+
use graph_craft::document::value::TaggedValue;
14+
use graph_craft::document::{NodeId, NodeInput};
1415
use graphene_core::Color;
1516

1617
#[derive(Default)]

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ use super::tool_prelude::*;
22
use crate::consts::{BOUNDS_SELECT_THRESHOLD, DEFAULT_STROKE_WIDTH, LINE_ROTATE_SNAP_ANGLE};
33
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_document_node_type;
44
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
5-
use crate::messages::portfolio::document::utility_types::{document_metadata::LayerNodeIdentifier, network_interface::InputConnector};
5+
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
6+
use crate::messages::portfolio::document::utility_types::network_interface::InputConnector;
67
use crate::messages::tool::common_functionality::auto_panning::AutoPanning;
78
use crate::messages::tool::common_functionality::color_selector::{ToolColorOptions, ToolColorType};
89
use crate::messages::tool::common_functionality::graph_modification_utils::{self, NodeGraphLayer};
910
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapConstraint, SnapData, SnapManager, SnapTypeConfiguration};
1011

11-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
12+
use graph_craft::document::value::TaggedValue;
13+
use graph_craft::document::{NodeId, NodeInput};
1214
use graphene_core::Color;
1315

1416
#[derive(Default)]

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,19 @@ impl PathToolData {
520520
responses.add(OverlaysMessage::Draw);
521521
}
522522
PathToolFsmState::Dragging(self.dragging_state)
523-
} else if let Some(closed_segment) = shape_editor.upper_closest_segment(&document.network_interface, input.mouse.position, SELECTION_TOLERANCE) {
523+
}
524+
// We didn't find a point nearby, so now we'll try to add a point into the closest path segment
525+
else if let Some(closed_segment) = shape_editor.upper_closest_segment(&document.network_interface, input.mouse.position, SELECTION_TOLERANCE) {
524526
responses.add(DocumentMessage::StartTransaction);
525527
if direct_insert_without_sliding {
526528
self.start_insertion(responses, closed_segment);
527529
self.end_insertion(shape_editor, responses, InsertEndKind::Add { extend_selection })
528530
} else {
529531
self.start_insertion(responses, closed_segment)
530532
}
531-
} else if let Some(layer) = document.click(input) {
533+
}
534+
// We didn't find a segment path, so consider selecting the nearest shape instead
535+
else if let Some(layer) = document.click(input) {
532536
shape_editor.deselect_all_points();
533537
if extend_selection {
534538
responses.add(NodeGraphMessage::SelectedNodesAdd { nodes: vec![layer.to_node()] });

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use crate::messages::tool::common_functionality::graph_modification_utils::{self
1111
use crate::messages::tool::common_functionality::resize::Resize;
1212
use crate::messages::tool::common_functionality::snapping::SnapData;
1313

14-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
14+
use graph_craft::document::value::TaggedValue;
15+
use graph_craft::document::{NodeId, NodeInput};
1516
use graphene_core::Color;
1617

1718
#[derive(Default)]

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
use super::tool_prelude::*;
22
use crate::consts::DEFAULT_STROKE_WIDTH;
3+
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
34
use crate::messages::portfolio::document::node_graph::document_node_definitions::resolve_document_node_type;
4-
use crate::messages::portfolio::document::{graph_operation::utility_types::TransformIn, overlays::utility_types::OverlayContext, utility_types::network_interface::InputConnector};
5+
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
6+
use crate::messages::portfolio::document::utility_types::network_interface::InputConnector;
57
use crate::messages::tool::common_functionality::auto_panning::AutoPanning;
68
use crate::messages::tool::common_functionality::color_selector::{ToolColorOptions, ToolColorType};
79
use crate::messages::tool::common_functionality::graph_modification_utils;
810
use crate::messages::tool::common_functionality::resize::Resize;
911
use crate::messages::tool::common_functionality::snapping::SnapData;
1012

11-
use graph_craft::document::{NodeId, NodeInput, value::TaggedValue};
13+
use graph_craft::document::value::TaggedValue;
14+
use graph_craft::document::{NodeId, NodeInput};
1215
use graphene_core::Color;
1316

1417
#[derive(Default)]

0 commit comments

Comments
 (0)