diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-09-01 08:31:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 08:31:42 +0200 |
commit | 18b3bfec6b025d3ed4b293f153c6ee7448993aef (patch) | |
tree | 51bdba204f62775f3bd593df27052bdad2ab1f5a | |
parent | 2cfc5b8680bf7c1f75b02f83f7ecc26d1e49021f (diff) | |
parent | fb17743ecc6a0ede479c2b7b20ddb2ad91dac91b (diff) |
Merge pull request #41662 from YeldhamDev/scriptdiag_invalid_path_enter
Fix being able to create invalid scripts by pressing enter inside "Path"
-rw-r--r-- | editor/script_create_dialog.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 628475bbc0..90efb11b7d 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -722,6 +722,15 @@ void ScriptCreateDialog::_update_dialog() { } get_ok()->set_disabled(!script_ok); + + Callable entered_call = callable_mp(this, &ScriptCreateDialog::_path_entered); + if (script_ok) { + if (!file_path->is_connected("text_entered", entered_call)) { + file_path->connect("text_entered", entered_call); + } + } else if (file_path->is_connected("text_entered", entered_call)) { + file_path->disconnect("text_entered", entered_call); + } } void ScriptCreateDialog::_bind_methods() { @@ -849,7 +858,6 @@ ScriptCreateDialog::ScriptCreateDialog() { hb->connect("sort_children", callable_mp(this, &ScriptCreateDialog::_path_hbox_sorted)); file_path = memnew(LineEdit); file_path->connect("text_changed", callable_mp(this, &ScriptCreateDialog::_path_changed)); - file_path->connect("text_entered", callable_mp(this, &ScriptCreateDialog::_path_entered)); file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(file_path); path_button = memnew(Button); |