Skip to content

Commit 16229ae

Browse files
committed
Merge branch 'master' into node-network-interface
2 parents faf6e55 + e66620d commit 16229ae

File tree

113 files changed

+4762
-3016
lines changed

Some content is hidden

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

113 files changed

+4762
-3016
lines changed

Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
"libraries/dyn-any",
2020
"libraries/bezier-rs",
2121
"libraries/raw-rs",
22+
"libraries/raw-rs/tag-derive",
2223
"website/other/bezier-rs-demos/wasm",
2324
]
2425
resolver = "2"
@@ -48,7 +49,7 @@ tempfile = "3"
4849
thiserror = "1.0"
4950
anyhow = "1.0.66"
5051
proc-macro2 = "1"
51-
syn = { version = "2.0", default-features = false, features = ["full"] }
52+
syn = { version = "2.0", default-features = false, features = ["full", "derive"] }
5253
quote = "1.0"
5354
axum = "0.6"
5455
chrono = "^0.4.23"

demo-artwork/isometric-fountain.graphite

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-artwork/just-a-potted-cactus.graphite

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-artwork/procedural-string-lights.graphite

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-artwork/red-dress.graphite

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-artwork/valley-of-spires.graphite

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editor/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,10 @@ web-sys = { workspace = true, features = [
6464
[dev-dependencies]
6565
env_logger = "0.10"
6666
futures = { workspace = true }
67+
tokio = { workspace = true, features = ["rt", "macros"] }
68+
69+
[lints.rust]
70+
# TODO: figure out why we check these features when they do not exist
71+
unexpected_cfgs = { level = "warn", check-cfg = [
72+
'cfg(feature, values("resvg", "vello"))',
73+
] }

editor/src/application.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ impl Editor {
2121
std::mem::take(&mut self.dispatcher.responses)
2222
}
2323

24-
pub fn poll_node_graph_evaluation(&mut self, responses: &mut VecDeque<Message>) {
25-
self.dispatcher.poll_node_graph_evaluation(responses);
24+
pub fn poll_node_graph_evaluation(&mut self, responses: &mut VecDeque<Message>) -> Result<(), String> {
25+
self.dispatcher.poll_node_graph_evaluation(responses)
2626
}
2727
}
2828

editor/src/consts.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub const MANIPULATOR_GROUP_MARKER_SIZE: f64 = 6.;
4949
pub const SELECTION_THRESHOLD: f64 = 10.;
5050
pub const HIDE_HANDLE_DISTANCE: f64 = 3.;
5151
pub const INSERT_POINT_ON_SEGMENT_TOO_FAR_DISTANCE: f64 = 50.;
52-
pub const INSERT_POINT_ON_SEGMENT_TOO_CLOSE_DISTANCE: f64 = 5.;
5352

5453
// Pen tool
5554
pub const CREATE_CURVE_THRESHOLD: f64 = 5.;

editor/src/dispatcher.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
3636
))),
3737
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::DocumentStructureChanged)),
3838
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::Overlays(OverlaysMessageDiscriminant::Draw))),
39+
MessageDiscriminant::Portfolio(PortfolioMessageDiscriminant::Document(DocumentMessageDiscriminant::RenderRulers)),
3940
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateDocumentLayerStructure),
4041
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::TriggerFontLoad),
4142
];
@@ -205,8 +206,8 @@ impl Dispatcher {
205206
list
206207
}
207208

