Add the document graph (#1217)

* Thumbnails for the layer node

* Raster node graph frames

* Downscale to a random resolution

* Cleanup and bug fixes

* Generate paths before duplicating outputs

* Fix stable id test

* Add a document node graph

* Fix merge conflict

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-05-26 17:22:58 +01:00
committed by GitHub
parent d45e7cb755
commit 44d16c42f5
18 changed files with 264 additions and 152 deletions

View File

@@ -59,7 +59,7 @@ pub enum TaggedValue {
DocumentNode(DocumentNode),
GraphicGroup(graphene_core::GraphicGroup),
Artboard(graphene_core::Artboard),
Optional2IVec2(Option<[glam::IVec2; 2]>),
IVec2(glam::IVec2),
}
#[allow(clippy::derived_hash_with_manual_eq)]
@@ -129,7 +129,7 @@ impl Hash for TaggedValue {
Self::DocumentNode(document_node) => document_node.hash(state),
Self::GraphicGroup(graphic_group) => graphic_group.hash(state),
Self::Artboard(artboard) => artboard.hash(state),
Self::Optional2IVec2(v) => v.hash(state),
Self::IVec2(v) => v.hash(state),
}
}
}
@@ -181,7 +181,7 @@ impl<'a> TaggedValue {
TaggedValue::DocumentNode(x) => Box::new(x),
TaggedValue::GraphicGroup(x) => Box::new(x),
TaggedValue::Artboard(x) => Box::new(x),
TaggedValue::Optional2IVec2(x) => Box::new(x),
TaggedValue::IVec2(x) => Box::new(x),
}
}
@@ -244,7 +244,7 @@ impl<'a> TaggedValue {
TaggedValue::DocumentNode(_) => concrete!(crate::document::DocumentNode),
TaggedValue::GraphicGroup(_) => concrete!(graphene_core::GraphicGroup),
TaggedValue::Artboard(_) => concrete!(graphene_core::Artboard),
TaggedValue::Optional2IVec2(_) => concrete!(Option<[glam::IVec2; 2]>),
TaggedValue::IVec2(_) => concrete!(glam::IVec2),
}
}
@@ -296,7 +296,7 @@ impl<'a> TaggedValue {
x if x == TypeId::of::<crate::document::DocumentNode>() => Some(TaggedValue::DocumentNode(*downcast(input).unwrap())),
x if x == TypeId::of::<graphene_core::GraphicGroup>() => Some(TaggedValue::GraphicGroup(*downcast(input).unwrap())),
x if x == TypeId::of::<graphene_core::Artboard>() => Some(TaggedValue::Artboard(*downcast(input).unwrap())),
x if x == TypeId::of::<Option<[glam::IVec2; 2]>>() => Some(TaggedValue::Optional2IVec2(*downcast(input).unwrap())),
x if x == TypeId::of::<glam::IVec2>() => Some(TaggedValue::IVec2(*downcast(input).unwrap())),
_ => None,
}
}