diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-11-13 21:54:44 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-11-14 17:40:15 +0100 |
commit | 1e28571d82b711c6e1623eea0d5d844871ea22f5 (patch) | |
tree | 6434cb6b2675622bd094f6510b83c660b16ede87 | |
parent | 14e52f7aeea449dc6cfa8861657b2e23cc34c560 (diff) |
Always allow Alt as an orbit modifier in the 3D editor
This makes it easier to navigate in 3D when using a graphics tablet.
This fallback modifier will only be available if no other modifier
is using Alt.
This partially addresses
https://github.com/godotengine/godot-proposals/issues/196.
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index e0189f8a92..d187e4ff4a 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -965,7 +965,7 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } if (b->is_pressed()) { - int mod = _get_key_modifier(b); + const int mod = _get_key_modifier(b); if (!orthogonal) { if (mod == _get_key_modifier_setting("editors/3d/freelook/freelook_activation_modifier")) { set_freelook_active(true); @@ -1656,14 +1656,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (nav_scheme == NAVIGATION_GODOT) { - int mod = _get_key_modifier(m); + const int mod = _get_key_modifier(m); - if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) + if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) { nav_mode = NAVIGATION_PAN; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) + } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) { nav_mode = NAVIGATION_ZOOM; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) + } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) { + // Always allow Alt as a modifier to better support graphic tablets. nav_mode = NAVIGATION_ORBIT; + } } else if (nav_scheme == NAVIGATION_MAYA) { if (m->get_alt()) @@ -1672,15 +1674,17 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { } else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case - int mod = _get_key_modifier(m); + const int mod = _get_key_modifier(m); if (mod) { - if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) + if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) { nav_mode = NAVIGATION_PAN; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) + } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) { nav_mode = NAVIGATION_ZOOM; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) + } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) { + // Always allow Alt as a modifier to better support graphic tablets. nav_mode = NAVIGATION_ORBIT; + } } } @@ -1727,14 +1731,16 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) { if (nav_scheme == NAVIGATION_GODOT) { - int mod = _get_key_modifier(pan_gesture); + const int mod = _get_key_modifier(pan_gesture); - if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) + if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) { nav_mode = NAVIGATION_PAN; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) + } else if (mod == _get_key_modifier_setting("editors/3d/navigation/zoom_modifier")) { nav_mode = NAVIGATION_ZOOM; - else if (mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) + } else if (mod == KEY_ALT || mod == _get_key_modifier_setting("editors/3d/navigation/orbit_modifier")) { + // Always allow Alt as a modifier to better support graphic tablets. nav_mode = NAVIGATION_ORBIT; + } } else if (nav_scheme == NAVIGATION_MAYA) { if (pan_gesture->get_alt()) |