Function nih_plug_vizia::create_vizia_editor
source · pub fn create_vizia_editor<F>(
vizia_state: Arc<ViziaState>,
theming: ViziaTheming,
app: F
) -> Option<Box<dyn Editor>>where
F: Fn(&mut Context, Arc<dyn GuiContext>) + 'static + Send + Sync,
Expand description
Create an Editor
instance using a [vizia
][::vizia] GUI. The ViziaState
passed to this
function contains the GUI’s intitial size, and this is kept in sync whenever the GUI gets
resized. You can also use this to know if the GUI is open, so you can avoid performing
potentially expensive calculations while the GUI is not open. If you want this size to be
persisted when restoring a plugin instance, then you can store it in a #[persist = "key"]
field on your parameters struct.
The GuiContext
is also passed to the app function. This is only meant for saving and
restoring state as part of your plugin’s preset handling. You should not interact with this
directly to set parameters. Use the ParamEvent
s to change parameter
values, and [GuiContextEvent
] to trigger window resizes.
The theming
argument controls what level of theming to apply. If you use
ViziaTheming::Custom
, then you need to call
nih_plug_vizia::assets::register_noto_sans_light()
at
the start of your app function. Vizia’s included fonts are also not registered by default. If
you use the Roboto font that normally comes with Vizia or any of its emoji or icon fonts, you
also need to register those using the functions in
nih_plug_vizia::vizia_assets
.
See VIZIA’s repository for examples on how to use this.