This PR adds support for custom enum to be used as sketch parameter, via the same Widget derive macro and #[sketch_widget] helper attribute.
The generated code distinguishes two cases:
1) "simple", C-style enums (no variant contains data)
2) "complex" enums (one or more variant has named or unnamed fields)
The former are displayed as a simple label + combo box that align to the UI grid. The latter offer a hierarchical UI that displays UI for nested data.
The ui_demo.rs example is updated to showcase the change.
This PR adds support for custom enum to be used as sketch parameter, via the same
Widget
derive macro and#[sketch_widget]
helper attribute.The generated code distinguishes two cases: 1) "simple", C-style enums (no variant contains data) 2) "complex" enums (one or more variant has named or unnamed fields)
The former are displayed as a simple label + combo box that align to the UI grid. The latter offer a hierarchical UI that displays UI for nested data.
The
ui_demo.rs
example is updated to showcase the change.Limitations
self
to refer to another field in a#[param]
attribute is not possible with enum fields.whiskers-derive
crate code is getting uglier and uglier.The UI for complex-enum empty variant is not very nice.