mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 10:58:12 +08:00
Replace globals with editor environment (#3656)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use graph_craft::wasm_application_io::WasmApplicationIo;
|
||||
use graphite_editor::application::Editor;
|
||||
use graphite_editor::application::{Editor, Environment, Host, Platform};
|
||||
use graphite_editor::messages::prelude::{FrontendMessage, Message};
|
||||
|
||||
// TODO: Remove usage of this reexport in desktop create and remove this line
|
||||
@@ -27,8 +27,18 @@ pub struct DesktopWrapper {
|
||||
}
|
||||
|
||||
impl DesktopWrapper {
|
||||
pub fn new() -> Self {
|
||||
Self { editor: Editor::new() }
|
||||
pub fn new(uuid_random_seed: u64) -> Self {
|
||||
#[cfg(target_os = "windows")]
|
||||
let host = Host::Windows;
|
||||
#[cfg(target_os = "macos")]
|
||||
let host = Host::Mac;
|
||||
#[cfg(target_os = "linux")]
|
||||
let host = Host::Linux;
|
||||
let env = Environment { platform: Platform::Desktop, host };
|
||||
|
||||
Self {
|
||||
editor: Editor::new(env, uuid_random_seed),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(&self, wgpu_context: WgpuContext) {
|
||||
@@ -51,12 +61,6 @@ impl DesktopWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DesktopWrapper {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
pub enum NodeGraphExecutionResult {
|
||||
HasRun(Option<wgpu::Texture>),
|
||||
NotRun,
|
||||
|
||||
Reference in New Issue
Block a user