summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2021-07-02 15:27:12 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2021-07-02 15:41:44 +0800
commit4a26e61e89807c0f452f7cb4b6bde590ef39c891 (patch)
treea116c75015805e2ce5185319eaa4fb0025ac0c4e /editor
parenteefe276a82c5ed080c10ac7c991e0348642621b2 (diff)
Add numpad emulation in 3D viewport
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 6004427c0f..080563f375 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -631,6 +631,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("editors/3d/navigation/zoom_style", 0);
hints["editors/3d/navigation/zoom_style"] = PropertyInfo(Variant::INT, "editors/3d/navigation/zoom_style", PROPERTY_HINT_ENUM, "Vertical, Horizontal");
+ _initial_set("editors/3d/navigation/emulate_numpad", false);
_initial_set("editors/3d/navigation/emulate_3_button_mouse", false);
_initial_set("editors/3d/navigation/orbit_modifier", 0);
hints["editors/3d/navigation/orbit_modifier"] = PropertyInfo(Variant::INT, "editors/3d/navigation/orbit_modifier", PROPERTY_HINT_ENUM, "None,Shift,Alt,Meta,Ctrl");
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 228fe1649b..d17888be67 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -1967,6 +1967,13 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
return;
}
+ if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_numpad")) {
+ const uint32_t code = k->get_keycode();
+ if (code >= KEY_0 && code <= KEY_9) {
+ k->set_keycode(code - KEY_0 + KEY_KP_0);
+ }
+ }
+
if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
if (_edit.mode != TRANSFORM_NONE) {
_edit.snap = !_edit.snap;