Skip to content

Commit 7088005

Browse files
committed
Migrate more nodes
1 parent f1cae84 commit 7088005

3 files changed

Lines changed: 18 additions & 59 deletions

File tree

editor/src/messages/portfolio/document_migration.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,17 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
8585
"graphene_core::transform_nodes::FreezeRealTimeNode",
8686
],
8787
},
88+
NodeReplacement {
89+
node: graphene_std::memo::monitor::IDENTIFIER,
90+
aliases: &["graphene_core::ops::IntoNode<&WgpuExecutor>"],
91+
},
8892
NodeReplacement {
8993
node: graphene_std::memo::monitor::IDENTIFIER,
9094
aliases: &["graphene_core::memo::MonitorNode"],
9195
},
9296
NodeReplacement {
9397
node: graphene_std::memo::memo::IDENTIFIER,
94-
aliases: &["graphene_core::memo::MemoNode"],
98+
aliases: &["graphene_core::memo::MemoNode", "graphene_core::memo::ImpureMemoNode"],
9599
},
96100
NodeReplacement {
97101
node: graphene_std::animation::real_time::IDENTIFIER,
@@ -698,6 +702,7 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
698702
node: graphene_std::vector::auto_tangents::IDENTIFIER,
699703
aliases: &[
700704
"graphene_core::vector::vector_nodes::AutoTangentsNode",
705+
"graphene_core::vector::AutoTangentsNode",
701706
"graphene_core::vector::GenerateHandlesNode",
702707
"graphene_core::vector::RemoveHandlesNode",
703708
],
@@ -752,7 +757,11 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
752757
},
753758
NodeReplacement {
754759
node: graphene_std::vector::flatten_path::IDENTIFIER,
755-
aliases: &["graphene_core::vector::vector_nodes::FlattenPathNode", "graphene_core::vector::FlattenVectorElementsNode"],
760+
aliases: &[
761+
"graphene_core::vector::vector_nodes::FlattenPathNode",
762+
"graphene_core::vector::FlattenVectorElementsNode",
763+
"graphene_core::vector::FlattenPathNode",
764+
],
756765
},
757766
NodeReplacement {
758767
node: graphene_std::vector::generator_nodes::arc::IDENTIFIER,
@@ -904,7 +913,11 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
904913
},
905914
NodeReplacement {
906915
node: graphene_std::vector::vec_2_to_point::IDENTIFIER,
907-
aliases: &["graphene_core::vector::vector_nodes::PositionToPointNode", "graphene_core::vector::PositionToPointNode"],
916+
aliases: &[
917+
"graphene_core::vector::vector_nodes::PositionToPointNode",
918+
"graphene_core::vector::PositionToPointNode",
919+
"graphene_core::vector::Vec2ToPointNode",
920+
],
908921
},
909922
];
910923

node-graph/libraries/core-types/src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl ExtractRealTime for ContextImpl<'_> {
269269
}
270270
impl ExtractIndex for ContextImpl<'_> {
271271
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
272-
self.index.clone().map(|x| x.into_iter().rev())
272+
self.index.clone().map(|x| x.into_iter())
273273
}
274274
}
275275
impl ExtractVarArgs for ContextImpl<'_> {
@@ -305,7 +305,7 @@ impl ExtractAnimationTime for OwnedContextImpl {
305305
}
306306
impl ExtractIndex for OwnedContextImpl {
307307
fn try_index(&self) -> Option<impl Iterator<Item = usize>> {
308-
self.index.clone().map(|x| x.into_iter().rev())
308+
self.index.clone().map(|x| x.into_iter())
309309
}
310310
}
311311
impl ExtractVarArgs for OwnedContextImpl {

node-graph/nodes/gcore/src/memo.rs

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -64,60 +64,6 @@ pub mod memo {
6464
pub const IDENTIFIER: ProtoNodeIdentifier = ProtoNodeIdentifier::new("graphene_core::memo::MemoNode");
6565
}
6666

67-
/// Caches the output of a given Node and acts as a proxy.
68-
/// In contrast to the regular `MemoNode`, this variant ignores all input.
69-
/// This node might result in the document not updating properly. Use with caution!
70-
#[derive(Default)]
71-
pub struct ImpureMemoNode<I, T, CachedNode> {
72-
cache: Arc<Mutex<Option<T>>>,
73-
node: CachedNode,
74-
_phantom: std::marker::PhantomData<I>,
75-
}
76-
77-
impl<'i, I: 'i, T: 'i + Clone + WasmNotSend, CachedNode: 'i> Node<'i, I> for ImpureMemoNode<I, T, CachedNode>
78-
where
79-
CachedNode: for<'any_input> Node<'any_input, I>,
80-
for<'a> <CachedNode as Node<'a, I>>::Output: Future<Output = T> + WasmNotSend,
81-
{
82-
// TODO: This should return a reference to the cached cached_value but that requires a lot of lifetime magic
83-
// TODO: (This was suggested by copilot but is pretty accurate xD)
84-
type Output = DynFuture<'i, T>;
85-
fn eval(&'i self, input: I) -> Self::Output {
86-
if let Some(cached_value) = self.cache.lock().as_ref().unwrap().deref() {
87-
let data = cached_value.clone();
88-
Box::pin(async move { data })
89-
} else {
90-
let fut = self.node.eval(input);
91-
let cache = self.cache.clone();
92-
Box::pin(async move {
93-
let value = fut.await;
94-
*cache.lock().unwrap() = Some(value.clone());
95-
value
96-
})
97-
}
98-
}
99-
100-
fn reset(&self) {
101-
self.cache.lock().unwrap().take();
102-
}
103-
}
104-
105-
impl<T, I, CachedNode> ImpureMemoNode<I, T, CachedNode> {
106-
pub fn new(node: CachedNode) -> ImpureMemoNode<I, T, CachedNode> {
107-
ImpureMemoNode {
108-
cache: Default::default(),
109-
node,
110-
_phantom: std::marker::PhantomData,
111-
}
112-
}
113-
}
114-
115-
pub mod impure_memo {
116-
use core_types::ProtoNodeIdentifier;
117-
118-
pub const IDENTIFIER: ProtoNodeIdentifier = ProtoNodeIdentifier::new("graphene_core::memo::ImpureMemoNode");
119-
}
120-
12167
/// Caches the output of the last graph evaluation for introspection
12268
#[derive(Default)]
12369
pub struct MonitorNode<I, T, N> {

0 commit comments

Comments
 (0)