Add basic vector nodes (#1059)

* Add some derives

* Allow node_fn with mutable inputs

* Add basic vector nodes

* Revert elipse tool changes

* Fix the elipse tool again

* Change spacer width

* Bubble serde feature in graph craft

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-03-02 21:54:23 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 966695e066
commit 2cf4ee0fab
22 changed files with 707 additions and 151 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ use std::hash::{Hash, Hasher};
/// This does not technically need to be unique globally, only within a folder.
pub type LayerId = u64;
#[derive(Debug, Clone, Deserialize, Serialize, specta::Type)]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Document {
/// The root layer, usually a [FolderLayer](layers::folder_layer::FolderLayer) that contains all other [Layers](layers::layer_info::Layer).
pub root: Layer,
+1 -1
View File
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
/// A layer that encapsulates other layers, including potentially more folders.
/// The contained layers are rendered in the same order they are
/// stored in the [layers](FolderLayer::layers) field.
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default, specta::Type)]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Default)]
pub struct FolderLayer {
/// The ID that will be assigned to the next layer that is added to the folder
next_assignment_id: LayerId,
+2 -2
View File
@@ -15,7 +15,7 @@ use glam::{DAffine2, DMat2, DVec2};
use serde::{Deserialize, Serialize};
use std::fmt::Write;
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, specta::Type)]
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
/// Represents different types of layers.
pub enum LayerDataType {
/// A layer that wraps a [FolderLayer] struct.
@@ -213,7 +213,7 @@ fn return_true() -> bool {
true
}
#[derive(Debug, PartialEq, Deserialize, Serialize, specta::Type)]
#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub struct Layer {
/// Whether the layer is currently visible or hidden.
pub visible: bool,
@@ -9,7 +9,7 @@ use kurbo::{Affine, BezPath, Shape as KurboShape};
use serde::{Deserialize, Serialize};
use std::fmt::Write;
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, specta::Type)]
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct NodeGraphFrameLayer {
// Image stored in layer after generation completes
pub mime: String,
+1 -1
View File
@@ -13,7 +13,7 @@ use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
#[repr(C)]
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, specta::Type)]
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
// TODO: Rename all instances of `path` to `layer_path`
/// Operations that can be performed to mutate the document.
pub enum Operation {