diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2022-02-16 16:39:23 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-16 16:39:23 +0100 | 
| commit | 33c7f52f361961c64432cfd772909ed3ba76cd51 (patch) | |
| tree | 6c86397c3797381550815c79938522a3915d58df /editor/plugins/audio_stream_editor_plugin.cpp | |
| parent | b5c0a892d45b1a9df10aaf0f468252925ea2a4b9 (diff) | |
| parent | 8824b6c5e9dc6a24a17452ded0c800ec267f812f (diff) | |
Merge pull request #58169 from megalobyte/update-notificatin-if-to-switch-batch-B
Diffstat (limited to 'editor/plugins/audio_stream_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/audio_stream_editor_plugin.cpp | 49 | 
1 files changed, 26 insertions, 23 deletions
diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index c77ff5778a..a60e49ca9d 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -39,29 +39,32 @@  #include "editor/editor_settings.h"  void AudioStreamEditor::_notification(int p_what) { -	if (p_what == NOTIFICATION_READY) { -		AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AudioStreamEditor::_preview_changed)); -	} - -	if (p_what == NOTIFICATION_THEME_CHANGED || p_what == NOTIFICATION_ENTER_TREE) { -		_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); -		_stop_button->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); -		_preview->set_color(get_theme_color(SNAME("dark_color_2"), SNAME("Editor"))); -		set_color(get_theme_color(SNAME("dark_color_1"), SNAME("Editor"))); - -		_indicator->update(); -		_preview->update(); -	} - -	if (p_what == NOTIFICATION_PROCESS) { -		_current = _player->get_playback_position(); -		_indicator->update(); -	} - -	if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { -		if (!is_visible_in_tree()) { -			_stop(); -		} +	switch (p_what) { +		case NOTIFICATION_READY: { +			AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AudioStreamEditor::_preview_changed)); +		} break; + +		case NOTIFICATION_THEME_CHANGED: +		case NOTIFICATION_ENTER_TREE: { +			_play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); +			_stop_button->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); +			_preview->set_color(get_theme_color(SNAME("dark_color_2"), SNAME("Editor"))); +			set_color(get_theme_color(SNAME("dark_color_1"), SNAME("Editor"))); + +			_indicator->update(); +			_preview->update(); +		} break; + +		case NOTIFICATION_PROCESS: { +			_current = _player->get_playback_position(); +			_indicator->update(); +		} break; + +		case NOTIFICATION_VISIBILITY_CHANGED: { +			if (!is_visible_in_tree()) { +				_stop(); +			} +		} break;  	}  }  |