Skip to content

Commit 2b79a55

Browse files
committed
remove unnecessary path prefix
1 parent 24236a7 commit 2b79a55

78 files changed

Lines changed: 276 additions & 305 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

editor/src/messages/input_mapper/input_mapper_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl InputMapperMessageHandler {
7373
};
7474

7575
// Find the key combinations for all keymaps matching the desired action
76-
assert!(std::mem::size_of::<usize>() >= std::mem::size_of::<Key>());
76+
assert!(size_of::<usize>() >= size_of::<Key>());
7777
found_actions
7878
.map(|entry| {
7979
// Get the modifier keys for the entry (and convert them to Key)

editor/src/messages/input_mapper/utility_types/input_keyboard.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign};
99
pub type StorageType = u128;
1010

1111
// Base-2 logarithm of the storage type used to represents how many bits you need to fully address every bit in that storage type
12-
const STORAGE_SIZE: u32 = (std::mem::size_of::<StorageType>() * 8).trailing_zeros();
12+
const STORAGE_SIZE: u32 = (size_of::<StorageType>() * 8).trailing_zeros();
1313
const STORAGE_SIZE_BITS: usize = 1 << STORAGE_SIZE;
1414
const KEY_MASK_STORAGE_LENGTH: usize = (NUMBER_OF_KEYS + STORAGE_SIZE_BITS - 1) >> STORAGE_SIZE;
1515

@@ -210,9 +210,9 @@ pub enum Key {
210210
NumKeys,
211211
}
212212

213-
impl fmt::Display for Key {
213+
impl Display for Key {
214214
// TODO: Relevant key labels should be localized when we get around to implementing localization/internationalization
215-
fn fmt(&self, f: &mut fmt::Formatter) -> std::fmt::Result {
215+
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
216216
let key_name = format!("{self:?}");
217217

218218
// Writing system keys
@@ -323,7 +323,7 @@ pub const NUMBER_OF_KEYS: usize = Key::NumKeys as usize;
323323
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
324324
pub struct KeysGroup(pub Vec<Key>);
325325

326-
impl fmt::Display for KeysGroup {
326+
impl Display for KeysGroup {
327327
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
328328
const JOINER_MARK: &str = " ";
329329

@@ -477,7 +477,7 @@ impl<const LENGTH: usize> Iterator for BitVectorIter<'_, LENGTH> {
477477
}
478478

479479
impl<const LENGTH: usize> Display for BitVector<LENGTH> {
480-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
480+
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
481481
for storage in self.0.iter().rev() {
482482
write!(f, "{:0width$b}", storage, width = STORAGE_SIZE_BITS)?;
483483
}

editor/src/messages/layout/layout_message_handler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl LayoutMessageHandler {
6868
None
6969
}
7070

71-
fn handle_widget_callback(&mut self, layout_target: LayoutTarget, widget_id: WidgetId, value: Value, action: WidgetValueAction, responses: &mut std::collections::VecDeque<Message>) {
71+
fn handle_widget_callback(&mut self, layout_target: LayoutTarget, widget_id: WidgetId, value: Value, action: WidgetValueAction, responses: &mut VecDeque<Message>) {
7272
let Some(layout) = self.layouts.get_mut(layout_target as usize) else {
7373
warn!("handle_widget_callback was called referencing an invalid layout. `widget_id: {widget_id}`, `layout_target: {layout_target:?}`",);
7474
return;
@@ -106,7 +106,7 @@ impl LayoutMessageHandler {
106106
WidgetValueAction::Commit => (color_button.on_commit.callback)(&()),
107107
WidgetValueAction::Update => {
108108
// Decodes the colors in gamma, not linear
109-
let decode_color = |color: &serde_json::map::Map<String, serde_json::value::Value>| -> Option<Color> {
109+
let decode_color = |color: &serde_json::map::Map<String, Value>| -> Option<Color> {
110110
let red = color.get("red").and_then(|x| x.as_f64()).map(|x| x as f32);
111111
let green = color.get("green").and_then(|x| x.as_f64()).map(|x| x as f32);
112112
let blue = color.get("blue").and_then(|x| x.as_f64()).map(|x| x as f32);
@@ -339,7 +339,7 @@ impl LayoutMessageHandler {
339339
}
340340

341341
impl<F: Fn(&MessageDiscriminant) -> Vec<KeysGroup>> MessageHandler<LayoutMessage, F> for LayoutMessageHandler {
342-
fn process_message(&mut self, message: LayoutMessage, responses: &mut std::collections::VecDeque<Message>, action_input_mapping: F) {
342+
fn process_message(&mut self, message: LayoutMessage, responses: &mut VecDeque<Message>, action_input_mapping: F) {
343343
match message {
344344
LayoutMessage::ResendActiveWidget { layout_target, widget_id } => {
345345
// Find the updated diff based on the specified layout target

editor/src/messages/portfolio/document/document_message_handler.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::node_graph::utility_types::Transform;
33
use super::overlays::utility_types::Pivot;
44
use super::utility_types::error::EditorError;
55
use super::utility_types::misc::{GroupFolderType, SNAP_FUNCTIONS_FOR_BOUNDING_BOXES, SNAP_FUNCTIONS_FOR_PATHS, SnappingOptions, SnappingState};
6-
use super::utility_types::network_interface::{self, NodeNetworkInterface, TransactionStatus};
6+
use super::utility_types::network_interface::{NodeNetworkInterface, TransactionStatus};
77
use super::utility_types::nodes::{CollapsedLayers, SelectedNodes};
88
use crate::application::{GRAPHITE_GIT_COMMIT_HASH, generate_uuid};
99
use crate::consts::{ASYMPTOTIC_EFFECT, COLOR_OVERLAY_GRAY, DEFAULT_DOCUMENT_NAME, FILE_SAVE_SUFFIX, SCALE_EFFECT, SCROLLBAR_SPACING, VIEWPORT_ROTATE_SNAP_INTERVAL};
@@ -1482,7 +1482,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
14821482
// Connect the current output data to the artboard's input data, and the artboard's output to the document output
14831483
responses.add(NodeGraphMessage::InsertNodeBetween {
14841484
node_id,
1485-
input_connector: network_interface::InputConnector::Export(0),
1485+
input_connector: InputConnector::Export(0),
14861486
insert_node_input_index: 1,
14871487
});
14881488

@@ -1580,15 +1580,15 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
15801580

15811581
impl DocumentMessageHandler {
15821582
/// Runs an intersection test with all layers and a viewport space quad
1583-
pub fn intersect_quad<'a>(&'a self, viewport_quad: graphene_core::renderer::Quad, ipp: &InputPreprocessorMessageHandler) -> impl Iterator<Item = LayerNodeIdentifier> + use<'a> {
1583+
pub fn intersect_quad<'a>(&'a self, viewport_quad: Quad, ipp: &InputPreprocessorMessageHandler) -> impl Iterator<Item = LayerNodeIdentifier> + use<'a> {
15841584
let document_to_viewport = self.navigation_handler.calculate_offset_transform(ipp.viewport_bounds.center(), &self.document_ptz);
15851585
let document_quad = document_to_viewport.inverse() * viewport_quad;
15861586

15871587
ClickXRayIter::new(&self.network_interface, XRayTarget::Quad(document_quad))
15881588
}
15891589

15901590
/// Runs an intersection test with all layers and a viewport space quad; ignoring artboards
1591-
pub fn intersect_quad_no_artboards<'a>(&'a self, viewport_quad: graphene_core::renderer::Quad, ipp: &InputPreprocessorMessageHandler) -> impl Iterator<Item = LayerNodeIdentifier> + use<'a> {
1591+
pub fn intersect_quad_no_artboards<'a>(&'a self, viewport_quad: Quad, ipp: &InputPreprocessorMessageHandler) -> impl Iterator<Item = LayerNodeIdentifier> + use<'a> {
15921592
self.intersect_quad(viewport_quad, ipp).filter(|layer| !self.network_interface.is_artboard(&layer.to_node(), &[]))
15931593
}
15941594

@@ -1605,7 +1605,7 @@ impl DocumentMessageHandler {
16051605
self.intersect_polygon(viewport_polygon, ipp).filter(|layer| !self.network_interface.is_artboard(&layer.to_node(), &[]))
16061606
}
16071607

1608-
pub fn is_layer_fully_inside(&self, layer: &LayerNodeIdentifier, quad: graphene_core::renderer::Quad) -> bool {
1608+
pub fn is_layer_fully_inside(&self, layer: &LayerNodeIdentifier, quad: Quad) -> bool {
16091609
// Get the bounding box of the layer in document space
16101610
let Some(bounding_box) = self.metadata().bounding_box_viewport(*layer) else { return false };
16111611

@@ -1699,15 +1699,15 @@ impl DocumentMessageHandler {
16991699
.selected_nodes()
17001700
.selected_visible_layers(&self.network_interface)
17011701
.filter_map(|layer| self.metadata().bounding_box_viewport(layer))
1702-
.reduce(graphene_core::renderer::Quad::combine_bounds)
1702+
.reduce(Quad::combine_bounds)
17031703
}
17041704

17051705
pub fn selected_visible_and_unlock_layers_bounding_box_viewport(&self) -> Option<[DVec2; 2]> {
17061706
self.network_interface
17071707
.selected_nodes()
17081708
.selected_visible_and_unlocked_layers(&self.network_interface)
17091709
.filter_map(|layer| self.metadata().bounding_box_viewport(layer))
1710-
.reduce(graphene_core::renderer::Quad::combine_bounds)
1710+
.reduce(Quad::combine_bounds)
17111711
}
17121712

17131713
pub fn document_network(&self) -> &NodeNetwork {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a> ModifyInputsContext<'a> {
124124
pub fn create_artboard(&mut self, new_id: NodeId, artboard: Artboard) -> LayerNodeIdentifier {
125125
let artboard_node_template = resolve_document_node_type("Artboard").expect("Node").node_template_input_override([
126126
Some(NodeInput::value(TaggedValue::ArtboardGroup(graphene_std::ArtboardGroupTable::default()), true)),
127-
Some(NodeInput::value(TaggedValue::GraphicGroup(graphene_core::GraphicGroupTable::default()), true)),
127+
Some(NodeInput::value(TaggedValue::GraphicGroup(GraphicGroupTable::default()), true)),
128128
Some(NodeInput::value(TaggedValue::IVec2(artboard.location), false)),
129129
Some(NodeInput::value(TaggedValue::IVec2(artboard.dimensions), false)),
130130
Some(NodeInput::value(TaggedValue::Color(artboard.background), false)),
@@ -136,7 +136,7 @@ impl<'a> ModifyInputsContext<'a> {
136136

137137
pub fn insert_boolean_data(&mut self, operation: graphene_std::vector::misc::BooleanOperation, layer: LayerNodeIdentifier) {
138138
let boolean = resolve_document_node_type("Boolean Operation").expect("Boolean node does not exist").node_template_input_override([
139-
Some(NodeInput::value(TaggedValue::GraphicGroup(graphene_std::GraphicGroupTable::default()), true)),
139+
Some(NodeInput::value(TaggedValue::GraphicGroup(GraphicGroupTable::default()), true)),
140140
Some(NodeInput::value(TaggedValue::BooleanOperation(operation), false)),
141141
]);
142142

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

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
370370
DocumentNode {
371371
manual_composition: Some(concrete!(Context)),
372372
inputs: vec![
373-
NodeInput::network(graphene_core::Type::Fn(Box::new(concrete!(Context)), Box::new(concrete!(ArtboardGroupTable))), 0),
373+
NodeInput::network(Type::Fn(Box::new(concrete!(Context)), Box::new(concrete!(ArtboardGroupTable))), 0),
374374
NodeInput::node(NodeId(1), 0),
375375
NodeInput::Reflection(graph_craft::document::DocumentNodeMetadata::DocumentNodePath),
376376
],
@@ -387,8 +387,8 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
387387
inputs: vec![
388388
NodeInput::value(TaggedValue::ArtboardGroup(ArtboardGroupTable::default()), true),
389389
NodeInput::value(TaggedValue::GraphicGroup(GraphicGroupTable::default()), true),
390-
NodeInput::value(TaggedValue::IVec2(glam::IVec2::ZERO), false),
391-
NodeInput::value(TaggedValue::IVec2(glam::IVec2::new(1920, 1080)), false),
390+
NodeInput::value(TaggedValue::IVec2(IVec2::ZERO), false),
391+
NodeInput::value(TaggedValue::IVec2(IVec2::new(1920, 1080)), false),
392392
NodeInput::value(TaggedValue::Color(Color::WHITE), false),
393393
NodeInput::value(TaggedValue::Bool(false), false),
394394
],
@@ -1028,7 +1028,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
10281028
nodes: vec![DocumentNode {
10291029
inputs: vec![
10301030
NodeInput::network(concrete!(RasterDataTable<Color>), 0),
1031-
NodeInput::network(concrete!(Vec<graphene_core::vector::brush_stroke::BrushStroke>), 1),
1031+
NodeInput::network(concrete!(Vec<vector::brush_stroke::BrushStroke>), 1),
10321032
NodeInput::network(concrete!(BrushCache), 2),
10331033
],
10341034
manual_composition: Some(concrete!(Context)),
@@ -1481,7 +1481,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
14811481
..Default::default()
14821482
},
14831483
DocumentNode {
1484-
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::network(concrete!(graphene_core::vector::VectorModification), 1)],
1484+
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::network(concrete!(vector::VectorModification), 1)],
14851485
manual_composition: Some(generic!(T)),
14861486
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::vector_data::modification::PathModifyNode")),
14871487
..Default::default()
@@ -1546,10 +1546,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
15461546
inputs: vec![
15471547
NodeInput::scope("editor-api"),
15481548
NodeInput::value(TaggedValue::String("Lorem ipsum".to_string()), false),
1549-
NodeInput::value(
1550-
TaggedValue::Font(Font::new(graphene_core::consts::DEFAULT_FONT_FAMILY.into(), graphene_core::consts::DEFAULT_FONT_STYLE.into())),
1551-
false,
1552-
),
1549+
NodeInput::value(TaggedValue::Font(Font::new(consts::DEFAULT_FONT_FAMILY.into(), consts::DEFAULT_FONT_STYLE.into())), false),
15531550
NodeInput::value(TaggedValue::F64(TypesettingConfig::default().font_size), false),
15541551
NodeInput::value(TaggedValue::F64(TypesettingConfig::default().line_height_ratio), false),
15551552
NodeInput::value(TaggedValue::F64(TypesettingConfig::default().character_spacing), false),
@@ -1830,14 +1827,14 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
18301827
exports: vec![NodeInput::node(NodeId(4), 0)], // Taken from output 0 of Sample Points
18311828
nodes: [
18321829
DocumentNode {
1833-
inputs: vec![NodeInput::network(concrete!(graphene_core::vector::VectorDataTable), 0)],
1830+
inputs: vec![NodeInput::network(concrete!(VectorDataTable), 0)],
18341831
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::SubpathSegmentLengthsNode")),
18351832
manual_composition: Some(generic!(T)),
18361833
..Default::default()
18371834
},
18381835
DocumentNode {
18391836
inputs: vec![
1840-
NodeInput::network(concrete!(graphene_core::vector::VectorDataTable), 0),
1837+
NodeInput::network(concrete!(VectorDataTable), 0),
18411838
NodeInput::network(concrete!(f64), 1), // From the document node's parameters
18421839
NodeInput::network(concrete!(f64), 2), // From the document node's parameters
18431840
NodeInput::network(concrete!(f64), 3), // From the document node's parameters
@@ -1874,7 +1871,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
18741871
..Default::default()
18751872
}),
18761873
inputs: vec![
1877-
NodeInput::value(TaggedValue::VectorData(graphene_core::vector::VectorDataTable::default()), true),
1874+
NodeInput::value(TaggedValue::VectorData(VectorDataTable::default()), true),
18781875
NodeInput::value(TaggedValue::F64(100.), false),
18791876
NodeInput::value(TaggedValue::F64(0.), false),
18801877
NodeInput::value(TaggedValue::F64(0.), false),
@@ -1983,7 +1980,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
19831980
nodes: [
19841981
DocumentNode {
19851982
inputs: vec![
1986-
NodeInput::network(concrete!(graphene_core::vector::VectorDataTable), 0),
1983+
NodeInput::network(concrete!(VectorDataTable), 0),
19871984
NodeInput::network(concrete!(f64), 1),
19881985
NodeInput::network(concrete!(u32), 2),
19891986
],
@@ -2017,7 +2014,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
20172014
..Default::default()
20182015
}),
20192016
inputs: vec![
2020-
NodeInput::value(TaggedValue::VectorData(graphene_core::vector::VectorDataTable::default()), true),
2017+
NodeInput::value(TaggedValue::VectorData(VectorDataTable::default()), true),
20212018
NodeInput::value(TaggedValue::F64(10.), false),
20222019
NodeInput::value(TaggedValue::U32(0), false),
20232020
],
@@ -2112,8 +2109,8 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
21122109
}
21132110
};
21142111
}
2115-
let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap();
2116-
'outer: for (id, metadata) in graphene_core::registry::NODE_METADATA.lock().unwrap().iter() {
2112+
let node_registry = registry::NODE_REGISTRY.lock().unwrap();
2113+
'outer: for (id, metadata) in registry::NODE_METADATA.lock().unwrap().iter() {
21172114
use graphene_core::registry::*;
21182115
let id = id.clone();
21192116

@@ -2900,8 +2897,8 @@ pub fn collect_node_types() -> Vec<FrontendNodeType> {
29002897
.collect();
29012898
let mut extracted_node_types = Vec::new();
29022899

2903-
let node_registry = graphene_core::registry::NODE_REGISTRY.lock().unwrap();
2904-
let node_metadata = graphene_core::registry::NODE_METADATA.lock().unwrap();
2900+
let node_registry = registry::NODE_REGISTRY.lock().unwrap();
2901+
let node_metadata = registry::NODE_METADATA.lock().unwrap();
29052902
for (id, metadata) in node_metadata.iter() {
29062903
if let Some(implementations) = node_registry.get(id) {
29072904
let identifier = match id_to_identifier_map.get(id) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct FrontendGraphOutput {
7171

7272
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize, specta::Type)]
7373
pub struct FrontendNode {
74-
pub id: graph_craft::document::NodeId,
74+
pub id: NodeId,
7575
#[serde(rename = "isLayer")]
7676
pub is_layer: bool,
7777
#[serde(rename = "canBeLayer")]

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ impl OverlayContext {
423423

424424
pub fn draw_scale(&mut self, start: DVec2, scale: f64, radius: f64, text: &str) {
425425
let sign = scale.signum();
426-
let mut fill_color = graphene_std::Color::from_rgb_str(crate::consts::COLOR_OVERLAY_WHITE.strip_prefix('#').unwrap())
427-
.unwrap()
428-
.with_alpha(0.05)
429-
.to_rgba_hex_srgb();
426+
let mut fill_color = Color::from_rgb_str(COLOR_OVERLAY_WHITE.strip_prefix('#').unwrap()).unwrap().with_alpha(0.05).to_rgba_hex_srgb();
430427
fill_color.insert(0, '#');
431428
let fill_color = Some(fill_color.as_str());
432429
self.line(start + DVec2::X * radius * sign, start + DVec2::X * (radius * scale), None, None);
@@ -463,10 +460,7 @@ impl OverlayContext {
463460

464461
// Hover ring
465462
if show_hover_ring {
466-
let mut fill_color = graphene_std::Color::from_rgb_str(COLOR_OVERLAY_BLUE.strip_prefix('#').unwrap())
467-
.unwrap()
468-
.with_alpha(0.5)
469-
.to_rgba_hex_srgb();
463+
let mut fill_color = Color::from_rgb_str(COLOR_OVERLAY_BLUE.strip_prefix('#').unwrap()).unwrap().with_alpha(0.5).to_rgba_hex_srgb();
470464
fill_color.insert(0, '#');
471465

472466
self.render_context.set_line_width(HOVER_RING_STROKE_WIDTH);
@@ -650,7 +644,7 @@ impl OverlayContext {
650644

651645
/// Used by the Select tool to outline a path or a free point when selected or hovered.
652646
pub fn outline(&mut self, target_types: impl Iterator<Item = impl Borrow<ClickTargetType>>, transform: DAffine2, color: Option<&str>) {
653-
let mut subpaths: Vec<bezier_rs::Subpath<PointId>> = vec![];
647+
let mut subpaths: Vec<Subpath<PointId>> = vec![];
654648

655649
target_types.for_each(|target_type| match target_type.borrow() {
656650
ClickTargetType::FreePoint(point) => {

0 commit comments

Comments
 (0)