From 94a0f8282e759e466160b9ae6e4afa572aeedbb5 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Fri, 4 Aug 2023 20:34:54 +0200 Subject: [PATCH] Fix BrushCache serailization (#1358) --- node-graph/gcore/src/raster/brush_cache.rs | 3 ++- node-graph/graph-craft/src/document/value.rs | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node-graph/gcore/src/raster/brush_cache.rs b/node-graph/gcore/src/raster/brush_cache.rs index eadb03c6..a13b0968 100644 --- a/node-graph/gcore/src/raster/brush_cache.rs +++ b/node-graph/gcore/src/raster/brush_cache.rs @@ -23,7 +23,7 @@ struct BrushCacheImpl { last_stroke_texture: ImageFrame, // A cache for brush textures. - #[serde(skip)] + #[cfg_attr(feature = "serde", serde(skip))] brush_texture_cache: HashMap>, } @@ -99,6 +99,7 @@ pub struct BrushPlan { pub first_stroke_point_skip: usize, } +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Debug, DynAny, Default)] pub struct BrushCache { inner: Arc>, diff --git a/node-graph/graph-craft/src/document/value.rs b/node-graph/graph-craft/src/document/value.rs index f3fb5953..1c5b84d5 100644 --- a/node-graph/graph-craft/src/document/value.rs +++ b/node-graph/graph-craft/src/document/value.rs @@ -55,7 +55,6 @@ pub enum TaggedValue { ManipulatorGroupIds(Vec), Font(graphene_core::text::Font), BrushStrokes(Vec), - #[cfg_attr(feature = "serde", serde(skip))] BrushCache(BrushCache), Segments(Vec>), DocumentNode(DocumentNode), @@ -294,7 +293,7 @@ impl<'a> TaggedValue { x if x == TypeId::of::>() => Ok(TaggedValue::ManipulatorGroupIds(*downcast(input).unwrap())), x if x == TypeId::of::() => Ok(TaggedValue::Font(*downcast(input).unwrap())), x if x == TypeId::of::>() => Ok(TaggedValue::BrushStrokes(*downcast(input).unwrap())), - x if x == TypeId::of::>() => Ok(TaggedValue::BrushCache(*downcast(input).unwrap())), + x if x == TypeId::of::() => Ok(TaggedValue::BrushCache(*downcast(input).unwrap())), x if x == TypeId::of::>>>() => Ok(TaggedValue::Segments(*downcast(input).unwrap())), x if x == TypeId::of::() => Ok(TaggedValue::DocumentNode(*downcast(input).unwrap())), x if x == TypeId::of::() => Ok(TaggedValue::GraphicGroup(*downcast(input).unwrap())),