Merge pull request #105243 from Calinou/editor-input-map-highlight-mouse-buttons

Highlight mouse buttons in the input map editor icons
This commit is contained in:
Thaddeus Crews
2026-06-25 08:32:34 -05:00
12 changed files with 50 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m 9,1 c 2.365616,0.4823681 4.048679,2.5861962 4,5 H 9 Z M 3,8 v 2 c 0,2.761426 2.2385763,4.999998 5,4.999998 2.761424,0 5,-2.238572 5,-4.999998 V 8 Z"/><path fill="#ff5f5f" d="M 7,1 C 4.6343839,1.4823681 2.9513215,3.5861962 3,6 h 4 z"/></svg>

After

Width:  |  Height:  |  Size: 330 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M10.865 1.803c.185.576.237 1.174.237 1.697 0 .773-.11 1.712-.604 2.5H13a5 5 0 0 0-2.135-4.197m-5.736.02A5 5 0 0 0 3 6h2.502c-.495-.788-.604-1.727-.604-2.5 0-.517.051-1.107.23-1.678M3 8v2a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="M7 1C7.552.626 8.448.626 9 1c.743.503 1 1.602 1 2.5S9.743 5.497 9 6c-.552.374-1.448.374-2 0-.743-.503-1-1.602-1-2.5S6.257 1.503 7 1" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 493 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M 7,1 C 4.6343839,1.4823681 2.9513215,3.5861962 3,6 H 7 Z M 3,8 v 2 c 0,2.761426 2.2385763,4.999998 5,4.999998 2.761424,0 5,-2.238572 5,-4.999998 V 8 Z"/><path fill="#ff5f5f" d="m 9,1 c 2.365616,0.4823681 4.048679,2.5861962 4,5 H 9 Z"/></svg>

After

