Skip to content

Commit 1ff1dbd

Browse files
Fix tests
1 parent 3c27e65 commit 1ff1dbd

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

editor/src/application.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ impl Editor {
2323
let _ = ENVIRONMENT.set(*Editor::environment());
2424
graphene_std::uuid::set_uuid_seed(0);
2525

26-
let (runtime, executor) = crate::node_graph_executor::NodeGraphExecutor::new_with_local_runtime();
26+
let (mut runtime, executor) = crate::node_graph_executor::NodeGraphExecutor::new_with_local_runtime();
2727
let editor = Self {
2828
dispatcher: Dispatcher::with_executor(executor),
2929
};
3030

31+
let mut application_io = PlatformApplicationIo::default();
32+
application_io.inject_resources(editor.dispatcher.message_handlers.resource_message_handler.resources());
33+
runtime.replace_application_io(application_io);
34+
3135
(editor, runtime)
3236
}
3337

editor/src/node_graph_executor/runtime.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,17 @@ pub async fn replace_node_runtime(runtime: NodeRuntime) -> Option<NodeRuntime> {
569569
pub(crate) async fn replace_application_io(application_io: PlatformApplicationIo) {
570570
let mut node_runtime = NODE_RUNTIME.lock();
571571
if let Some(node_runtime) = &mut *node_runtime {
572-
node_runtime.editor_api = PlatformEditorApi {
573-
font_cache: node_runtime.editor_api.font_cache.clone(),
572+
node_runtime.replace_application_io(application_io);
573+
}
574+
}
575+
576+
impl NodeRuntime {
577+
pub(crate) fn replace_application_io(&mut self, application_io: PlatformApplicationIo) {
578+
self.editor_api = PlatformEditorApi {
579+
font_cache: self.editor_api.font_cache.clone(),
574580
application_io: Some(application_io.into()),
575-
node_graph_message_sender: Box::new(node_runtime.sender.clone()),
576-
editor_preferences: Box::new(node_runtime.editor_preferences.clone()),
581+
node_graph_message_sender: Box::new(self.sender.clone()),
582+
editor_preferences: Box::new(self.editor_preferences.clone()),
577583
}
578584
.into();
579585
}

0 commit comments

Comments
 (0)