diff options
Diffstat (limited to 'editor')
40 files changed, 133 insertions, 212 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index c8f7e88082..ddd702fc6c 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: { @@ -1257,7 +1257,7 @@ void CodeTextEditor::clone_lines_down() { text_editor->cursor_set_line(cursor_new_line); text_editor->cursor_set_column(cursor_new_column); if (selection_active) { - text_editor->select(to_line, to_column, 2 * to_line - from_line, 2 * to_column - from_column); + text_editor->select(to_line, to_column, 2 * to_line - from_line, to_line == from_line ? 2 * to_column - from_column : to_column); } text_editor->end_complex_operation(); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index bb59ddad46..3e09a9a760 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 3a216c163f..d77216697e 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_data.cpp b/editor/editor_data.cpp index 26d132665c..192e7d286f 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -435,10 +435,14 @@ void EditorData::restore_editor_global_states() { void EditorData::paste_object_params(Object *p_object) { + ERR_FAIL_NULL(p_object); + undo_redo.create_action(TTR("Paste Params")); for (List<PropertyData>::Element *E = clipboard.front(); E; E = E->next()) { - - p_object->set(E->get().name, E->get().value); + String name = E->get().name; + undo_redo.add_do_property(p_object, name, E->get().value); + undo_redo.add_undo_property(p_object, name, p_object->get(name)); } + undo_redo.commit_action(); } bool EditorData::call_build() { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 00c053e09f..b26fa77e16 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(); @@ -1803,7 +1803,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 8ca308572b..f7ce2dd4fc 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 5d4a9e738e..776fbd9314 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -45,7 +45,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 3f3d79c83a..ae16a50279 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -1531,7 +1531,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/export_template_manager.cpp b/editor/export_template_manager.cpp index bbf741948b..12c756122e 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -547,9 +547,7 @@ void ExportTemplateManager::_notification(int p_what) { bool ExportTemplateManager::can_install_android_template() { const String templates_dir = EditorSettings::get_singleton()->get_templates_dir().plus_file(VERSION_FULL_CONFIG); - return FileAccess::exists(templates_dir.plus_file("android_source.zip")) && - FileAccess::exists(templates_dir.plus_file("android_release.apk")) && - FileAccess::exists(templates_dir.plus_file("android_debug.apk")); + return FileAccess::exists(templates_dir.plus_file("android_source.zip")); } Error ExportTemplateManager::install_android_template() { 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/icons/NavigationAgent.svg b/editor/icons/NavigationAgent.svg new file mode 100644 index 0000000000..44c991d44c --- /dev/null +++ b/editor/icons/NavigationAgent.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 4.2333332 4.2333335" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="scale(.26458333)"><path d="m9 1c-1.3712923 0-2.308408.4294811-2.9394531 1.0742188-.6678822.6627728-1.3395938 1.3233299-2.0097657 1.984375-.0455468 1.7412784.7567781 4.3277129 2.3652344 4.84375.1781835.3171398.3844475.6487461.5839844.9765624v5.1210938l2-2c2-3 4-5.9999874 4-8s-1-4-4-4z" fill="#fff" fill-opacity=".392157"/><path d="m7 3c-3 0-4 1.9999874-4 4s2.0000003 5 4 8c2.0000001-3 4-5.9999874 4-8s-1-4-4-4zm0 2a1.9999999 1.9999999 0 0 1 2 2 1.9999999 1.9999999 0 0 1 -2 2 1.9999999 1.9999999 0 0 1 -2-2 1.9999999 1.9999999 0 0 1 2-2z" fill="#e0e0e0"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationAgent2D.svg b/editor/icons/NavigationAgent2D.svg new file mode 100644 index 0000000000..8ded0cea55 --- /dev/null +++ b/editor/icons/NavigationAgent2D.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 4.2333332 4.2333335" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 1c-2.9999997.0000126-5 2-5 5s3.0000003 6 5 9c2-3 5.007143-6.0296693 5-9 0-3-2-4.9999874-5-5zm0 2.5a2.4999999 2.4999999 0 0 1 2.5 2.5 2.4999999 2.4999999 0 0 1 -2.5 2.5 2.4999999 2.4999999 0 0 1 -2.5-2.5 2.4999999 2.4999999 0 0 1 2.5-2.5z" fill="#e0e0e0" transform="scale(.26458333)"/></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationObstacle.svg b/editor/icons/NavigationObstacle.svg new file mode 100644 index 0000000000..42481a6067 --- /dev/null +++ b/editor/icons/NavigationObstacle.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 4.2333332 4.2333335" width="16" xmlns="http://www.w3.org/2000/svg"><g transform="scale(.26458333)"><path d="m4.6074219 8.3789062c-1.7979243.927604-3.60742192 2.0716858-3.6074219 2.6210938 0 .999987 6.0000005 4 7 4 1.0000006 0 7-3.000013 7-4 0-.549408-1.809498-1.6934898-3.607422-2.6210938l.607422 1.6210938c2 4.000025-9.9999999 4.000025-8 0z" fill="#fff" fill-opacity=".392157"/><path d="m8 .875c-.375 0-.7499997.3749906-1 1.125l-3 8c-1.9999998 4.000025 10 4.000025 8 0l-3-8c-.2499997-.7500094-.625-1.125-1-1.125zm-1.5 4.125c.9999999.4999937 2.0000001.4999937 3 0l1 3.5c-1.4999996.9999874-3.4999996.9999874-5 0z" fill="#e0e0e0"/></g></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationObstacle2D.svg b/editor/icons/NavigationObstacle2D.svg new file mode 100644 index 0000000000..8a9c43ddad --- /dev/null +++ b/editor/icons/NavigationObstacle2D.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 4.2333332 4.2333335" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 .875c-.625 0-1.2499999.3749906-1.5 1.125l-2.9999999 10h8.9999999l-3-10c-.2499999-.7500094-.875-1.125-1.5-1.125zm-1.5 4.125h3l1 4h-5zm-4.5 8c-1 0-1 2 0 2h12c1 0 1-2 0-2z" fill="#e0e0e0" transform="scale(.26458333)"/></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationRegion.svg b/editor/icons/NavigationRegion.svg index 92cc9afd91..61f43497b4 100644 --- a/editor/icons/NavigationRegion.svg +++ b/editor/icons/NavigationRegion.svg @@ -1,58 +1 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:version="1.0beta2 (unknown)" - sodipodi:docname="icon_navigation_region.svg" - id="svg4" - version="1.1" - width="16" - viewBox="0 0 16 16" - height="16"> - <metadata - id="metadata10"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs8" /> - <sodipodi:namedview - inkscape:current-layer="svg4" - inkscape:window-maximized="0" - inkscape:window-y="18" - inkscape:window-x="0" - inkscape:cy="6.4771531" - inkscape:cx="15.373896" - inkscape:zoom="32" - showgrid="false" - id="namedview6" - inkscape:window-height="1041" - inkscape:window-width="1916" - inkscape:pageshadow="2" - inkscape:pageopacity="0" - guidetolerance="10" - gridtolerance="10" - objecttolerance="10" - borderopacity="1" - inkscape:document-rotation="0" - bordercolor="#666666" - pagecolor="#ffffff" /> - <path - sodipodi:nodetypes="ccccccccccccccccccc" - inkscape:connector-curvature="0" - d="M 3,1 C 1.895431,1 1,1.895431 1,3 v 10 c 0,1.104569 0.895431,2 2,2 L 7.2383,14 C 8.917345,11.151816 9.09393,5.498579 11.99998,5.00198 h 0.02344 c 0.825004,0.0095 1.559551,0.524505 1.8496,1.2969 l 0.12695,0.33789 1,-3.6367 c 0,-1.104569 -0.895431,-2 -2,-2 H 8.20155 2.99997 Z m 9,6 -3,8 3,-2 3,2 z" - fill="#fc9c9c" - fill-opacity=".99608" - id="path2-3" /> -</svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.1339223.0000569-.2535666.030668-.3652344.074219-.022275.00881-.041042.020919-.0625.03125-.088962.042467-.1681009.095499-.2382812.1601562-.021532.01952-.042739.037285-.0625.058594-.074111.081092-.13722.1698052-.1816406.2695312-.00343.00765-.00847.013733-.011719.021484l-.00195.00195c-.0452281.1091913-.0629952.2269004-.0683623.3457062-.0005086.0130821-.0078112.023903-.0078125.0371094v12c.0000552.552262.4477381.999945 1 1h4.8847656a2.1184381 2.1184381 0 0 1 .1328125-.744141l2.9999999-7.9999996a2.1184381 2.1184381 0 0 1 2.007813-1.3730469 2.1184381 2.1184381 0 0 1 1.957031 1.3730469l1.017578 2.7128906v-6.96875c-.000001-.013206-.0073-.024027-.0078-.037109-.0054-.1188058-.02313-.2365149-.06836-.3457031l-.002-.00195c-.0032-.00756-.0084-.013999-.01172-.021484-.04442-.099726-.107529-.188439-.18164-.2695312-.01976-.021308-.04097-.039073-.0625-.058594-.07018-.064657-.149319-.1176895-.238282-.1601562-.02146-.010331-.04022-.022439-.0625-.03125-.111631-.0435548-.231276-.0741656-.365198-.0742225zm10 6-3 8 3-2 3 2z" fill="#fc9c9c" fill-opacity=".996078" fill-rule="evenodd"/></svg>
\ No newline at end of file diff --git a/editor/icons/NavigationRegion2D.svg b/editor/icons/NavigationRegion2D.svg index a297216cb7..f22e9f64f7 100644 --- a/editor/icons/NavigationRegion2D.svg +++ b/editor/icons/NavigationRegion2D.svg @@ -1,67 +1 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - inkscape:version="1.0beta2 (unknown)" - sodipodi:docname="icon_navigation_polygon_instance.svg" - id="svg8" - version="1.1" - width="16" - viewBox="0 0 16 16" - height="16"> - <metadata - id="metadata14"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs12" /> - <sodipodi:namedview - inkscape:current-layer="svg8" - inkscape:window-maximized="0" - inkscape:window-y="18" - inkscape:window-x="0" - inkscape:cy="10.058435" - inkscape:cx="5.8836841" - inkscape:zoom="19.64431" - showgrid="false" - id="namedview10" - inkscape:window-height="1041" - inkscape:window-width="1916" - inkscape:pageshadow="2" - inkscape:pageopacity="0" - guidetolerance="10" - gridtolerance="10" - objecttolerance="10" - borderopacity="1" - inkscape:document-rotation="0" - bordercolor="#666666" - pagecolor="#ffffff" /> - <g - id="g6" - transform="translate(0 -1036.4)" - fill-rule="evenodd" - fill-opacity=".98824" - fill="#a5b7f3"> - <path - sodipodi:nodetypes="cccccccccccccc" - inkscape:connector-curvature="0" - id="path2" - transform="translate(0,1036.4)" - d="M 2,1 C 1.4477381,1.0000552 1.0000552,1.4477381 1,2 v 12 c 5.52e-5,0.552262 0.4477381,0.999945 1,1 h 4.9023 c -7.836e-4,-0.251296 0.043539,-0.500692 0.13086,-0.73633 l 0.47461,-1.2637 2.5254,-6.7362 c 0.311135,-0.8280197 1.107723,-1.3723398 1.9922,-1.3613 0.146558,0.00168 0.292536,0.018702 0.43555,0.050781 l 2.2461,-2.2461 c 0.629502,-0.6299963 0.18357,-1.7066217 -0.70703,-1.707 h -12 z" /> - <path - id="path4" - d="m15 1051.4-3-8-3 8 3-2z" /> - </g> -</svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.1339223.0000569-.2535666.0306675-.3652344.0742188-.022275.0088111-.0410424.0209185-.0625.03125-.0889622.0424668-.1681009.0954994-.2382812.1601562-.0215322.0195204-.0427394.0372854-.0625.0585938-.0741112.0810923-.13722.1698052-.1816406.2695312-.0034324.0076504-.0084746.0137334-.0117188.0214844l-.0019531.0019531c-.0452252.1091882-.0629923.2268973-.0683594.3457031-.0005086.0130821-.0078112.023903-.0078125.0371094v12c.0000552.552262.4477381.999945 1 1h4.8847656a2.1184381 2.1184381 0 0 1 .1328125-.744141l2.9999999-7.9999996a2.1184381 2.1184381 0 0 1 2.007813-1.3730469 2.1184381 2.1184381 0 0 1 1.957031 1.3730469l1.017578 2.7128906v-6.96875c-.000001-.0132064-.007305-.0240273-.007812-.0371094-.005369-.1188058-.023135-.2365149-.06836-.3457031l-.001953-.0019531c-.003155-.0075626-.008384-.0139987-.011719-.0214844-.044421-.099726-.107529-.188439-.18164-.2695312-.019761-.0213083-.040968-.0390734-.0625-.0585938-.070181-.0646568-.149319-.1176895-.238282-.1601562-.021457-.0103315-.040225-.022439-.0625-.03125-.111667-.0435511-.231312-.0741619-.365234-.0742188zm10 6-3 8 3-2 3 2z" fill="#a5b7f3" fill-opacity=".98824" fill-rule="evenodd"/></svg>
\ No newline at end of file diff --git a/editor/icons/PlaneMesh.svg b/editor/icons/PlaneMesh.svg new file mode 100644 index 0000000000..2512fc9031 --- /dev/null +++ b/editor/icons/PlaneMesh.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8 4-7 4 7 4 7-4zm0 2 3.5 2-3.5 2-3.5-2z" fill="#ffd684"/></svg>
\ No newline at end of file diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 6b8cb49412..2729d9ecb5 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -76,7 +76,6 @@ void InspectorDock::_menu_option(int p_option) { editor_data->apply_changes_in_editors(); if (current) editor_data->paste_object_params(current); - editor_data->get_undo_redo().clear_history(); } break; case OBJECT_UNIQUE_RESOURCES: { diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 6e950e8c0b..8d5444db73 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 d5d5727ad9..7916ac71ea 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 363c3a0e0a..663f2dde05 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 0450f3c472..af12335a27 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 77a8489f9e..cae959e1f4 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 e598fc5d8b..ea5da1d9ac 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -617,7 +617,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 72396174ee..af7f8cf5d6 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(); @@ -5393,8 +5393,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { editor_selection->connect("selection_changed", callable_mp((CanvasItem *)this, &CanvasItem::update)); editor_selection->connect("selection_changed", callable_mp(this, &CanvasItemEditor::_selection_changed)); - editor->call_deferred("connect", make_binds("play_pressed", Callable(this, "_update_override_camera_button"), true)); - editor->call_deferred("connect", make_binds("stop_pressed", Callable(this, "_update_override_camera_button"), false)); + editor->call_deferred("connect", "play_pressed", Callable(this, "_update_override_camera_button"), make_binds(true)); + editor->call_deferred("connect", "stop_pressed", Callable(this, "_update_override_camera_button"), make_binds(false)); hb = memnew(HBoxContainer); add_child(hb); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index adf859eb1e..878787231d 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 fd9c8f6f39..60bed10351 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 d3d64f0dc5..02168a4c97 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1600,7 +1600,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 31f126cc0a..01b1e21153 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -522,7 +522,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 dd006316f7..0bbcbb0080 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 8d3788dea7..35f23ccf1d 100644 --- a/editor/plugins/text_editor.cpp +++ b/editor/plugins/text_editor.cpp @@ -582,7 +582,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 82f04aaac4..017f986469 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 b3b9afb811..e7b7c05901 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1663,10 +1663,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 79f3745d11..1320ec46b5 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1899,7 +1899,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(); } @@ -1908,9 +1908,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: { @@ -1967,14 +1967,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 b4f101b47b..7d8a4a733d 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("button_pressed", callable_mp(this, &ProjectSettingsEditor::_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; @@ -1924,6 +1957,8 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { add_child(popup_add); popup_add->connect("id_pressed", callable_mp(this, &ProjectSettingsEditor::_add_item), make_binds(Ref<InputEvent>())); + 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 9f49ffcd28..ede7b860d6 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 0214fc6bfc..8a5fad269f 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 ff708f9229..cf93fab9a8 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()); |