From b7ba667dcfc0b44ac4216e7ad89f06cca727bc02 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Wed, 22 Nov 2023 17:58:18 +0800 Subject: [PATCH] Set some window in visual shader editor to be exclusive --- editor/plugins/visual_shader_editor_plugin.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 5e16361baed8..5cae151531dd 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4080,6 +4080,12 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNod saved_node_pos_dirty = false; members_dialog->set_position(graph->get_screen_position() + Point2(5 * EDSCALE, 65 * EDSCALE)); } + + if (members_dialog->is_visible()) { + members_dialog->grab_focus(); + return; + } + members_dialog->popup(); // Keep dialog within window bounds. @@ -5384,6 +5390,7 @@ VisualShaderEditor::VisualShaderEditor() { preview_window = memnew(Window); preview_window->set_title(TTR("Generated Shader Code")); preview_window->set_visible(preview_showed); + preview_window->set_exclusive(true); preview_window->connect("close_requested", callable_mp(this, &VisualShaderEditor::_preview_close_requested)); preview_window->connect("size_changed", callable_mp(this, &VisualShaderEditor::_preview_size_changed)); add_child(preview_window); @@ -5485,7 +5492,7 @@ VisualShaderEditor::VisualShaderEditor() { members_dialog = memnew(ConfirmationDialog); members_dialog->set_title(TTR("Create Shader Node")); - members_dialog->set_exclusive(false); + members_dialog->set_exclusive(true); members_dialog->add_child(members_vb); members_dialog->set_ok_button_text(TTR("Create")); members_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create)); @@ -5497,7 +5504,7 @@ VisualShaderEditor::VisualShaderEditor() { { add_varying_dialog = memnew(ConfirmationDialog); add_varying_dialog->set_title(TTR("Create Shader Varying")); - add_varying_dialog->set_exclusive(false); + add_varying_dialog->set_exclusive(true); add_varying_dialog->set_ok_button_text(TTR("Create")); add_varying_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualShaderEditor::_varying_create)); add_varying_dialog->get_ok_button()->set_disabled(true); @@ -5543,7 +5550,7 @@ VisualShaderEditor::VisualShaderEditor() { { remove_varying_dialog = memnew(ConfirmationDialog); remove_varying_dialog->set_title(TTR("Delete Shader Varying")); - remove_varying_dialog->set_exclusive(false); + remove_varying_dialog->set_exclusive(true); remove_varying_dialog->set_ok_button_text(TTR("Delete")); remove_varying_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualShaderEditor::_varying_deleted)); add_child(remove_varying_dialog);