summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/create_dialog.cpp8
-rw-r--r--editor/editor_audio_buses.cpp2
-rw-r--r--editor/editor_help.cpp4
-rw-r--r--editor/editor_help_search.cpp2
-rw-r--r--editor/editor_layouts_dialog.cpp2
-rw-r--r--editor/editor_settings.cpp2
-rw-r--r--editor/icons/Keyboard.svg2
-rw-r--r--editor/icons/KeyboardPhysical.svg1
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp6
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp2
-rw-r--r--editor/plugins/animation_blend_space_2d_editor.cpp2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp22
-rw-r--r--editor/plugins/curve_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp8
-rw-r--r--editor/plugins/script_text_editor.cpp2
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp8
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp18
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp8
-rw-r--r--editor/project_manager.cpp12
-rw-r--r--editor/project_settings_editor.cpp55
-rw-r--r--editor/project_settings_editor.h2
-rw-r--r--editor/property_selector.cpp2
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/settings_config_dialog.cpp8
30 files changed, 116 insertions, 78 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 86631def9d..9aaad6c79b 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -122,7 +122,7 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
bool accepted = true;
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_ESCAPE: {
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 9584443c75..bd9c5e7af1 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -127,10 +127,10 @@ void CreateDialog::_text_changed(const String &p_newtext) {
void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie;
- if (k.is_valid() && (k->get_scancode() == KEY_UP ||
- k->get_scancode() == KEY_DOWN ||
- k->get_scancode() == KEY_PAGEUP ||
- k->get_scancode() == KEY_PAGEDOWN)) {
+ if (k.is_valid() && (k->get_keycode() == KEY_UP ||
+ k->get_keycode() == KEY_DOWN ||
+ k->get_keycode() == KEY_PAGEUP ||
+ k->get_keycode() == KEY_PAGEDOWN)) {
search_options->call("_gui_input", k);
search_box->accept_event();
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 1a72b6e1ca..72a9456c59 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -549,7 +549,7 @@ void EditorAudioBus::_effect_add(int p_which) {
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
accept_event();
emit_signal("delete_request");
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9c64540a9e..1e8cd9e3f1 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -66,7 +66,7 @@ void EditorHelp::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventKey> k = p_ev;
- if (k.is_valid() && k->get_control() && k->get_scancode() == KEY_F) {
+ if (k.is_valid() && k->get_control() && k->get_keycode() == KEY_F) {
search->grab_focus();
search->select_all();
@@ -1813,7 +1813,7 @@ void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) {
bool accepted = true;
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_ESCAPE: {
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 8bad46e4d0..1a52ac35bc 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -66,7 +66,7 @@ void EditorHelpSearch::_search_box_gui_input(const Ref<InputEvent> &p_event) {
// Redirect up and down navigational key events to the results list.
Ref<InputEventKey> key = p_event;
if (key.is_valid()) {
- switch (key->get_scancode()) {
+ switch (key->get_keycode()) {
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
index 05a5df45a9..36ca089bd0 100644
--- a/editor/editor_layouts_dialog.cpp
+++ b/editor/editor_layouts_dialog.cpp
@@ -44,7 +44,7 @@ void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
if (!k->is_pressed())
return;
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_KP_ENTER:
case KEY_ENTER: {
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index d81b9bbb82..1917178939 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -1529,7 +1529,7 @@ Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p
ie.instance();
ie->set_unicode(p_keycode & KEY_CODE_MASK);
- ie->set_scancode(p_keycode & KEY_CODE_MASK);
+ ie->set_keycode(p_keycode & KEY_CODE_MASK);
ie->set_shift(bool(p_keycode & KEY_MASK_SHIFT));
ie->set_alt(bool(p_keycode & KEY_MASK_ALT));
ie->set_control(bool(p_keycode & KEY_MASK_CTRL));
diff --git a/editor/icons/Keyboard.svg b/editor/icons/Keyboard.svg
index bd8736278d..c76e88e5e3 100644
--- a/editor/icons/Keyboard.svg
+++ b/editor/icons/Keyboard.svg
@@ -1 +1 @@
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill-opacity=".99608" transform="translate(0 -1036.4)"><path d="m4 2a1 1 0 0 0 -1 1v9.084a1 .91667 0 0 0 1 .91602h8a1 .91667 0 0 0 1-.91602v-9.084a1 1 0 0 0 -1-1zm-3 2v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-9h-1v9a.99998.99998 0 0 1 -1 1h-10a1 1 0 0 1 -1-1v-9zm4 0h2v3l2-3h2l-2 3 2 4h-2l-2-4v4h-2z" fill="#e0e0e0" transform="translate(0 1036.4)"/><path d="m27 1038.4h7v14h-7z" fill="#fff"/></g></svg> \ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M4 2a1 1 0 0 0-1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916V3a1 1 0 0 0-1-1H4zm1.543 1.139h1.393L8.77 7.338h1.295v.437c.708.052 1.246.239 1.61.559.368.316.55.747.55 1.295 0 .552-.182.99-.55 1.314-.368.32-.906.505-1.61.553v.467H8.771v-.473c-.708-.06-1.247-.248-1.615-.564-.364-.316-.545-.75-.545-1.297 0-.548.181-.977.545-1.29.368-.315.907-.504 1.615-.564v-.437H7.307l-.282-.733H5.43l-.284.733H3.707l1.836-4.2zm.684 1.39l-.409 1.057h.817l-.408-1.057zm3.84 4.338v1.526c.28-.04.483-.12.607-.24.124-.125.185-.302.185-.53 0-.224-.063-.396-.191-.516-.124-.12-.326-.2-.602-.24zm-1.296.006c-.284.04-.487.12-.61.24-.12.116-.182.288-.182.516 0 .22.065.392.193.512.132.12.331.202.6.246V8.873z" fill="#e0e0e0" fill-opacity=".996"/><path d="M27 2h7v14h-7z" fill="#fff" fill-opacity=".996"/><path fill="#e0e0e0" fill-opacity=".996" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4z"/></svg> \ No newline at end of file
diff --git a/editor/icons/KeyboardPhysical.svg b/editor/icons/KeyboardPhysical.svg
new file mode 100644
index 0000000000..2bd35bc78e
--- /dev/null
+++ b/editor/icons/KeyboardPhysical.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M4 2a1 1 0 0 0-1 1v9.084c0 .506.448.916 1 .916h8c.552 0 1-.41 1-.916V3a1 1 0 0 0-1-1zm2.762 1.768h2.476l3.264 7.464H9.898l-.502-1.3H6.561l-.502 1.3H3.498zm1.217 2.474L7.254 8.12h1.45z" fill="#e0e0e0" fill-opacity=".996"/><path d="M27 2h7v14h-7z" fill="#fff" fill-opacity=".996"/><path fill="#e0e0e0" fill-opacity=".996" d="M1 4v9a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-1v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4z"/></svg> \ No newline at end of file
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 6f29b6c76a..b374d989d7 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -533,7 +533,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
if (k.is_valid() && k->is_pressed()) {
- if (k->get_scancode() == KEY_DELETE || k->get_scancode() == KEY_BACKSPACE) {
+ if (k->get_keycode() == KEY_DELETE || k->get_keycode() == KEY_BACKSPACE) {
if (wip_active && selected_point.polygon == -1) {
@@ -555,10 +555,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return true;
}
}
- } else if (wip_active && k->get_scancode() == KEY_ENTER) {
+ } else if (wip_active && k->get_keycode() == KEY_ENTER) {
_wip_close();
- } else if (wip_active && k->get_scancode() == KEY_ESCAPE) {
+ } else if (wip_active && k->get_keycode() == KEY_ESCAPE) {
_wip_cancel();
}
}
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index c955f2b806..54a48cc900 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -42,7 +42,7 @@ StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const {
void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
if (selected_point != -1) {
_erase_selected();
accept_event();
diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp
index d2306a5d6b..2edee0389b 100644
--- a/editor/plugins/animation_blend_space_2d_editor.cpp
+++ b/editor/plugins/animation_blend_space_2d_editor.cpp
@@ -73,7 +73,7 @@ StringName AnimationNodeBlendSpace2DEditor::get_blend_position_path() const {
void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
if (selected_point != -1 || selected_triangle != -1) {
_erase_selected();
accept_event();
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 0f2a7376f5..1d04201ce6 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1268,7 +1268,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
Ref<InputEventKey> k = p_ev;
if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) {
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_A: {
if (!k->get_shift())
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 6f29aba356..cc724b6ce6 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -69,7 +69,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
return;
Ref<InputEventKey> k = p_event;
- if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_DELETE && !k->is_echo()) {
+ if (tool_select->is_pressed() && k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && !k->is_echo()) {
if (selected_node != StringName() || selected_transition_to != StringName() || selected_transition_from != StringName()) {
_erase_selected();
accept_event();
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 01c3c33995..a530f4ddc9 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -627,7 +627,7 @@ void EditorAssetLibrary::_unhandled_input(const Ref<InputEvent> &p_event) {
if (key.is_valid() && key->is_pressed()) {
- if (key->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F) && is_visible_in_tree()) {
+ if (key->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F) && is_visible_in_tree()) {
filter->grab_focus();
filter->select_all();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index f5cc0ccf2a..d7f87bda3f 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -472,7 +472,7 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
if (!is_visible_in_tree() || get_viewport()->gui_has_modal_stack())
return;
- if (k->get_scancode() == KEY_CONTROL || k->get_scancode() == KEY_ALT || k->get_scancode() == KEY_SHIFT) {
+ if (k->get_keycode() == KEY_CONTROL || k->get_keycode() == KEY_ALT || k->get_keycode() == KEY_SHIFT) {
viewport->update();
}
@@ -1315,7 +1315,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
// Drag the pivot (in pivot mode / with V key)
if (drag_type == DRAG_NONE) {
if ((b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
- (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_scancode() == KEY_V)) {
+ (k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_V)) {
List<CanvasItem *> selection = _get_edited_canvas_items();
// Filters the selection with nodes that allow setting the pivot
@@ -1367,7 +1367,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
// Confirm the pivot move
if ((b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
- (k.is_valid() && !k->is_pressed() && k->get_scancode() == KEY_V)) {
+ (k.is_valid() && !k->is_pressed() && k->get_keycode() == KEY_V)) {
_commit_canvas_item_state(drag_selection, TTR("Move pivot"));
drag_type = DRAG_NONE;
return true;
@@ -2109,7 +2109,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
// Move the canvas items with the arrow keys
if (k.is_valid() && k->is_pressed() && (tool == TOOL_SELECT || tool == TOOL_MOVE) &&
- (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
+ (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)) {
if (!k->is_echo()) {
// Start moving the canvas items with the keyboard
drag_selection = _get_edited_canvas_items();
@@ -2135,13 +2135,13 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
bool move_local_base_rotated = k->get_control() || k->get_metakey();
Vector2 dir;
- if (k->get_scancode() == KEY_UP)
+ if (k->get_keycode() == KEY_UP)
dir += Vector2(0, -1);
- else if (k->get_scancode() == KEY_DOWN)
+ else if (k->get_keycode() == KEY_DOWN)
dir += Vector2(0, 1);
- else if (k->get_scancode() == KEY_LEFT)
+ else if (k->get_keycode() == KEY_LEFT)
dir += Vector2(-1, 0);
- else if (k->get_scancode() == KEY_RIGHT)
+ else if (k->get_keycode() == KEY_RIGHT)
dir += Vector2(1, 0);
if (k->get_shift())
dir *= grid_step * Math::pow(2.0, grid_step_multiplier);
@@ -2197,7 +2197,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
}
if (k.is_valid() && !k->is_pressed() && drag_type == DRAG_KEY_MOVE && tool == TOOL_SELECT &&
- (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)) {
+ (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)) {
// Confirm canvas items move by arrow keys
if ((!Input::get_singleton()->is_key_pressed(KEY_UP)) &&
(!Input::get_singleton()->is_key_pressed(KEY_DOWN)) &&
@@ -2210,7 +2210,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
return true;
}
- return (k.is_valid() && (k->get_scancode() == KEY_UP || k->get_scancode() == KEY_DOWN || k->get_scancode() == KEY_LEFT || k->get_scancode() == KEY_RIGHT)); // Accept the key event in any case
+ return (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_LEFT || k->get_keycode() == KEY_RIGHT)); // Accept the key event in any case
}
bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
@@ -2387,7 +2387,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
}
}
- if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_ESCAPE && drag_type == DRAG_NONE && tool == TOOL_SELECT) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_ESCAPE && drag_type == DRAG_NONE && tool == TOOL_SELECT) {
// Unselect everything
editor_selection->clear();
viewport->update();
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 5f4fb19d9e..e9b66b9e58 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -238,7 +238,7 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
const InputEventKey &key = **key_ref;
if (key.is_pressed() && _selected_point != -1) {
- if (key.get_scancode() == KEY_DELETE)
+ if (key.get_keycode() == KEY_DELETE)
remove_point(_selected_point);
}
}
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 9dc98dc2a0..3123773795 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -166,10 +166,10 @@ void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie;
- if (k.is_valid() && (k->get_scancode() == KEY_UP ||
- k->get_scancode() == KEY_DOWN ||
- k->get_scancode() == KEY_PAGEUP ||
- k->get_scancode() == KEY_PAGEDOWN)) {
+ if (k.is_valid() && (k->get_keycode() == KEY_UP ||
+ k->get_keycode() == KEY_DOWN ||
+ k->get_keycode() == KEY_PAGEUP ||
+ k->get_keycode() == KEY_PAGEDOWN)) {
search_options->call("_gui_input", k);
search_box->accept_event();
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 4986e60ff0..a11a16b530 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1610,7 +1610,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
local_pos = mb->get_global_position() - tx->get_global_position();
create_menu = true;
- } else if (k.is_valid() && k->get_scancode() == KEY_MENU) {
+ } else if (k.is_valid() && k->get_keycode() == KEY_MENU) {
local_pos = tx->_get_cursor_pixel_pos();
create_menu = true;
}
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 6c20483cf6..bcc503cc58 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -531,7 +531,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
}
Ref<InputEventKey> k = ev;
- if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_MENU) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_MENU) {
TextEdit *tx = shader_editor->get_text_edit();
_make_context_menu(tx->is_selection_active(), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->_get_cursor_pixel_pos()));
context_menu->grab_focus();
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 6e8eeaec82..f0755fd6bb 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1873,11 +1873,11 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
if (!orthogonal && ED_IS_SHORTCUT("spatial_editor/freelook_toggle", p_event)) {
set_freelook_active(!is_freelook_active());
- } else if (k->get_scancode() == KEY_ESCAPE) {
+ } else if (k->get_keycode() == KEY_ESCAPE) {
set_freelook_active(false);
}
- if (k->get_scancode() == KEY_SPACE) {
+ if (k->get_keycode() == KEY_SPACE) {
if (!k->is_pressed()) emit_signal("toggle_maximize_view", this);
}
}
@@ -2074,8 +2074,8 @@ static bool is_shortcut_pressed(const String &p_path) {
return false;
}
const Input &input = *Input::get_singleton();
- int scancode = k->get_scancode();
- return input.is_key_pressed(scancode);
+ int keycode = k->get_keycode();
+ return input.is_key_pressed(keycode);
}
void SpatialEditorViewport::_update_freelook(real_t delta) {
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index a8b6d74c1f..1cf9f490cc 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -590,7 +590,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
}
Ref<InputEventKey> k = ev;
- if (k.is_valid() && k->is_pressed() && k->get_scancode() == KEY_MENU) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_MENU) {
TextEdit *tx = code_editor->get_text_edit();
int line = tx->cursor_get_line();
_make_context_menu(tx->is_selection_active(), tx->can_fold(line), tx->is_folded(line), (get_global_transform().inverse() * tx->get_global_transform()).xform(tx->_get_cursor_pixel_pos()));
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 10d00b2a1d..64168300af 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -359,10 +359,10 @@ void TileMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie;
- if (k.is_valid() && (k->get_scancode() == KEY_UP ||
- k->get_scancode() == KEY_DOWN ||
- k->get_scancode() == KEY_PAGEUP ||
- k->get_scancode() == KEY_PAGEDOWN)) {
+ if (k.is_valid() && (k->get_keycode() == KEY_UP ||
+ k->get_keycode() == KEY_DOWN ||
+ k->get_keycode() == KEY_PAGEUP ||
+ k->get_keycode() == KEY_PAGEDOWN)) {
palette->call("_gui_input", k);
search_box->accept_event();
@@ -1377,7 +1377,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (k.is_valid() && k->is_pressed()) {
- if (last_tool == TOOL_NONE && tool == TOOL_PICKING && k->get_scancode() == KEY_SHIFT && k->get_command()) {
+ if (last_tool == TOOL_NONE && tool == TOOL_PICKING && k->get_keycode() == KEY_SHIFT && k->get_command()) {
// trying to draw a rectangle with the painting tool, so change to the correct tool
tool = last_tool;
@@ -1385,7 +1385,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
_update_button_tool();
}
- if (k->get_scancode() == KEY_ESCAPE) {
+ if (k->get_keycode() == KEY_ESCAPE) {
if (tool == TOOL_PASTING)
copydata.clear();
@@ -1506,7 +1506,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (tool == TOOL_NONE) {
- if (k->get_scancode() == KEY_SHIFT && k->get_command()) {
+ if (k->get_keycode() == KEY_SHIFT && k->get_command()) {
tool = TOOL_PICKING;
_update_button_tool();
@@ -1514,9 +1514,9 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
} else if (tool == TOOL_PICKING) {
#ifdef APPLE_STYLE_KEYS
- if (k->get_scancode() == KEY_META) {
+ if (k->get_keycode() == KEY_META) {
#else
- if (k->get_scancode() == KEY_CONTROL) {
+ if (k->get_keycode() == KEY_CONTROL) {
#endif
// Go back to that last tool if KEY_CONTROL was released.
tool = last_tool;
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index e228f25c62..99db38c73a 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -1612,10 +1612,10 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos) {
void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> ie = p_ie;
- if (ie.is_valid() && (ie->get_scancode() == KEY_UP ||
- ie->get_scancode() == KEY_DOWN ||
- ie->get_scancode() == KEY_ENTER ||
- ie->get_scancode() == KEY_KP_ENTER)) {
+ if (ie.is_valid() && (ie->get_keycode() == KEY_UP ||
+ ie->get_keycode() == KEY_DOWN ||
+ ie->get_keycode() == KEY_ENTER ||
+ ie->get_keycode() == KEY_KP_ENTER)) {
members->call("_gui_input", ie);
node_filter->accept_event();
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 23a7628eeb..283bfe7897 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1904,7 +1904,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
// This is handled by the platform implementation on macOS,
// so only define the shortcut on other platforms
#ifndef OSX_ENABLED
- if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_Q)) {
+ if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_Q)) {
_dim_window();
get_tree()->quit();
}
@@ -1913,9 +1913,9 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
if (tabs->get_current_tab() != 0)
return;
- bool scancode_handled = true;
+ bool keycode_handled = true;
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_ENTER: {
@@ -1972,14 +1972,14 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) {
if (k->get_command())
this->project_filter->search_box->grab_focus();
else
- scancode_handled = false;
+ keycode_handled = false;
} break;
default: {
- scancode_handled = false;
+ keycode_handled = false;
} break;
}
- if (scancode_handled) {
+ if (keycode_handled) {
accept_event();
}
}
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 9bee84b482..5ca2bf6f40 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -82,7 +82,7 @@ void ProjectSettingsEditor::_unhandled_input(const Ref<InputEvent> &p_event) {
if (k.is_valid() && is_window_modal_on_top() && k->is_pressed()) {
- if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
+ if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
if (search_button->is_pressed()) {
search_box->grab_focus();
search_box->select_all();
@@ -110,7 +110,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
translation_list->connect_compat("button_pressed", this, "_translation_delete");
_update_actions();
- popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
+ popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key"), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
+ popup_add->add_icon_item(get_icon("KeyboardPhysical", "EditorIcons"), TTR("Physical Key"), INPUT_KEY_PHYSICAL);
popup_add->add_icon_item(get_icon("JoyButton", "EditorIcons"), TTR("Joy Button"), INPUT_JOY_BUTTON);
popup_add->add_icon_item(get_icon("JoyAxis", "EditorIcons"), TTR("Joy Axis"), INPUT_JOY_MOTION);
popup_add->add_icon_item(get_icon("Mouse", "EditorIcons"), TTR("Mouse Button"), INPUT_MOUSE_BUTTON);
@@ -146,6 +147,7 @@ void ProjectSettingsEditor::_notification(int p_what) {
search_box->set_clear_button_enabled(true);
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
+ popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY_PHYSICAL), get_icon("KeyboardPhysical", "EditorIcons"));
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
@@ -361,7 +363,13 @@ void ProjectSettingsEditor::_press_a_key_confirm() {
Ref<InputEventKey> ie;
ie.instance();
- ie->set_scancode(last_wait_for_key->get_scancode());
+ if (press_a_key_physical) {
+ ie->set_physical_keycode(last_wait_for_key->get_physical_keycode());
+ ie->set_keycode(0);
+ } else {
+ ie->set_physical_keycode(0);
+ ie->set_keycode(last_wait_for_key->get_keycode());
+ }
ie->set_shift(last_wait_for_key->get_shift());
ie->set_alt(last_wait_for_key->get_alt());
ie->set_control(last_wait_for_key->get_control());
@@ -379,8 +387,14 @@ void ProjectSettingsEditor::_press_a_key_confirm() {
Ref<InputEventKey> aie = events[i];
if (aie.is_null())
continue;
- if (aie->get_scancode_with_modifiers() == ie->get_scancode_with_modifiers()) {
- return;
+ if (!press_a_key_physical) {
+ if (aie->get_keycode_with_modifiers() == ie->get_keycode_with_modifiers()) {
+ return;
+ }
+ } else {
+ if (aie->get_physical_keycode_with_modifiers() == ie->get_physical_keycode_with_modifiers()) {
+ return;
+ }
}
}
@@ -441,10 +455,10 @@ void ProjectSettingsEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() != 0) {
last_wait_for_key = p_event;
- const String str = keycode_get_string(k->get_scancode_with_modifiers());
+ const String str = (press_a_key_physical) ? keycode_get_string(k->get_physical_keycode_with_modifiers()) + TTR(" (Physical)") : keycode_get_string(k->get_keycode_with_modifiers());
press_a_key_label->set_text(str);
press_a_key->get_ok()->set_disabled(false);
@@ -460,6 +474,7 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
case INPUT_KEY: {
+ press_a_key_physical = false;
press_a_key_label->set_text(TTR("Press a Key..."));
press_a_key->get_ok()->set_disabled(true);
last_wait_for_key = Ref<InputEvent>();
@@ -467,6 +482,16 @@ void ProjectSettingsEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_even
press_a_key->grab_focus();
} break;
+ case INPUT_KEY_PHYSICAL: {
+
+ press_a_key_physical = true;
+ press_a_key_label->set_text(TTR("Press a Key..."));
+
+ last_wait_for_key = Ref<InputEvent>();
+ press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
+ press_a_key->grab_focus();
+
+ } break;
case INPUT_MOUSE_BUTTON: {
device_index_label->set_text(TTR("Mouse Button Index:"));
@@ -547,7 +572,11 @@ void ProjectSettingsEditor::_edit_item(Ref<InputEvent> p_exiting_event) {
InputType ie_type;
if ((Ref<InputEventKey>(p_exiting_event)).is_valid()) {
- ie_type = INPUT_KEY;
+ if ((Ref<InputEventKey>(p_exiting_event))->get_keycode() != 0) {
+ ie_type = INPUT_KEY;
+ } else {
+ ie_type = INPUT_KEY_PHYSICAL;
+ }
} else if ((Ref<InputEventJoypadButton>(p_exiting_event)).is_valid()) {
ie_type = INPUT_JOY_BUTTON;
@@ -745,10 +774,14 @@ void ProjectSettingsEditor::_update_actions() {
Ref<InputEventKey> k = event;
if (k.is_valid()) {
- const String str = keycode_get_string(k->get_scancode_with_modifiers());
+ const String str = (k->get_keycode() == 0) ? keycode_get_string(k->get_physical_keycode_with_modifiers()) + TTR(" (Physical)") : keycode_get_string(k->get_keycode_with_modifiers());
action2->set_text(0, str);
- action2->set_icon(0, get_icon("Keyboard", "EditorIcons"));
+ if ((k->get_keycode() != 0)) {
+ action2->set_icon(0, get_icon("Keyboard", "EditorIcons"));
+ } else {
+ action2->set_icon(0, get_icon("KeyboardPhysical", "EditorIcons"));
+ }
}
Ref<InputEventJoypadButton> jb = event;
@@ -1964,6 +1997,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
add_child(popup_add);
popup_add->connect_compat("id_pressed", this, "_add_item");
+ press_a_key_physical = false;
+
press_a_key = memnew(ConfirmationDialog);
press_a_key->set_focus_mode(FOCUS_ALL);
add_child(press_a_key);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 5755b258c3..9054991dfd 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -45,6 +45,7 @@ class ProjectSettingsEditor : public AcceptDialog {
enum InputType {
INPUT_KEY,
+ INPUT_KEY_PHYSICAL,
INPUT_JOY_BUTTON,
INPUT_JOY_MOTION,
INPUT_MOUSE_BUTTON
@@ -77,6 +78,7 @@ class ProjectSettingsEditor : public AcceptDialog {
OptionButton *type;
PopupMenu *popup_add;
ConfirmationDialog *press_a_key;
+ bool press_a_key_physical;
Label *press_a_key_label;
ConfirmationDialog *device_input;
OptionButton *device_id;
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 3c61e40b58..c5c5908bfa 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -45,7 +45,7 @@ void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
if (k.is_valid()) {
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index 57e3c1da70..a4a89fb458 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -83,7 +83,7 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie;
if (k.is_valid()) {
- switch (k->get_scancode()) {
+ switch (k->get_keycode()) {
case KEY_UP:
case KEY_DOWN:
case KEY_PAGEUP:
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 9f8a531762..e258b66bc4 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -163,7 +163,7 @@ void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
handled = true;
}
- if (k->get_scancode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
+ if (k->get_keycode_with_modifiers() == (KEY_MASK_CMD | KEY_F)) {
_focus_current_search_box();
handled = true;
}
@@ -317,10 +317,10 @@ void EditorSettingsDialog::_wait_for_key(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> k = p_event;
- if (k.is_valid() && k->is_pressed() && k->get_scancode() != 0) {
+ if (k.is_valid() && k->is_pressed() && k->get_keycode() != 0) {
last_wait_for_key = k;
- const String str = keycode_get_string(k->get_scancode_with_modifiers());
+ const String str = keycode_get_string(k->get_keycode_with_modifiers());
press_a_key_label->set_text(str);
press_a_key->accept_event();
@@ -334,7 +334,7 @@ void EditorSettingsDialog::_press_a_key_confirm() {
Ref<InputEventKey> ie;
ie.instance();
- ie->set_scancode(last_wait_for_key->get_scancode());
+ ie->set_keycode(last_wait_for_key->get_keycode());
ie->set_shift(last_wait_for_key->get_shift());
ie->set_control(last_wait_for_key->get_control());
ie->set_alt(last_wait_for_key->get_alt());