mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
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:
@@ -179,9 +179,9 @@ impl IntoF64Vec for f64 {
|
||||
vec![self]
|
||||
}
|
||||
}
|
||||
impl IntoF64Vec for Vec<f64> {
|
||||
impl IntoF64Vec for Table<f64> {
|
||||
fn into_vec(self) -> Vec<f64> {
|
||||
self
|
||||
self.into_iter().map(|row| row.into_element()).collect()
|
||||
}
|
||||
}
|
||||
impl IntoF64Vec for String {
|
||||
@@ -217,7 +217,7 @@ async fn stroke<V, L: IntoF64Vec>(
|
||||
/// The order to paint the stroke on top of the fill, or the fill on top of the stroke.
|
||||
paint_order: PaintOrder,
|
||||
/// The stroke dash lengths. Each length forms a distance in a pattern where the first length is a dash, the second is a gap, and so on. If the list is an odd length, the pattern repeats with solid-gap roles reversed.
|
||||
#[implementations(Vec<f64>, f64, String, Vec<f64>, f64, String)]
|
||||
#[implementations(Table<f64>, f64, String, Table<f64>, f64, String)]
|
||||
dash_lengths: L,
|
||||
/// The phase offset distance from the starting point of the dash pattern.
|
||||
#[unit(" px")]
|
||||
@@ -2850,11 +2850,6 @@ impl<T> Count for Table<T> {
|
||||
self.len()
|
||||
}
|
||||
}
|
||||
impl<T> Count for Vec<T> {
|
||||
fn count(&self) -> usize {
|
||||
self.len()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Return u32, u64, or usize instead of f64 after #1621 is resolved and has allowed us to implement automatic type conversion in the node graph for nodes with generic type inputs.
|
||||
// TODO: (Currently automatic type conversion only works for concrete types, via the Graphene preprocessor and not the full Graphene type system.)
|
||||
@@ -2868,9 +2863,10 @@ async fn count_elements<I: Count>(
|
||||
Table<Raster<GPU>>,
|
||||
Table<Color>,
|
||||
Table<GradientStops>,
|
||||
Vec<String>,
|
||||
Vec<f64>,
|
||||
Vec<DVec2>,
|
||||
Table<String>,
|
||||
Table<f64>,
|
||||
Table<u8>,
|
||||
Table<NodeId>,
|
||||
)]
|
||||
content: I,
|
||||
) -> f64 {
|
||||
|
||||
Reference in New Issue
Block a user