mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Move TaggedValue::ResourceHash to macro definition site (#4232)
This commit is contained in:
@@ -10,6 +10,7 @@ use core_types::{CacheHash, Color, ContextFeatures, MemoHash, Node, Type, TypeDe
|
|||||||
use dyn_any::DynAny;
|
use dyn_any::DynAny;
|
||||||
pub use dyn_any::StaticType;
|
pub use dyn_any::StaticType;
|
||||||
pub use glam::{DAffine2, DVec2, IVec2, UVec2};
|
pub use glam::{DAffine2, DVec2, IVec2, UVec2};
|
||||||
|
use graphene_application_io::resource::ResourceHash;
|
||||||
use graphic_types::raster_types::{CPU, Image, Raster};
|
use graphic_types::raster_types::{CPU, Image, Raster};
|
||||||
use graphic_types::vector_types::vector::style::{Fill, Gradient, GradientStops};
|
use graphic_types::vector_types::vector::style::{Fill, Gradient, GradientStops};
|
||||||
use graphic_types::vector_types::vector::{self, ReferencePoint};
|
use graphic_types::vector_types::vector::{self, ReferencePoint};
|
||||||
@@ -90,6 +91,9 @@ macro_rules! tagged_value {
|
|||||||
ContextFeatures(ContextFeatures),
|
ContextFeatures(ContextFeatures),
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
EditorApi(Arc<PlatformEditorApi>),
|
EditorApi(Arc<PlatformEditorApi>),
|
||||||
|
/// Only used by the `resource` node, should never be serialized
|
||||||
|
#[serde(skip)]
|
||||||
|
ResourceHash(ResourceHash),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CacheHash for TaggedValue {
|
impl CacheHash for TaggedValue {
|
||||||
@@ -117,6 +121,7 @@ macro_rules! tagged_value {
|
|||||||
Self::ContextFeatures(features) => features.cache_hash(state),
|
Self::ContextFeatures(features) => features.cache_hash(state),
|
||||||
Self::RenderOutput(x) => x.cache_hash(state),
|
Self::RenderOutput(x) => x.cache_hash(state),
|
||||||
Self::EditorApi(x) => x.cache_hash(state),
|
Self::EditorApi(x) => x.cache_hash(state),
|
||||||
|
Self::ResourceHash(x) => x.cache_hash(state),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,6 +175,7 @@ macro_rules! tagged_value {
|
|||||||
Self::DocumentNode(node) => Box::new(node),
|
Self::DocumentNode(node) => Box::new(node),
|
||||||
Self::ContextFeatures(features) => Box::new(features),
|
Self::ContextFeatures(features) => Box::new(features),
|
||||||
Self::EditorApi(x) => Box::new(x),
|
Self::EditorApi(x) => Box::new(x),
|
||||||
|
Self::ResourceHash(x) => Box::new(x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +225,7 @@ macro_rules! tagged_value {
|
|||||||
Self::DocumentNode(node) => Arc::new(node),
|
Self::DocumentNode(node) => Arc::new(node),
|
||||||
Self::ContextFeatures(features) => Arc::new(features),
|
Self::ContextFeatures(features) => Arc::new(features),
|
||||||
Self::EditorApi(x) => Arc::new(x),
|
Self::EditorApi(x) => Arc::new(x),
|
||||||
|
Self::ResourceHash(x) => Arc::new(x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +253,7 @@ macro_rules! tagged_value {
|
|||||||
Self::DocumentNode(_) => concrete!(DocumentNode),
|
Self::DocumentNode(_) => concrete!(DocumentNode),
|
||||||
Self::ContextFeatures(_) => concrete!(ContextFeatures),
|
Self::ContextFeatures(_) => concrete!(ContextFeatures),
|
||||||
Self::EditorApi(_) => concrete!(&PlatformEditorApi),
|
Self::EditorApi(_) => concrete!(&PlatformEditorApi),
|
||||||
|
Self::ResourceHash(_) => concrete!(ResourceHash),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,6 +359,7 @@ macro_rules! tagged_value {
|
|||||||
Self::DocumentNode(node) => format!("DocumentNode({node:?})"),
|
Self::DocumentNode(node) => format!("DocumentNode({node:?})"),
|
||||||
Self::ContextFeatures(features) => format!("ContextFeatures({features:?})"),
|
Self::ContextFeatures(features) => format!("ContextFeatures({features:?})"),
|
||||||
Self::EditorApi(_) => "PlatformEditorApi".to_string(),
|
Self::EditorApi(_) => "PlatformEditorApi".to_string(),
|
||||||
|
Self::ResourceHash(hash) => format!("ResourceHash({hash:?})"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,7 +406,6 @@ tagged_value! {
|
|||||||
VectorModification(Box<VectorModification>),
|
VectorModification(Box<VectorModification>),
|
||||||
ImageData(Image<Color>),
|
ImageData(Image<Color>),
|
||||||
Resource(graphene_application_io::resource::ResourceId),
|
Resource(graphene_application_io::resource::ResourceId),
|
||||||
ResourceHash(graphene_application_io::resource::ResourceHash),
|
|
||||||
// ==========
|
// ==========
|
||||||
// ENUM TYPES
|
// ENUM TYPES
|
||||||
// ==========
|
// ==========
|
||||||
|
|||||||
Reference in New Issue
Block a user