diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-02-13 07:57:46 +0100 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-02-13 07:58:29 +0100 |
commit | 92ac7067e6a3ff297d3149c1e97ca83cad668c46 (patch) | |
tree | 7d5929d12409c5cacf8c9e5b6e11e3d60e803f81 /tools/editor/project_settings.cpp | |
parent | 70b9aa379d99c78f6db87344e3002808dac70bfa (diff) |
ProjectSettings: InputMap dialog fixes
Now the selection jumps to the correct action after a new event has been added.
Also sets the default device id for Joypad button events to 0.
Diffstat (limited to 'tools/editor/project_settings.cpp')
-rw-r--r-- | tools/editor/project_settings.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index e725786f94..84165916bc 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -242,7 +242,7 @@ void ProjectSettings::_device_input_add() { undo_redo->add_undo_method(this,"_settings_changed"); undo_redo->commit_action(); - _show_last_added(ie); + _show_last_added(ie, name); } @@ -279,12 +279,14 @@ void ProjectSettings::_press_a_key_confirm() { undo_redo->add_undo_method(this,"_settings_changed"); undo_redo->commit_action(); - _show_last_added(ie); + _show_last_added(ie, name); } -void ProjectSettings::_show_last_added(const InputEvent& p_event) { +void ProjectSettings::_show_last_added(const InputEvent& p_event, const String &p_name) { TreeItem *r = input_editor->get_root(); + String name = p_name; + name.erase(0,6); if (!r) return; r=r->get_children(); @@ -292,6 +294,10 @@ void ProjectSettings::_show_last_added(const InputEvent& p_event) { return; bool found = false; while(r){ + if (r->get_text(0) != name) { + r=r->get_next(); + continue; + } TreeItem *child = r->get_children(); while(child){ Variant input = child->get_meta("__input"); @@ -377,7 +383,7 @@ void ProjectSettings::_add_item(int p_item){ } break; case InputEvent::JOYPAD_BUTTON: { - device_id->set_value(3); + device_id->set_value(0); device_index_label->set_text(TTR("Joypad Button Index:")); device_index->clear(); |