Instance tables refactor part 2: move the transform and alpha_blending fields up a level (#2249)

* Fix domain data structure field plural naming

* Rename method one_item to one_instance

Rename method one_item to one_instance

* Move the Instance<T> methods over to providing an Instance<T>/InstanceMut<T>

Move the Instance<T> methods over to providing an Instance<T>/InstanceMut<T>

* Add transform and alpha_blending fields to Instances<T>

* Finish the refactor (Brush tool is broken though)

* Add test for brush node

* Fix brush node

* Fix default empty images being 1x1 instead of 0x0 as they should be

* Fix tests

* Fix path transform

* Add correct upgrading to move the transform/blending up a level

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
This commit is contained in:
Keavon Chambers 2025-03-02 01:26:36 -08:00
parent 4ff2bdb04f
commit f1160e1ca6
33 changed files with 1099 additions and 984 deletions

View file

@ -118,7 +118,8 @@ tagged_value! {
String(String),
U32(u32),
U64(u64),
#[cfg_attr(feature = "serde", serde(alias = "F32"))] // TODO: Eventually remove this alias document upgrade code
// TODO: Eventually remove this alias document upgrade code
#[cfg_attr(feature = "serde", serde(alias = "F32"))]
F64(f64),
OptionalF64(Option<f64>),
Bool(bool),
@ -129,7 +130,8 @@ tagged_value! {
DAffine2(DAffine2),
Image(graphene_core::raster::Image<Color>),
ImaginateCache(ImaginateCache),
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::raster::image::migrate_image_frame"))] // TODO: Eventually remove this migration document upgrade code
// 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),
Subpaths(Vec<bezier_rs::Subpath<graphene_core::vector::PointId>>),
@ -138,12 +140,14 @@ tagged_value! {
ImaginateSamplingMethod(ImaginateSamplingMethod),
ImaginateMaskStartingFill(ImaginateMaskStartingFill),
ImaginateController(ImaginateController),
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::vector::migrate_vector_data"))] // TODO: Eventually remove this migration document upgrade code
// 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]),
#[cfg_attr(feature = "serde", serde(alias = "VecF32"))] // TODO: Eventually remove this alias document upgrade code
// TODO: Eventually remove this alias document upgrade code
#[cfg_attr(feature = "serde", serde(alias = "VecF32"))]
VecF64(Vec<f64>),
VecU64(Vec<u64>),
NodePath(Vec<NodeId>),
@ -163,16 +167,19 @@ tagged_value! {
FillChoice(graphene_core::vector::style::FillChoice),
Gradient(graphene_core::vector::style::Gradient),
GradientType(graphene_core::vector::style::GradientType),
#[cfg_attr(feature = "serde", serde(alias = "GradientPositions"))] // TODO: Eventually remove this alias document upgrade code
// 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>),
#[cfg_attr(feature = "serde", serde(alias = "ManipulatorGroupIds"))] // TODO: Eventually remove this alias document upgrade code
// TODO: Eventually remove this alias document upgrade code
#[cfg_attr(feature = "serde", serde(alias = "ManipulatorGroupIds"))]
PointIds(Vec<graphene_core::vector::PointId>),
Font(graphene_core::text::Font),
BrushStrokes(Vec<graphene_core::vector::brush_stroke::BrushStroke>),
BrushCache(BrushCache),
DocumentNode(DocumentNode),
#[cfg_attr(feature = "serde", serde(deserialize_with = "graphene_core::migrate_graphic_group"))] // TODO: Eventually remove this migration document upgrade code
// 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),