Instance tables refactor part 4: replace ArtboardGroups with multi-row Instances<Artboard> (#2265)

* Clean up dyn_any usages

* Migrate ArtboardGroup to ArtboardGroupTable (not yet flattened)

* Reorder graphical data imports

* Flatten and remove ArtboardGroup in favor of ArtboardGroupTable

* Fix test
This commit is contained in:
Keavon Chambers 2025-03-02 17:30:29 -08:00
parent 2f6c6e28f0
commit 19a140682e
32 changed files with 233 additions and 156 deletions

View file

@ -115,6 +115,19 @@ macro_rules! tagged_value {
}
tagged_value! {
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::raster::image::migrate_image_frame"))]
ImageFrame(graphene_core::raster::image::ImageFrameTable<Color>),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::vector::migrate_vector_data"))]
VectorData(graphene_core::vector::VectorDataTable),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::migrate_graphic_group"))]
GraphicGroup(graphene_core::GraphicGroupTable),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::migrate_artboard_group"))]
ArtboardGroup(graphene_core::ArtboardGroupTable),
GraphicElement(graphene_core::GraphicElement),
String(String),
U32(u32),
U64(u64),
@ -130,19 +143,14 @@ tagged_value! {
DAffine2(DAffine2),
Image(graphene_core::raster::Image<Color>),
ImaginateCache(ImaginateCache),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::raster::image::migrate_image_frame"))]
ImageFrame(graphene_core::raster::image::ImageFrameTable<Color>),
Color(graphene_core::raster::color::Color),
OptionalColor(Option<graphene_core::raster::color::Color>),
Subpaths(Vec<bezier_rs::Subpath<graphene_core::vector::PointId>>),
BlendMode(BlendMode),
LuminanceCalculation(LuminanceCalculation),
ImaginateSamplingMethod(ImaginateSamplingMethod),
ImaginateMaskStartingFill(ImaginateMaskStartingFill),
ImaginateController(ImaginateController),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::vector::migrate_vector_data"))]
VectorData(graphene_core::vector::VectorDataTable),
Fill(graphene_core::vector::style::Fill),
Stroke(graphene_core::vector::style::Stroke),
F64Array4([f64; 4]),
@ -170,7 +178,6 @@ tagged_value! {
// TODO: Eventually remove this alias document upgrade code
#[cfg_attr(feature = "serde", serde(alias = "GradientPositions"))]
GradientStops(graphene_core::vector::style::GradientStops),
OptionalColor(Option<graphene_core::raster::color::Color>),
// TODO: Eventually remove this alias document upgrade code
#[cfg_attr(feature = "serde", serde(alias = "ManipulatorGroupIds"))]
PointIds(Vec<graphene_core::vector::PointId>),
@ -178,11 +185,6 @@ tagged_value! {
BrushStrokes(Vec<graphene_core::vector::brush_stroke::BrushStroke>),
BrushCache(BrushCache),
DocumentNode(DocumentNode),
// TODO: Eventually remove this migration document upgrade code
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::migrate_graphic_group"))]
GraphicGroup(graphene_core::GraphicGroupTable),
GraphicElement(graphene_core::GraphicElement),
ArtboardGroup(graphene_core::ArtboardGroup),
Curve(graphene_core::raster::curve::Curve),
Footprint(graphene_core::transform::Footprint),
Palette(Vec<Color>),

View file

@ -1,11 +1,10 @@
use dyn_any::DynAny;
use graphene_core::Color;
use std::borrow::Cow;
use std::fmt::Debug;
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc, Mutex,
};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
#[derive(Default, Debug, Clone, DynAny, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]

View file

@ -923,12 +923,12 @@ mod test {
assert_eq!(
ids,
vec![
NodeId(12083027370457564588),
NodeId(10127202135369428481),
NodeId(3781642984881236270),
NodeId(12160249450476233602),
NodeId(17962581471057044127),
NodeId(7906594012485169109)
NodeId(907133870432995942),
NodeId(13049623730817360317),
NodeId(2177355904460308500),
NodeId(17479234042764485524),
NodeId(10988236038173832469),
NodeId(11097818235165626738),
]
);
}

View file

@ -1,8 +1,8 @@
use dyn_any::StaticType;
use graphene_core::application_io::SurfaceHandleFrame;
use graphene_core::application_io::{ApplicationError, ApplicationIo, ResourceFuture, SurfaceHandle, SurfaceId};
use wgpu_executor::WgpuExecutor;
use dyn_any::StaticType;
#[cfg(target_arch = "wasm32")]
use js_sys::{Object, Reflect};
use std::collections::HashMap;