mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 15:18:12 +08:00
Make the dynamic node graph execution asynchronous (#1218)
* Make node graph execution async Make node macro generate async node implementations Start propagating async through the node system Async checkpoint Make Any<'i> Send + Sync Determine node io type using panic node Fix types for raster_node macro Finish porting node registry? Fix lifetime errors Remove Send + Sync requirements and start making node construction async Async MVP Fix tests Clippy fix * Fix nodes * Simplify lifetims for node macro + make node macro more modular * Reenable more nodes * Fix pasting images * Remove http test from brush node * Fix output type for cache node * Fix types for let scope * Fix formatting
This commit is contained in:
@@ -1505,7 +1505,7 @@ impl DocumentMessageHandler {
|
||||
/// When working with an insert index, deleting the layers may cause the insert index to point to a different location (if the layer being deleted was located before the insert index).
|
||||
///
|
||||
/// This function updates the insert index so that it points to the same place after the specified `layers` are deleted.
|
||||
fn update_insert_index<'a>(&self, layers: &[&'a [LayerId]], path: &[LayerId], insert_index: isize, reverse_index: bool) -> Result<isize, DocumentError> {
|
||||
fn update_insert_index(&self, layers: &[&[LayerId]], path: &[LayerId], insert_index: isize, reverse_index: bool) -> Result<isize, DocumentError> {
|
||||
let folder = self.document_legacy.folder(path)?;
|
||||
let insert_index = if reverse_index { folder.layer_ids.len() as isize - insert_index } else { insert_index };
|
||||
let layer_ids_above = if insert_index < 0 { &folder.layer_ids } else { &folder.layer_ids[..(insert_index as usize)] };
|
||||
|
||||
+10
-15
@@ -96,7 +96,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
vec![
|
||||
DocumentNodeType {
|
||||
name: "Identity",
|
||||
category: "General",
|
||||
category: "Structural",
|
||||
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"),
|
||||
inputs: vec![DocumentInputType {
|
||||
name: "In",
|
||||
@@ -108,7 +108,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Monitor",
|
||||
category: "General",
|
||||
category: "Structural",
|
||||
identifier: NodeImplementation::proto("graphene_core::ops::IdNode"),
|
||||
inputs: vec![DocumentInputType {
|
||||
name: "In",
|
||||
@@ -186,7 +186,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
category: "Ignore",
|
||||
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
||||
inputs: vec![0],
|
||||
outputs: vec![NodeOutput::new(2, 0)],
|
||||
outputs: vec![NodeOutput::new(1, 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
name: "Downres".to_string(),
|
||||
@@ -200,12 +200,13 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_std::memo::CacheNode")),
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
// We currently just clone by default
|
||||
/*DocumentNode {
|
||||
name: "Clone".to_string(),
|
||||
inputs: vec![NodeInput::node(1, 0)],
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::CloneNode<_>")),
|
||||
..Default::default()
|
||||
},
|
||||
},*/
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
@@ -263,10 +264,10 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Begin Scope",
|
||||
category: "Structural",
|
||||
category: "Ignore",
|
||||
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
||||
inputs: vec![0, 2],
|
||||
outputs: vec![NodeOutput::new(1, 0), NodeOutput::new(3, 0)],
|
||||
outputs: vec![NodeOutput::new(1, 0), NodeOutput::new(2, 0)],
|
||||
nodes: [
|
||||
DocumentNode {
|
||||
name: "SetNode".to_string(),
|
||||
@@ -286,12 +287,6 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_std::memo::RefNode<_, _>")),
|
||||
..Default::default()
|
||||
},
|
||||
DocumentNode {
|
||||
name: "CloneNode".to_string(),
|
||||
inputs: vec![NodeInput::node(2, 0)],
|
||||
implementation: DocumentNodeImplementation::Unresolved(NodeIdentifier::new("graphene_core::ops::CloneNode<_>")),
|
||||
..Default::default()
|
||||
},
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
@@ -319,7 +314,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "End Scope",
|
||||
category: "Structural",
|
||||
category: "Ignore",
|
||||
identifier: NodeImplementation::proto("graphene_std::memo::EndLetNode<_>"),
|
||||
inputs: vec![
|
||||
DocumentInputType {
|
||||
@@ -596,7 +591,7 @@ fn static_nodes() -> Vec<DocumentNodeType> {
|
||||
},
|
||||
DocumentNodeType {
|
||||
name: "Gaussian Blur",
|
||||
category: "Image Filters",
|
||||
category: "Ignore",
|
||||
identifier: NodeImplementation::DocumentNode(NodeNetwork {
|
||||
inputs: vec![0, 1, 1],
|
||||
outputs: vec![NodeOutput::new(1, 0)],
|
||||
|
||||
@@ -24,7 +24,7 @@ struct ManipulatorGroupOverlays {
|
||||
pub out_line: Option<Vec<LayerId>>,
|
||||
}
|
||||
impl ManipulatorGroupOverlays {
|
||||
pub fn iter<'a>(&'a self) -> impl Iterator<Item = &'a Option<Vec<LayerId>>> {
|
||||
pub fn iter(&self) -> impl Iterator<Item = &'_ Option<Vec<LayerId>>> {
|
||||
[&self.anchor, &self.in_handle, &self.in_line, &self.out_handle, &self.out_line].into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ impl ShapeState {
|
||||
}
|
||||
|
||||
/// Provide the currently selected points by reference.
|
||||
pub fn selected_points<'a>(&'a self) -> impl Iterator<Item = &'a ManipulatorPointId> {
|
||||
pub fn selected_points(&self) -> impl Iterator<Item = &'_ ManipulatorPointId> {
|
||||
self.selected_shape_state.values().flat_map(|state| &state.selected_points)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user