mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 03:18:11 +08:00
Desktop: Move wrapper to separate crate (#3073)
Move desktop wrapper to separate crate
This commit is contained in:
Generated
+19
-5
@@ -2083,10 +2083,7 @@ dependencies = [
|
|||||||
"dirs",
|
"dirs",
|
||||||
"futures",
|
"futures",
|
||||||
"glam",
|
"glam",
|
||||||
"graph-craft",
|
"graphite-desktop-wrapper",
|
||||||
"graphene-std",
|
|
||||||
"graphite-editor",
|
|
||||||
"image",
|
|
||||||
"include_dir",
|
"include_dir",
|
||||||
"open",
|
"open",
|
||||||
"rfd",
|
"rfd",
|
||||||
@@ -2096,10 +2093,27 @@ dependencies = [
|
|||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"vello",
|
"vello",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
"wgpu-executor",
|
|
||||||
"winit",
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "graphite-desktop-wrapper"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"dirs",
|
||||||
|
"futures",
|
||||||
|
"graph-craft",
|
||||||
|
"graphene-std",
|
||||||
|
"graphite-editor",
|
||||||
|
"image",
|
||||||
|
"ron",
|
||||||
|
"thiserror 2.0.12",
|
||||||
|
"tracing",
|
||||||
|
"vello",
|
||||||
|
"wgpu",
|
||||||
|
"wgpu-executor",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphite-editor"
|
name = "graphite-editor"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
members = [
|
members = [
|
||||||
"editor",
|
"editor",
|
||||||
"desktop",
|
"desktop",
|
||||||
|
"desktop/wrapper",
|
||||||
"proc-macros",
|
"proc-macros",
|
||||||
"frontend/wasm",
|
"frontend/wasm",
|
||||||
"node-graph/gapplication-io",
|
"node-graph/gapplication-io",
|
||||||
|
|||||||
+2
-10
@@ -10,18 +10,11 @@ rust-version = "1.87"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["gpu"]
|
default = ["gpu"]
|
||||||
gpu = ["graphite-editor/gpu"]
|
gpu = ["graphite-desktop-wrapper/gpu"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# # Local dependencies
|
# # Local dependencies
|
||||||
graphite-editor = { path = "../editor", features = [
|
graphite-desktop-wrapper = { path = "wrapper" }
|
||||||
"gpu",
|
|
||||||
"ron",
|
|
||||||
"vello",
|
|
||||||
] }
|
|
||||||
graphene-std = { workspace = true }
|
|
||||||
graph-craft = { workspace = true }
|
|
||||||
wgpu-executor = { workspace = true }
|
|
||||||
|
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
winit = { workspace = true, features = ["serde"] }
|
winit = { workspace = true, features = ["serde"] }
|
||||||
@@ -39,4 +32,3 @@ vello = { workspace = true }
|
|||||||
derivative = { workspace = true }
|
derivative = { workspace = true }
|
||||||
rfd = { workspace = true }
|
rfd = { workspace = true }
|
||||||
open = { workspace = true }
|
open = { workspace = true }
|
||||||
image = { workspace = true }
|
|
||||||
|
|||||||
+3
-7
@@ -1,13 +1,9 @@
|
|||||||
use crate::CustomEvent;
|
use crate::CustomEvent;
|
||||||
use crate::WindowSize;
|
use crate::cef::WindowSize;
|
||||||
use crate::consts::APP_NAME;
|
use crate::consts::APP_NAME;
|
||||||
use crate::desktop_wrapper::DesktopWrapper;
|
|
||||||
use crate::desktop_wrapper::NodeGraphExecutionResult;
|
|
||||||
use crate::desktop_wrapper::WgpuContext;
|
|
||||||
use crate::desktop_wrapper::messages::DesktopFrontendMessage;
|
|
||||||
use crate::desktop_wrapper::messages::DesktopWrapperMessage;
|
|
||||||
use crate::desktop_wrapper::serialize_frontend_messages;
|
|
||||||
use crate::render::GraphicsState;
|
use crate::render::GraphicsState;
|
||||||
|
use graphite_desktop_wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage};
|
||||||
|
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
|
||||||
use rfd::AsyncFileDialog;
|
use rfd::AsyncFileDialog;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
use crate::desktop_wrapper::WgpuContext;
|
use crate::CustomEvent;
|
||||||
use crate::render::FrameBufferRef;
|
use crate::render::FrameBufferRef;
|
||||||
use crate::{CustomEvent, desktop_wrapper::deserialize_editor_message};
|
use graphite_desktop_wrapper::{WgpuContext, deserialize_editor_message};
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::mpsc::Receiver;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|||||||
+4
-5
@@ -6,7 +6,7 @@ use winit::event_loop::EventLoop;
|
|||||||
pub(crate) mod consts;
|
pub(crate) mod consts;
|
||||||
|
|
||||||
mod cef;
|
mod cef;
|
||||||
use cef::{Setup, WindowSize};
|
use cef::Setup;
|
||||||
|
|
||||||
mod render;
|
mod render;
|
||||||
|
|
||||||
@@ -15,9 +15,8 @@ use app::WinitApp;
|
|||||||
|
|
||||||
mod dirs;
|
mod dirs;
|
||||||
|
|
||||||
mod desktop_wrapper;
|
use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
|
||||||
use desktop_wrapper::messages::DesktopWrapperMessage;
|
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext};
|
||||||
use desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult};
|
|
||||||
|
|
||||||
pub(crate) enum CustomEvent {
|
pub(crate) enum CustomEvent {
|
||||||
UiUpdate(wgpu::Texture),
|
UiUpdate(wgpu::Texture),
|
||||||
@@ -42,7 +41,7 @@ fn main() {
|
|||||||
|
|
||||||
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
|
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
|
||||||
|
|
||||||
let wgpu_context = futures::executor::block_on(desktop_wrapper::WgpuContext::new()).unwrap();
|
let wgpu_context = futures::executor::block_on(WgpuContext::new()).unwrap();
|
||||||
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy(), wgpu_context.clone())) {
|
let cef_context = match cef_context.init(cef::CefHandler::new(window_size_receiver, event_loop.create_proxy(), wgpu_context.clone())) {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(cef::InitError::AlreadyRunning) => {
|
Err(cef::InitError::AlreadyRunning) => {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
use graphene_std::Color;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wgpu_executor::WgpuExecutor;
|
|
||||||
use winit::window::Window;
|
use winit::window::Window;
|
||||||
|
|
||||||
use crate::desktop_wrapper::WgpuContext;
|
use graphite_desktop_wrapper::{Color, WgpuContext, WgpuExecutor};
|
||||||
|
|
||||||
#[derive(derivative::Derivative)]
|
#[derive(derivative::Derivative)]
|
||||||
#[derivative(Debug)]
|
#[derivative(Debug)]
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
[package]
|
||||||
|
name = "graphite-desktop-wrapper"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Graphite Desktop Wrapper"
|
||||||
|
authors = ["Graphite Authors <contact@graphite.rs>"]
|
||||||
|
license = "Apache-2.0"
|
||||||
|
repository = ""
|
||||||
|
edition = "2024"
|
||||||
|
rust-version = "1.87"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["gpu"]
|
||||||
|
gpu = ["graphite-editor/gpu"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
# Local dependencies
|
||||||
|
graphite-editor = { path = "../../editor", features = [
|
||||||
|
"gpu",
|
||||||
|
"ron",
|
||||||
|
"vello",
|
||||||
|
] }
|
||||||
|
graphene-std = { workspace = true }
|
||||||
|
graph-craft = { workspace = true }
|
||||||
|
wgpu-executor = { workspace = true }
|
||||||
|
|
||||||
|
wgpu = { workspace = true }
|
||||||
|
thiserror = { workspace = true }
|
||||||
|
futures = { workspace = true }
|
||||||
|
tracing = { workspace = true }
|
||||||
|
dirs = { workspace = true }
|
||||||
|
ron = { workspace = true}
|
||||||
|
vello = { workspace = true }
|
||||||
|
image = { workspace = true }
|
||||||
@@ -2,7 +2,11 @@ use graph_craft::wasm_application_io::WasmApplicationIo;
|
|||||||
use graphite_editor::application::Editor;
|
use graphite_editor::application::Editor;
|
||||||
use graphite_editor::messages::prelude::{FrontendMessage, Message};
|
use graphite_editor::messages::prelude::{FrontendMessage, Message};
|
||||||
|
|
||||||
|
// TODO: Remove usage of this reexport in desktop create and remove this line
|
||||||
|
pub use graphene_std::Color;
|
||||||
|
|
||||||
pub use wgpu_executor::Context as WgpuContext;
|
pub use wgpu_executor::Context as WgpuContext;
|
||||||
|
pub use wgpu_executor::WgpuExecutor;
|
||||||
|
|
||||||
pub mod messages;
|
pub mod messages;
|
||||||
use messages::{DesktopFrontendMessage, DesktopWrapperMessage};
|
use messages::{DesktopFrontendMessage, DesktopWrapperMessage};
|
||||||
@@ -43,6 +47,12 @@ impl DesktopWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for DesktopWrapper {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub enum NodeGraphExecutionResult {
|
pub enum NodeGraphExecutionResult {
|
||||||
HasRun(Option<wgpu::Texture>),
|
HasRun(Option<wgpu::Texture>),
|
||||||
NotRun,
|
NotRun,
|
||||||
Reference in New Issue
Block a user