Migrate remaining node graph data types from Vec to Table (#4067)

* Move Vec<String> to Table<String>

* Remove old VecDVec2

* Move Vec<u8> to Table<u8>

* Move Vec<f64> to Table<f64>

* Move [f64; 4] to Table<f64>

* Move Vec<NodeId> to Table<NodeId>

* Tidy up the TaggedValue variants

* Move Vec<BrushStroke> to Table<BrushStroke>

* Add missing type implementations

* Fix tests

---------
This commit is contained in:
Keavon Chambers
2026-04-28 13:44:25 -07:00
committed by GitHub
parent cf150b5cff
commit b396d17211
25 changed files with 277 additions and 341 deletions
+22
View File
@@ -1,3 +1,25 @@
pub mod brush;
pub mod brush_cache;
pub mod brush_stroke;
pub mod migrations {
use crate::brush_stroke::BrushStroke;
use core_types::table::{Table, TableRow};
// TODO: Eventually remove this migration document upgrade code
pub fn migrate_brush_strokes_to_table<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<Table<BrushStroke>, D::Error> {
use serde::Deserialize;
#[derive(serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
enum BrushStrokeTableFormat {
BrushStrokes(Vec<BrushStroke>),
BrushStrokeTable(Table<BrushStroke>),
}
Ok(match BrushStrokeTableFormat::deserialize(deserializer)? {
BrushStrokeTableFormat::BrushStrokes(strokes) => strokes.into_iter().map(TableRow::new_from_element).collect(),
BrushStrokeTableFormat::BrushStrokeTable(table) => table,
})
}
}