208-
pub fn poll_node_graph_evaluation(&mut self, responses: &mut VecDeque<Message>) {
209-
self.message_handlers.portfolio_message_handler.poll_node_graph_evaluation(responses);
209+
pub fn poll_node_graph_evaluation(&mut self, responses: &mut VecDeque<Message>) -> Result<(), String> {
210+
self.message_handlers.portfolio_message_handler.poll_node_graph_evaluation(responses)
210211
}
211212

212213
/// Create the tree structure for logging the messages as a tree
@@ -262,10 +263,7 @@ mod test {
262263
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
263264
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
264265
use crate::messages::prelude::*;
265-
use crate::messages::tool::tool_messages::tool_prelude::ToolType;
266266
use crate::test_utils::EditorTestUtils;
267-
268-
use graph_craft::document::NodeId;
269267
use graphene_core::raster::color::Color;
270268

271269
fn init_logger() {
@@ -412,11 +410,9 @@ mod test {
412410
assert_eq!(layers_after_copy[5], shape_id);
413411
}
414412

415-
// TODO: Fix text
416-
#[ignore]
417-
#[test]
413+
#[tokio::test]
418414
/// This test will fail when you make changes to the underlying serialization format for a document.
419-
fn check_if_demo_art_opens() {
415+
async fn check_if_demo_art_opens() {
420416
use crate::messages::layout::utility_types::widget_prelude::*;
421417

422418
let print_problem_to_terminal_on_failure = |value: &String| {
@@ -449,6 +445,16 @@ mod test {
449445
document_name: document_name.into(),
450446
document_serialized_content,
451447
});
448+
println!("Responses:\n{responses:#?}");
449+
450+
// Check if the graph renders
451+
let portfolio = &mut editor.dispatcher.message_handlers.portfolio_message_handler;
452+
portfolio
453+
.executor
454+
.submit_node_graph_evaluation(portfolio.documents.get_mut(&portfolio.active_document_id.unwrap()).unwrap(), glam::UVec2::ONE);
455+
crate::node_graph_executor::run_node_graph().await;
456+
let mut messages = VecDeque::new();
457+
editor.poll_node_graph_evaluation(&mut messages).expect("Graph should render");
452458

453459
for response in responses {
454460
// Check for the existence of the file format incompatibility warning dialog after opening the test file

editor/src/messages/frontend/frontend_message.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ pub enum FrontendMessage {
9999
#[serde(rename = "copyText")]
100100
copy_text: String,
101101
},
102+
// TODO: Eventually remove this (probably starting late 2024)
103+
TriggerUpgradeDocumentToVectorManipulationFormat {
104+
#[serde(rename = "documentId")]
105+
document_id: DocumentId,
106+
#[serde(rename = "documentName")]
107+
document_name: String,
108+
#[serde(rename = "documentIsAutoSaved")]
109+
document_is_auto_saved: bool,
110+
#[serde(rename = "documentIsSaved")]
111+
document_is_saved: bool,
112+
#[serde(rename = "documentSerializedContent")]
113+
document_serialized_content: String,
114+
},
102115
TriggerViewportResize,
103116
TriggerVisitLink {
104117
url: String,

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

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,12 @@ impl DocumentMessageHandler {
11451145
}
11461146

11471147
/// Find the deepest layer given in the sorted array (by returning the one which is not a folder from the list of layers under the click location).
1148-
pub fn find_deepest(&self, node_list: &[LayerNodeIdentifier], metadata: &DocumentMetadata) -> Option<LayerNodeIdentifier> {
1148+
pub fn find_deepest(&self, node_list: &[LayerNodeIdentifier]) -> Option<LayerNodeIdentifier> {
11491149
node_list
11501150
.iter()
11511151
.find(|&&layer| {
11521152
if layer != LayerNodeIdentifier::ROOT_PARENT {
1153-
layer.has_children(metadata)
1153+
layer.has_children(self.network_interface.document_metadata())
11541154
} else {
11551155
log::error!("ROOT_PARENT should not exist in find_deepest");
11561156
false
@@ -1160,35 +1160,27 @@ impl DocumentMessageHandler {
11601160
}
11611161

11621162
/// Find any layers sorted by index that are under the given location in viewport space.
1163-
pub fn click_list_any(&self, viewport_location: DVec2) -> Vec<LayerNodeIdentifier> {
1164-
self.click_xray(viewport_location)
1165-
.filter(|&layer| !self.network_interface.is_artboard(&layer.to_node()))
1166-
.collect::<Vec<_>>()
1163+
pub fn click_xray_no_artboards<'a>(&'a self, viewport_location: DVec2) -> impl Iterator<Item = LayerNodeIdentifier> + 'a {
1164+
self.click_xray(viewport_location).filter(move |&layer| !self.network_interface.is_artboard(&layer.to_node()))
11671165
}
11681166

11691167
/// Find layers under the location in viewport space that was clicked, listed by their depth in the layer tree hierarchy.
1170-
pub fn click_list(&self, viewport_location: DVec2, metadata: &DocumentMetadata) -> Vec<LayerNodeIdentifier> {
1171-
let mut node_list = self.click_list_any(viewport_location);
1172-
node_list.truncate(
1173-
node_list
1174-
.iter()
1175-
.position(|&layer| {
1176-
if layer != LayerNodeIdentifier::ROOT_PARENT {
1177-
layer.has_children(metadata)
1178-
} else {
1179-
log::error!("ROOT_PARENT should not exist in click_list_any");
1180-
false
1181-
}
1182-
})
1183-
.unwrap_or(0)
1184-
+ 1,
1185-
);
1186-
node_list
1168+
pub fn click_list<'a>(&'a self, viewport_location: DVec2) -> impl Iterator<Item = LayerNodeIdentifier> + 'a {
1169+
self.click_xray_no_artboards(viewport_location)
1170+
.skip_while(|&layer| layer == LayerNodeIdentifier::ROOT_PARENT)
1171+
.scan(true, |last_had_children, layer| {
1172+
if *last_had_children {
1173+
*last_had_children = layer.has_children(self.network_interface.document_metadata());
1174+
Some(layer)
1175+
} else {
1176+
None
1177+
}
1178+
})
11871179
}
11881180

11891181
/// Find the deepest layer that has been clicked on from a location in viewport space.
1190-
pub fn click(&self, viewport_location: DVec2, metadata: &DocumentMetadata) -> Option<LayerNodeIdentifier> {
1191-
self.click_list(viewport_location, metadata).last().copied()
1182+
pub fn click(&self, viewport_location: DVec2) -> Option<LayerNodeIdentifier> {
1183+
self.click_list(viewport_location).last()
11921184
}
11931185

11941186
/// Get the combined bounding box of the click targets of the selected visible layers in viewport space

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::utility_types::TransformIn;
2-
use super::utility_types::VectorDataModification;
32
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
43
use crate::messages::portfolio::document::utility_types::network_interface::NodeTemplate;
54
use crate::messages::prelude::*;
@@ -8,9 +7,10 @@ use bezier_rs::Subpath;
87
use graph_craft::document::{DocumentNode, NodeId, NodeInput};
98
use graphene_core::raster::{BlendMode, ImageFrame};
109
use graphene_core::text::Font;
11-
use graphene_core::uuid::ManipulatorGroupId;
1210
use graphene_core::vector::brush_stroke::BrushStroke;
1311
use graphene_core::vector::style::{Fill, Stroke};
12+
use graphene_core::vector::PointId;
13+
use graphene_core::vector::VectorModificationType;
1414
use graphene_core::{Artboard, Color};
1515
use graphene_std::vector::misc::BooleanOperation;
1616

@@ -46,11 +46,6 @@ pub enum GraphOperationMessage {
4646
layer: LayerNodeIdentifier,
4747
blend_mode: BlendMode,
4848
},
49-
UpdateBounds {
50-
layer: LayerNodeIdentifier,
51-
old_bounds: [DVec2; 2],
52-
new_bounds: [DVec2; 2],
53-
},
5449
StrokeSet {
5550
layer: LayerNodeIdentifier,
5651
stroke: Stroke,
@@ -73,7 +68,7 @@ pub enum GraphOperationMessage {
7368
},
7469
Vector {
7570
layer: LayerNodeIdentifier,
76-
modification: VectorDataModification,
71+
modification_type: VectorModificationType,
7772
},
7873
Brush {
7974
layer: LayerNodeIdentifier,
@@ -97,7 +92,7 @@ pub enum GraphOperationMessage {
9792
},
9893
NewVectorLayer {
9994
id: NodeId,
100-
subpaths: Vec<Subpath<ManipulatorGroupId>>,
95+
subpaths: Vec<Subpath<PointId>>,
10196
parent: LayerNodeIdentifier,
10297
insert_index: isize,
10398
},

0 commit comments

Comments
 (0)