diff --git a/editor/src/test_utils.rs b/editor/src/test_utils.rs index f1ae76b613..81d14974ea 100644 --- a/editor/src/test_utils.rs +++ b/editor/src/test_utils.rs @@ -12,7 +12,6 @@ use crate::test_utils::test_prelude::LayerNodeIdentifier; use glam::DVec2; use graph_craft::document::DocumentNode; use graphene_std::InputAccessor; -use graphene_std::any::EditorContext; use graphene_std::raster::color::Color; /// A set of utility functions to make the writing of editor test more declarative @@ -22,20 +21,20 @@ pub struct EditorTestUtils { } impl EditorTestUtils { - pub fn create() -> Self { - let _ = env_logger::builder().is_test(true).try_init(); - set_uuid_seed(0); + // pub fn create() -> Self { + // let _ = env_logger::builder().is_test(true).try_init(); + // set_uuid_seed(0); - let (mut editor, runtime) = Editor::new_local_executor(); + // let (mut editor, runtime) = Editor::new_local_executor(); - // We have to set this directly instead of using `GlobalsMessage::SetPlatform` because race conditions with multiple tests can cause that message handler to set it more than once, which is a failure. - // It isn't sufficient to guard the message dispatch here with a check if the once_cell is empty, because that isn't atomic and the time between checking and handling the dispatch can let multiple through. - let _ = GLOBAL_PLATFORM.set(Platform::Windows).is_ok(); + // // We have to set this directly instead of using `GlobalsMessage::SetPlatform` because race conditions with multiple tests can cause that message handler to set it more than once, which is a failure. + // // It isn't sufficient to guard the message dispatch here with a check if the once_cell is empty, because that isn't atomic and the time between checking and handling the dispatch can let multiple through. + // let _ = GLOBAL_PLATFORM.set(Platform::Windows).is_ok(); - editor.handle_message(PortfolioMessage::Init); + // editor.handle_message(PortfolioMessage::Init); - Self { editor, runtime } - } + // Self { editor, runtime } + // } // pub fn eval_graph<'a>(&'a mut self) -> impl std::future::Future> + 'a { // // An inner function is required since async functions in traits are a bit weird diff --git a/node-graph/gcore/src/memo.rs b/node-graph/gcore/src/memo.rs index 2530aeb110..a618cfb57a 100644 --- a/node-graph/gcore/src/memo.rs +++ b/node-graph/gcore/src/memo.rs @@ -93,9 +93,12 @@ where drop(cache_guard); + let fut = self.node.eval(input); + let cache = self.cache.clone(); + Box::pin(async move { - let value = self.node.eval(input).await; - *self.cache.lock().unwrap() = Some((hash, Arc::new(value.clone()))); + let value = fut.await; + *cache.lock().unwrap() = Some((hash, Arc::new(value.clone()))); value }) } diff --git a/node-graph/gcore/src/vector/algorithms/instance.rs b/node-graph/gcore/src/vector/algorithms/instance.rs index 1817b7ef2d..eb86287966 100644 --- a/node-graph/gcore/src/vector/algorithms/instance.rs +++ b/node-graph/gcore/src/vector/algorithms/instance.rs @@ -1,12 +1,12 @@ use crate::instances::{InstanceRef, Instances}; use crate::raster_types::{CPU, RasterDataTable}; use crate::vector::VectorDataTable; -use crate::{ Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex}; +use crate::{Context, Ctx, ExtractIndex, ExtractVarArgs, GraphicElement, GraphicGroupTable, WithIndex}; use glam::DVec2; #[node_macro::node(name("Instance on Points"), category("Instancing"), path(graphene_core::vector))] async fn instance_on_points + Default + Send + Clone + 'static>( - ctx: impl Ctx + WithIndex, + ctx: impl Ctx + WithIndex + Sync, points: VectorDataTable, #[implementations( Context -> GraphicGroupTable, diff --git a/node-graph/graph-craft/src/document/value.rs b/node-graph/graph-craft/src/document/value.rs index 9db5890352..a45468e63e 100644 --- a/node-graph/graph-craft/src/document/value.rs +++ b/node-graph/graph-craft/src/document/value.rs @@ -397,7 +397,6 @@ impl Display for TaggedValue { pub struct UpcastNode { value: MemoHash, - inspected: Cell, } impl<'input> Node<'input, DAny<'input>> for UpcastNode { type Output = FutureAny<'input>; @@ -407,13 +406,12 @@ impl<'input> Node<'input, DAny<'input>> for UpcastNode { } fn introspect(&self) -> graphene_core::memo::MonitorIntrospectResult { - let inspected = self.inspected.replace(true); - graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc, !inspected)) + graphene_core::memo::MonitorIntrospectResult::Evaluated((Arc::new(self.value.clone().into_inner()) as Arc, true)) } } impl UpcastNode { pub fn new(value: MemoHash) -> Self { - Self { value, inspected: Cell::new(false) } + Self { value } } } #[derive(Default, Debug, Clone, Copy)] diff --git a/node-graph/graphene-cli/src/main.rs b/node-graph/graphene-cli/src/main.rs index 77c1177943..dc48baf0a0 100644 --- a/node-graph/graphene-cli/src/main.rs +++ b/node-graph/graphene-cli/src/main.rs @@ -7,7 +7,6 @@ use graph_craft::proto::{ProtoNetwork, ProtoNode}; use graph_craft::util::load_network; use graph_craft::wasm_application_io::{EditorPreferences, WasmApplicationIoValue}; use graphene_core::text::FontCache; -use graphene_std::any::EditorContext; use graphene_std::application_io::{ApplicationIo, ApplicationIoValue, NodeGraphUpdateMessage, NodeGraphUpdateSender, RenderConfig}; use graphene_std::wasm_application_io::WasmApplicationIo; use interpreted_executor::dynamic_executor::DynamicExecutor; @@ -180,7 +179,7 @@ fn compile_graph(document_string: String, application_io: Arc let mut network = load_network(&document_string); fix_nodes(&mut network); - let substitutions: std::collections::HashMap = preprocessor::generate_node_substitutions(); + let substitutions = preprocessor::generate_node_substitutions(); preprocessor::expand_network(&mut network, &substitutions); let mut wrapped_network = wrap_network_in_scope(network, Arc::new(FontCache::default()), EditorMetadata::default(), application_io); diff --git a/node-graph/gstd/src/any.rs b/node-graph/gstd/src/any.rs index 36890c0a26..4932687ab6 100644 --- a/node-graph/gstd/src/any.rs +++ b/node-graph/gstd/src/any.rs @@ -3,7 +3,6 @@ pub use graph_craft::proto::{Any, NodeContainer, TypeErasedBox, TypeErasedNode}; use graph_craft::proto::{DynFuture, FutureAny, SharedNodeContainer}; use graphene_core::Context; use graphene_core::ContextDependencies; -use graphene_core::EditorContext; use graphene_core::NodeIO; use graphene_core::OwnedContextImpl; use graphene_core::WasmNotSend; diff --git a/node-graph/interpreted-executor/benches/run_demo_art_criterion.rs b/node-graph/interpreted-executor/benches/run_demo_art_criterion.rs index 6497d257bd..4657e853f0 100644 --- a/node-graph/interpreted-executor/benches/run_demo_art_criterion.rs +++ b/node-graph/interpreted-executor/benches/run_demo_art_criterion.rs @@ -15,7 +15,7 @@ fn update_executor(name: &str, c: &mut BenchmarkGroup) { c.bench_function(name, |b| { b.iter_batched( || (executor.clone(), proto_network.clone()), - |(mut executor, network)| futures::executor::block_on(executor.update(black_box(network, None))), + |(mut executor, network)| futures::executor::block_on(executor.update(black_box(network), None)), criterion::BatchSize::SmallInput, ) }); @@ -33,7 +33,7 @@ fn run_once(name: &str, c: &mut BenchmarkGroup) { let proto_network = network.compile().unwrap().0; let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap(); - let context = graphene_std::any::EditorContext::default(); + let context = graphene_std::EditorContext::default(); c.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).evaluate_from_node(context.clone(), None)))); } diff --git a/node-graph/interpreted-executor/benches/update_executor.rs b/node-graph/interpreted-executor/benches/update_executor.rs index b7d3984fd6..4562b1ab9f 100644 --- a/node-graph/interpreted-executor/benches/update_executor.rs +++ b/node-graph/interpreted-executor/benches/update_executor.rs @@ -16,7 +16,7 @@ fn update_executor(c: &mut Criterion) { let executor = futures::executor::block_on(DynamicExecutor::new(empty)).unwrap(); (executor, proto_network) }, - |(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network, None))), + |(mut executor, network)| futures::executor::block_on(executor.update(criterion::black_box(network), None)), criterion::BatchSize::SmallInput, ) });