You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Add "Mute Audio" button to Game view in editor
Update servers/audio_server.cpp Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Adam Scott <ascott.ca@gmail.com> Fix a few lines for new member names Add command-line argument `--debug-mute-audio`, and pass it to game if started with mute enabled Apply suggestions from code review Co-authored-by: arkology <43543909+arkology@users.noreply.github.com> Co-authored-by: Rémi Verschelde <rverschelde@gmail.com> Fix icon for svgo
This commit is contained in:
@@ -95,6 +95,9 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
|
||||
Array mode;
|
||||
mode.append(select_mode);
|
||||
p_session->send_message("scene:runtime_node_select_set_mode", mode);
|
||||
Array mute_audio_data;
|
||||
mute_audio_data.append(mute_audio);
|
||||
p_session->send_message("scene:debug_mute_audio", mute_audio_data);
|
||||
|
||||
emit_signal(SNAME("session_started"));
|
||||
}
|
||||
@@ -169,6 +172,11 @@ void GameViewDebugger::set_select_mode(int p_mode) {
|
||||
}
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_debug_mute_audio(bool p_enabled) {
|
||||
mute_audio = p_enabled;
|
||||
EditorDebuggerNode::get_singleton()->set_debug_mute_audio(p_enabled);
|
||||
}
|
||||
|
||||
void GameViewDebugger::set_camera_override(bool p_enabled) {
|
||||
EditorDebuggerNode::get_singleton()->set_camera_override(p_enabled ? camera_override_mode : EditorDebuggerNode::OVERRIDE_NONE);
|
||||
}
|
||||
@@ -593,6 +601,13 @@ void GameView::_hide_selection_toggled(bool p_pressed) {
|
||||
EditorSettings::get_singleton()->set_project_metadata("game_view", "hide_selection", p_pressed);
|
||||
}
|
||||
|
||||
void GameView::_debug_mute_audio_button_pressed() {
|
||||
debug_mute_audio = !debug_mute_audio;
|
||||
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
|
||||
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
|
||||
debugger->set_debug_mute_audio(debug_mute_audio);
|
||||
}
|
||||
|
||||
void GameView::_camera_override_button_toggled(bool p_pressed) {
|
||||
_update_debugger_buttons();
|
||||
|
||||
@@ -654,6 +669,8 @@ void GameView::_notification(int p_what) {
|
||||
stretch_button->set_button_icon(get_editor_theme_icon(SNAME("Stretch")));
|
||||
embed_options_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
|
||||
debug_mute_audio_button->set_button_icon(get_editor_theme_icon(debug_mute_audio ? SNAME("AudioMute") : SNAME("AudioStreamPlayer")));
|
||||
|
||||
camera_override_button->set_button_icon(get_editor_theme_icon(SNAME("Camera")));
|
||||
camera_override_menu->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
} break;
|
||||
@@ -963,6 +980,14 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, WindowWrapper *p_wrapper) {
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
debug_mute_audio_button = memnew(Button);
|
||||
main_menu_hbox->add_child(debug_mute_audio_button);
|
||||
debug_mute_audio_button->set_theme_type_variation("FlatButton");
|
||||
debug_mute_audio_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_debug_mute_audio_button_pressed));
|
||||
debug_mute_audio_button->set_tooltip_text(debug_mute_audio ? TTRC("Unmute game audio.") : TTRC("Mute game audio."));
|
||||
|
||||
main_menu_hbox->add_child(memnew(VSeparator));
|
||||
|
||||
camera_override_button = memnew(Button);
|
||||
main_menu_hbox->add_child(camera_override_button);
|
||||
camera_override_button->set_toggle_mode(true);
|
||||
|
||||
Reference in New Issue
Block a user