From 07f9a18d3dc24aa753e1ce84c8af67156880d652 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 8 Feb 2022 20:33:08 +0100 Subject: [PATCH] Rename EguiState::open to is_open This makes it more clear that it doesn't actually open the editor. --- nih_plug_egui/src/lib.rs | 3 ++- plugins/examples/gain-gui/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nih_plug_egui/src/lib.rs b/nih_plug_egui/src/lib.rs index 09f9f38a..6c6d8a1c 100644 --- a/nih_plug_egui/src/lib.rs +++ b/nih_plug_egui/src/lib.rs @@ -80,7 +80,8 @@ impl EguiState { } /// Whether the GUI is currently visible. - pub fn open(&self) -> bool { + // Called `is_open()` instead of `open()` to avoid the ambiguity. + pub fn is_open(&self) -> bool { self.open.load(Ordering::Acquire) } } diff --git a/plugins/examples/gain-gui/src/lib.rs b/plugins/examples/gain-gui/src/lib.rs index 9361c302..3e8be47f 100644 --- a/plugins/examples/gain-gui/src/lib.rs +++ b/plugins/examples/gain-gui/src/lib.rs @@ -180,7 +180,7 @@ impl Plugin for Gain { // To save resources, a plugin can (and probably should!) only perform expensive // calculations that are only displayed on the GUI while the GUI is open - if self.editor_state.open() { + if self.editor_state.is_open() { amplitude = (amplitude / num_samples as f32).abs(); let current_peak_meter = self.peak_meter.load(std::sync::atomic::Ordering::Relaxed); let new_peak_meter = if amplitude > current_peak_meter {