Skip to content

Commit

Permalink
Set some window in visual shader editor to be exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Nov 22, 2023
1 parent 80de898 commit b7ba667
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions editor/plugins/visual_shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b7ba667

Please sign in to comment.