Skip to content

Commit

Permalink
Merge pull request #53734 from jmb462/fix-missing-action-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Mar 25, 2022
2 parents 283246a + 5efa3ae commit 6d28ff6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions editor/action_map_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,31 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
event_item->set_meta("__event", event);
event_item->set_meta("__index", evnt_idx);

// First Column - Icon
Ref<InputEventKey> k = event;
if (k.is_valid()) {
if (k->get_physical_keycode() == 0) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("Keyboard"), SNAME("EditorIcons")));
} else {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("KeyboardPhysical"), SNAME("EditorIcons")));
}
}

Ref<InputEventMouseButton> mb = event;
if (mb.is_valid()) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("Mouse"), SNAME("EditorIcons")));
}

Ref<InputEventJoypadButton> jb = event;
if (jb.is_valid()) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("JoyButton"), SNAME("EditorIcons")));
}

Ref<InputEventJoypadMotion> jm = event;
if (jm.is_valid()) {
event_item->set_icon(0, action_tree->get_theme_icon(SNAME("JoyAxis"), SNAME("EditorIcons")));
}

// Third Column - Buttons
event_item->add_button(2, action_tree->get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), BUTTON_EDIT_EVENT, false, TTR("Edit Event"));
event_item->add_button(2, action_tree->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event"));
Expand Down

0 comments on commit 6d28ff6

Please sign in to comment.