mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 16:18:12 +08:00
Map element-typed wires to their list forms' defaults and widgets
This commit is contained in:
@@ -252,6 +252,10 @@ pub(crate) fn property_from_type(
|
|||||||
Some(x) if x == TypeId::of::<List<Color>>() => color_widget(default_info, ColorInput::default().allow_none(true)),
|
Some(x) if x == TypeId::of::<List<Color>>() => color_widget(default_info, ColorInput::default().allow_none(true)),
|
||||||
Some(x) if x == TypeId::of::<List<GradientStops>>() => color_widget(default_info, ColorInput::default().allow_none(false)),
|
Some(x) if x == TypeId::of::<List<GradientStops>>() => color_widget(default_info, ColorInput::default().allow_none(false)),
|
||||||
Some(x) if x == TypeId::of::<List<BrushStroke>>() => brush_strokes_widget(default_info).into(),
|
Some(x) if x == TypeId::of::<List<BrushStroke>>() => brush_strokes_widget(default_info).into(),
|
||||||
|
// Leveled wires type by their element; each element keeps its list form's widget.
|
||||||
|
Some(x) if x == TypeId::of::<Color>() => color_widget(default_info, ColorInput::default().allow_none(true)),
|
||||||
|
Some(x) if x == TypeId::of::<GradientStops>() => color_widget(default_info, ColorInput::default().allow_none(false)),
|
||||||
|
Some(x) if x == TypeId::of::<BrushStroke>() => brush_strokes_widget(default_info).into(),
|
||||||
// ============
|
// ============
|
||||||
// STRUCT TYPES
|
// STRUCT TYPES
|
||||||
// ============
|
// ============
|
||||||
|
|||||||
@@ -453,6 +453,15 @@ macro_rules! tagged_value {
|
|||||||
$( if name == std::any::type_name::<$ty>() { return Some(TaggedValue::$identifier(Default::default())) } )*
|
$( if name == std::any::type_name::<$ty>() { return Some(TaggedValue::$identifier(Default::default())) } )*
|
||||||
if name == std::any::type_name::<List<f64>>() { return Some(TaggedValue::F64Array(Vec::new())) }
|
if name == std::any::type_name::<List<f64>>() { return Some(TaggedValue::F64Array(Vec::new())) }
|
||||||
if name == std::any::type_name::<List<BrushStroke>>() { return Some(TaggedValue::BrushStrokes(Vec::new())) }
|
if name == std::any::type_name::<List<BrushStroke>>() { return Some(TaggedValue::BrushStrokes(Vec::new())) }
|
||||||
|
// Leveled wires type by their element; each element name maps to the
|
||||||
|
// same tagged default as its legacy list form.
|
||||||
|
if name == std::any::type_name::<Color>() { return Some(TaggedValue::Color(Some(Color::default()))) }
|
||||||
|
if name == std::any::type_name::<GradientStops>() { return Some(TaggedValue::Gradient(GradientStops::default())) }
|
||||||
|
if name == std::any::type_name::<BrushStroke>() { return Some(TaggedValue::BrushStrokes(Vec::new())) }
|
||||||
|
if name == std::any::type_name::<Graphic>() { return Some(TaggedValue::TypeDefault(core_types::descriptor!(List<Graphic>))) }
|
||||||
|
if name == std::any::type_name::<Artboard>() { return Some(TaggedValue::TypeDefault(core_types::descriptor!(List<Artboard>))) }
|
||||||
|
if name == std::any::type_name::<Raster<CPU>>() { return Some(TaggedValue::TypeDefault(core_types::descriptor!(List<Raster<CPU>>))) }
|
||||||
|
if name == std::any::type_name::<Vector>() { return Some(TaggedValue::TypeDefault(core_types::descriptor!(List<Vector>))) }
|
||||||
// Types whose `TaggedValue` variant has been removed. They route through `TypeDefault` instead, with `to_dynany`/`to_any` constructing the actual default at execution time.
|
// Types whose `TaggedValue` variant has been removed. They route through `TypeDefault` instead, with `to_dynany`/`to_any` constructing the actual default at execution time.
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
($type_default:ty) => {
|
($type_default:ty) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user