Width:  |  Height:  |  Size: 330 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M10.865 1.803c.185.576.237 1.174.237 1.697 0 .773-.11 1.712-.604 2.5H13a5 5 0 0 0-2.135-4.197m-5.736.02A5 5 0 0 0 3 6h2.502c-.495-.788-.604-1.727-.604-2.5 0-.517.051-1.107.23-1.678M3 8v2a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="m 7,2.2017622 c 0.552,-0.2690163 1.448,-0.2690163 2,0 0.743,0.3618055 1,1.1523107 1,1.7982377 0,0.6459271 -0.257,1.4364323 -1,1.7982377 -0.552,0.2690165 -1.448,0.2690165 -2,0 C 6.257,5.4364322 6,4.645927 6,3.9999999 6,3.3540729 6.257,2.5635677 7,2.2017622" paint-order="stroke fill markers"/><path fill="#ff5f5f" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m 10.999858,5.9999997 c -0.04147,0.0083 -5.9999997,0 -5.9999997,0 l 3.000204,3.0000006 z" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 844 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M10.865 1.803c.185.576.237 1.174.237 1.697 0 .773-.11 1.712-.604 2.5H13a5 5 0 0 0-2.135-4.197m-5.736.02A5 5 0 0 0 3 6h2.502c-.495-.788-.604-1.727-.604-2.5 0-.517.051-1.107.23-1.678M3 8v2a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="m 7,2.2017622 c 0.552,-0.2690163 1.448,-0.2690163 2,0 0.743,0.3618055 1,1.1523107 1,1.7982377 0,0.6459271 -0.257,1.4364323 -1,1.7982377 -0.552,0.2690165 -1.448,0.2690165 -2,0 C 6.257,5.4364322 6,4.645927 6,3.9999999 6,3.3540729 6.257,2.5635677 7,2.2017622" paint-order="stroke fill markers"/><path fill="#ff5f5f" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m 5.9999592,1 c -0.0083,0.041472 0,6 0,6 L 2.9999586,3.999796 Z" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 819 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M10.865 1.803c.185.576.237 1.174.237 1.697 0 .773-.11 1.712-.604 2.5H13a5 5 0 0 0-2.135-4.197m-5.736.02A5 5 0 0 0 3 6h2.502c-.495-.788-.604-1.727-.604-2.5 0-.517.051-1.107.23-1.678M3 8v2a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="m 7,2.2017622 c 0.552,-0.2690163 1.448,-0.2690163 2,0 0.743,0.3618055 1,1.1523107 1,1.7982377 0,0.6459271 -0.257,1.4364323 -1,1.7982377 -0.552,0.2690165 -1.448,0.2690165 -2,0 C 6.257,5.4364322 6,4.645927 6,3.9999999 6,3.3540729 6.257,2.5635677 7,2.2017622" paint-order="stroke fill markers"/><path fill="#ff5f5f" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m 9.9999995,1 c 0.00829,0.041472 0,6 0,6 L 13,3.999796 Z" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 812 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M10.865 1.803c.185.576.237 1.174.237 1.697 0 .773-.11 1.712-.604 2.5H13a5 5 0 0 0-2.135-4.197m-5.736.02A5 5 0 0 0 3 6h2.502c-.495-.788-.604-1.727-.604-2.5 0-.517.051-1.107.23-1.678M3 8v2a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="m 7,2.2017622 c 0.552,-0.2690163 1.448,-0.2690163 2,0 0.743,0.3618055 1,1.1523107 1,1.7982377 0,0.6459271 -0.257,1.4364323 -1,1.7982377 -0.552,0.2690165 -1.448,0.2690165 -2,0 C 6.257,5.4364322 6,4.645927 6,3.9999999 6,3.3540729 6.257,2.5635677 7,2.2017622" paint-order="stroke fill markers"/><path fill="#ff5f5f" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m 10.999858,2.9999592 c -0.04147,-0.0083 -5.9999997,0 -5.9999997,0 L 8.0000623,-4.1414305e-5 Z" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 850 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="M7.5 1a5 5 0 0 0-4 5h4zm2 0v5h4a5 5 0 0 0-4-5M4.998 8v5a.5.5 0 0 1-.166.371A5 5 0 0 0 13.5 10V8z"/><path fill="#ff5f5f" d="M2.5 8c.6-.289 2 0 2 0v5s-1.4.289-2 0c-.962-.462-2-1.433-2-2.5s1.038-2.038 2-2.5" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 355 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="M7.5 1a5 5 0 0 0-2.738 1.592.48.48 0 0 1 .222.408v3H7.5zm2 0v5h4a5 5 0 0 0-4-5M4.984 8a.484.484 0 0 1-.386.475 8 8 0 0 1-1.098.134V10a5 5 0 0 0 10 0V8z"/><path fill="#ff5f5f" d="M2.5 3c.6-.289 2 0 2 0v5s-1.4.289-2 0c-.962-.462-2-1.433-2-2.5s1.038-2.038 2-2.5" paint-order="stroke fill markers"/></svg>

After

Width:  |  Height:  |  Size: 410 B

