Skip to content

Commit

Permalink
Merge pull request godotengine#14551 from volzhs/ok-alert-confirm
Browse files Browse the repository at this point in the history
Pressing Enter key creates or loads script on Attach script window
  • Loading branch information
akien-mga authored Dec 16, 2017
2 parents 03fb1fd + 47182a0 commit a5db25b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editor/script_create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ void ScriptCreateDialog::_path_changed(const String &p_path) {
_update_dialog();
}

void ScriptCreateDialog::_path_entered(const String &p_path) {
ok_pressed();
}

void ScriptCreateDialog::_msg_script_valid(bool valid, const String &p_msg) {

error_label->set_text(TTR(p_msg));
Expand Down Expand Up @@ -556,6 +560,7 @@ void ScriptCreateDialog::_bind_methods() {
ClassDB::bind_method("_browse_path", &ScriptCreateDialog::_browse_path);
ClassDB::bind_method("_file_selected", &ScriptCreateDialog::_file_selected);
ClassDB::bind_method("_path_changed", &ScriptCreateDialog::_path_changed);
ClassDB::bind_method("_path_entered", &ScriptCreateDialog::_path_entered);
ClassDB::bind_method("_template_changed", &ScriptCreateDialog::_template_changed);
ADD_SIGNAL(MethodInfo("script_created", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
}
Expand Down Expand Up @@ -721,6 +726,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb = memnew(HBoxContainer);
file_path = memnew(LineEdit);
file_path->connect("text_changed", this, "_path_changed");
file_path->connect("text_entered", this, "_path_entered");
file_path->set_h_size_flags(SIZE_EXPAND_FILL);
hb->add_child(file_path);
path_button = memnew(Button);
Expand Down
1 change: 1 addition & 0 deletions editor/script_create_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
Vector<String> template_list;

void _path_changed(const String &p_path = String());
void _path_entered(const String &p_path = String());
void _lang_changed(int l = 0);
void _built_in_pressed();
bool _validate(const String &p_string);
Expand Down

0 comments on commit a5db25b

Please sign in to comment.