diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-08-28 12:02:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-28 12:02:08 +0200 |
commit | 6c674375e52e8228e2aec53ceb0ac3d3f4a0f4d9 (patch) | |
tree | 077b492c7806a7e3af85d2e731ae9784dbd52848 /tools | |
parent | 3cc08ab1f125820d78b9917998ff09f81b052918 (diff) | |
parent | 2e5a4cb5ca33576ea81601f949b2e633ff92213c (diff) |
Merge pull request #6249 from volzhs/issue-6121
Show last added action on Input Map
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/project_settings.cpp | 30 | ||||
-rw-r--r-- | tools/editor/project_settings.h | 2 |
2 files changed, 30 insertions, 2 deletions
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 03eec960d2..02d95abfa2 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -245,7 +245,7 @@ void ProjectSettings::_device_input_add() { undo_redo->add_undo_method(this,"_settings_changed"); undo_redo->commit_action(); - + _show_last_added(ie); } @@ -283,7 +283,34 @@ void ProjectSettings::_press_a_key_confirm() { undo_redo->add_undo_method(this,"_settings_changed"); undo_redo->commit_action(); + _show_last_added(ie); +} + +void ProjectSettings::_show_last_added(const InputEvent& p_event) { + TreeItem *r = input_editor->get_root(); + + if (!r) + return; + r=r->get_children(); + if (!r) + return; + bool found = false; + while(r){ + TreeItem *child = r->get_children(); + while(child){ + Variant input = child->get_meta("__input"); + if (p_event==input){ + child->select(0); + found = true; + break; + } + child=child->get_next(); + } + if (found) break; + r=r->get_next(); + } + if (found) input_editor->ensure_cursor_is_visible(); } void ProjectSettings::_wait_for_key(const InputEvent& p_event) { @@ -543,6 +570,7 @@ void ProjectSettings::_update_actions() { } action->add_button(0,get_icon("Remove","EditorIcons"),2); action->set_metadata(0,i); + action->set_meta("__input", ie); } } } diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index 46e98f69ad..61ad094d00 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -111,7 +111,7 @@ class ProjectSettings : public AcceptDialog { void _action_button_pressed(Object* p_obj, int p_column,int p_id); void _wait_for_key(const InputEvent& p_event); void _press_a_key_confirm(); - + void _show_last_added(const InputEvent& p_event); void _settings_prop_edited(const String& p_name); void _settings_changed(); |