Move TaggedValue::ResourceHash to macro definition site (#4232)

This commit is contained in:
Timon
2026-06-19 01:36:45 +00:00
committed by GitHub
parent 5b008936d2
commit 236ab7a11c

View File

@@ -10,6 +10,7 @@ use core_types::{CacheHash, Color, ContextFeatures, MemoHash, Node, Type, TypeDe
use dyn_any::DynAny;
pub use dyn_any::StaticType;
pub use glam::{DAffine2, DVec2, IVec2, UVec2};
use graphene_application_io::resource::ResourceHash;
use graphic_types::raster_types::{CPU, Image, Raster};
use graphic_types::vector_types::vector::style::{Fill, Gradient, GradientStops};
use graphic_types::vector_types::vector::{self, ReferencePoint};
@@ -90,6 +91,9 @@ macro_rules! tagged_value {
ContextFeatures(ContextFeatures),
#[serde(skip)]
EditorApi(Arc<PlatformEditorApi>),
/// Only used by the `resource` node, should never be serialized
#[serde(skip)]
ResourceHash(ResourceHash),
}
impl CacheHash for TaggedValue {
@@ -117,6 +121,7 @@ macro_rules! tagged_value {
Self::ContextFeatures(features) => features.cache_hash(state),
Self::RenderOutput(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::ContextFeatures(features) => Box::new(features),
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::ContextFeatures(features) => Arc::new(features),
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::ContextFeatures(_) => concrete!(ContextFeatures),
Self::EditorApi(_) => concrete!(&PlatformEditorApi),
Self::ResourceHash(_) => concrete!(ResourceHash),
}
}
@@ -351,6 +359,7 @@ macro_rules! tagged_value {
Self::DocumentNode(node) => format!("DocumentNode({node:?})"),
Self::ContextFeatures(features) => format!("ContextFeatures({features:?})"),
Self::EditorApi(_) => "PlatformEditorApi".to_string(),
Self::ResourceHash(hash) => format!("ResourceHash({hash:?})"),
}
}
}
@@ -397,7 +406,6 @@ tagged_value! {
VectorModification(Box<VectorModification>),
ImageData(Image<Color>),
Resource(graphene_application_io::resource::ResourceId),
ResourceHash(graphene_application_io::resource::ResourceHash),
// ==========
// ENUM TYPES
// ==========