+21 -1
View File
@@ -528,7 +528,27 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
Ref<InputEventMouseButton> mb = event;
if (mb.is_valid()) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("Mouse")));
if (mb->get_button_index() == MouseButton::LEFT) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonLeft")));
} else if (mb->get_button_index() == MouseButton::RIGHT) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonRight")));
} else if (mb->get_button_index() == MouseButton::MIDDLE) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonMiddle")));
} else if (mb->get_button_index() == MouseButton::WHEEL_UP) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonWheelUp")));
} else if (mb->get_button_index() == MouseButton::WHEEL_DOWN) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonWheelDown")));
} else if (mb->get_button_index() == MouseButton::WHEEL_LEFT) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonWheelLeft")));
} else if (mb->get_button_index() == MouseButton::WHEEL_RIGHT) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonWheelRight")));
} else if (mb->get_button_index() == MouseButton::MB_XBUTTON1) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonXButton1")));
} else if (mb->get_button_index() == MouseButton::MB_XBUTTON2) {
event_item->set_icon(0, get_editor_theme_icon(SNAME("MouseButtonXButton2")));
} else {
event_item->set_icon(0, get_editor_theme_icon(SNAME("Mouse")));
}
}
Ref<InputEventJoypadButton> jb = event;
@@ -337,6 +337,7 @@ void InputEventConfigurationDialog::_update_input_list() {
mouse_root->set_meta("__type", INPUT_MOUSE_BUTTON);
MouseButton mouse_buttons[9] = { MouseButton::LEFT, MouseButton::RIGHT, MouseButton::MIDDLE, MouseButton::WHEEL_UP, MouseButton::WHEEL_DOWN, MouseButton::WHEEL_LEFT, MouseButton::WHEEL_RIGHT, MouseButton::MB_XBUTTON1, MouseButton::MB_XBUTTON2 };
Ref<Texture2D> mouse_icons[9] = { icon_cache.mouse_left_button, icon_cache.mouse_right_button, icon_cache.mouse_middle_button, icon_cache.mouse_wheel_up, icon_cache.mouse_wheel_down, icon_cache.mouse_wheel_left, icon_cache.mouse_wheel_right, icon_cache.mouse_xbutton1, icon_cache.mouse_xbutton2 };
for (int i = 0; i < 9; i++) {
Ref<InputEventMouseButton> mb;
mb.instantiate();
@@ -349,6 +350,7 @@ void InputEventConfigurationDialog::_update_input_list() {
TreeItem *item = input_list_tree->create_item(mouse_root);
item->set_text(0, desc);
item->set_icon(0, mouse_icons[i]);
item->set_meta("__index", mouse_buttons[i]);
}
}
@@ -612,6 +614,15 @@ void InputEventConfigurationDialog::_notification(int p_what) {
icon_cache.keyboard = get_editor_theme_icon(SNAME("Keyboard"));
icon_cache.mouse = get_editor_theme_icon(SNAME("Mouse"));
icon_cache.mouse_left_button = get_editor_theme_icon(SNAME("MouseButtonLeft"));
icon_cache.mouse_right_button = get_editor_theme_icon(SNAME("MouseButtonRight"));
icon_cache.mouse_middle_button = get_editor_theme_icon(SNAME("MouseButtonMiddle"));
icon_cache.mouse_wheel_up = get_editor_theme_icon(SNAME("MouseButtonWheelUp"));
icon_cache.mouse_wheel_down = get_editor_theme_icon(SNAME("MouseButtonWheelDown"));
icon_cache.mouse_wheel_left = get_editor_theme_icon(SNAME("MouseButtonWheelLeft"));
icon_cache.mouse_wheel_right = get_editor_theme_icon(SNAME("MouseButtonWheelRight"));
icon_cache.mouse_xbutton1 = get_editor_theme_icon(SNAME("MouseButtonXButton1"));
icon_cache.mouse_xbutton2 = get_editor_theme_icon(SNAME("MouseButtonXButton2"));
icon_cache.joypad_button = get_editor_theme_icon(SNAME("JoyButton"));
icon_cache.joypad_axis = get_editor_theme_icon(SNAME("JoyAxis"));
@@ -45,8 +45,17 @@ private:
struct IconCache {
Ref<Texture2D> keyboard;
Ref<Texture2D> mouse;
Ref<Texture2D> mouse_left_button;
Ref<Texture2D> mouse_right_button;
Ref<Texture2D> mouse_middle_button;
Ref<Texture2D> mouse_wheel_up;
Ref<Texture2D> mouse_wheel_down;
Ref<Texture2D> mouse_wheel_left;
Ref<Texture2D> mouse_wheel_right;
Ref<Texture2D> joypad_button;
Ref<Texture2D> joypad_axis;
Ref<Texture2D> mouse_xbutton1;
Ref<Texture2D> mouse_xbutton2;
} icon_cache;
Ref<InputEvent> event;