Refactor vector data type from document-legacy into node graph (#1057)

Add vector data type
This commit is contained in:
0HyperCube
2023-02-25 16:55:05 +00:00
committed by GitHub
parent d3038665ac
commit ba50614af1
20 changed files with 140 additions and 101 deletions

View File

@@ -23,8 +23,6 @@ serde_json = { version = "1.0" }
graphite-proc-macros = { path = "../proc-macros" }
bezier-rs = { path = "../libraries/bezier-rs" }
glam = { version="0.22", features = ["serde"] }
rand_chacha = "0.3.1"
spin = "0.9.2"
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [
"serde",
] }

View File

@@ -1,15 +1,7 @@
use crate::dispatcher::Dispatcher;
use crate::messages::prelude::*;
use rand_chacha::rand_core::{RngCore, SeedableRng};
use rand_chacha::ChaCha20Rng;
use spin::Mutex;
use std::cell::Cell;
static RNG: Mutex<Option<ChaCha20Rng>> = Mutex::new(None);
thread_local! {
pub static UUID_SEED: Cell<Option<u64>> = Cell::new(None);
}
pub use graphene_core::uuid::*;
// TODO: serialize with serde to save the current editor state
pub struct Editor {
@@ -39,21 +31,6 @@ impl Default for Editor {
}
}
pub fn set_uuid_seed(random_seed: u64) {
UUID_SEED.with(|seed| seed.set(Some(random_seed)))
}
pub fn generate_uuid() -> u64 {
let mut lock = RNG.lock();
if lock.is_none() {
UUID_SEED.with(|seed| {
let random_seed = seed.get().expect("Random seed not set before editor was initialized");
*lock = Some(ChaCha20Rng::seed_from_u64(random_seed));
})
}
lock.as_mut().map(ChaCha20Rng::next_u64).unwrap()
}
pub fn release_series() -> String {
format!("Release Series: {}", env!("GRAPHITE_RELEASE_SERIES"))
}