summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2024-03-05 16:04:13 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2024-03-05 19:22:52 +0100
commit305192072fab1c4d5894ba5da3009a648936c70b (patch)
treeaa069e5e2b6cc603468d76e95325d4fead088849
parent39f90600bc553f2273e72708eb2a8d37a8517e86 (diff)
downloadredot-engine-305192072fab1c4d5894ba5da3009a648936c70b.tar.gz
Add Enter shortcut to add a shader global in the editor
- Clear the shader global name field when adding a new shader global to match the behavior of other tabs in the Project Settings dialog.
-rw-r--r--editor/shader_globals_editor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/editor/shader_globals_editor.cpp b/editor/shader_globals_editor.cpp
index 97f6ce2215..86a78d813e 100644
--- a/editor/shader_globals_editor.cpp
+++ b/editor/shader_globals_editor.cpp
@@ -398,6 +398,8 @@ void ShaderGlobalsEditor::_variable_added() {
undo_redo->add_do_method(this, "_changed");
undo_redo->add_undo_method(this, "_changed");
undo_redo->commit_action();
+
+ variable_name->clear();
}
void ShaderGlobalsEditor::_variable_deleted(const String &p_variable) {
@@ -455,6 +457,7 @@ ShaderGlobalsEditor::ShaderGlobalsEditor() {
variable_name->set_h_size_flags(SIZE_EXPAND_FILL);
variable_name->set_clear_button_enabled(true);
variable_name->connect("text_changed", callable_mp(this, &ShaderGlobalsEditor::_variable_name_text_changed));
+ variable_name->connect("text_submitted", callable_mp(this, &ShaderGlobalsEditor::_variable_added).unbind(1));
add_menu_hb->add_child(variable_name);