Add Tablet/Trackpad
nav preset
This commit adds a new navigation preset called `Tablet/Trackpad` which enables "Emulate 3 Button Mouse" to more quickly set up good default keys for tablet users. It also adds support for mouse buttons 4 and 5 in the navigation settings which will be helpful if users want to customize 3D navigation further for specific pens/mice.
This commit is contained in:
parent
842f982397
commit
3f31d0832b
5 changed files with 48 additions and 11 deletions
|
@ -357,11 +357,12 @@
|
|||
If [code]true[/code], invert the vertical mouse axis when panning, orbiting, or using freelook mode in the 3D editor.
|
||||
</member>
|
||||
<member name="editors/3d/navigation/navigation_scheme" type="int" setter="" getter="">
|
||||
The navigation scheme preset to use in the 3D editor. Changing this setting will affect the mouse button and modifier controls used to navigate the 3D editor viewport.
|
||||
The navigation scheme preset to use in the 3D editor. Changing this setting will affect the mouse button, [member editors/3d/navigation/emulate_3_button_mouse] setting, and modifier keys used to navigate the 3D editor viewport.
|
||||
All schemes can use [kbd]Mouse wheel[/kbd] to zoom.
|
||||
- [b]Godot:[/b] [kbd]Middle mouse button[/kbd] to orbit. [kbd]Shift + Middle mouse button[/kbd] to pan. [kbd]Ctrl + Shift + Middle mouse button[/kbd] to zoom.
|
||||
- [b]Maya:[/b] [kbd]Alt + Left mouse button[/kbd] to orbit. [kbd]Middle mouse button[/kbd] to pan, [kbd]Shift + Middle mouse button[/kbd] to pan 10 times faster. [kbd]Alt + Right mouse button[/kbd] to zoom.
|
||||
- [b]Modo:[/b] [kbd]Alt + Left mouse button[/kbd] to orbit. [kbd]Alt + Shift + Left mouse button[/kbd] to pan. [kbd]Ctrl + Alt + Left mouse button[/kbd] to zoom.
|
||||
- [b]Tablet/Trackpad:[/b] [kbd]Alt[/kbd] to orbit. [kbd]Shift[/kbd] to pan. [kbd]Ctrl[/kbd] to zoom. The [member editors/3d/navigation/emulate_3_button_mouse] setting will be set to true.
|
||||
See also [member editors/3d/navigation/orbit_mouse_button], [member editors/3d/navigation/pan_mouse_button], [member editors/3d/navigation/zoom_mouse_button], and [member editors/3d/freelook/freelook_navigation_scheme].
|
||||
[b]Note:[/b] On certain window managers on Linux, the [kbd]Alt[/kbd] key will be intercepted by the window manager when clicking a mouse button at the same time. This means Godot will not see the modifier key as being pressed.
|
||||
</member>
|
||||
|
|
|
@ -811,10 +811,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
// 3D: Navigation
|
||||
_initial_set("editors/3d/navigation/invert_x_axis", false, true);
|
||||
_initial_set("editors/3d/navigation/invert_y_axis", false, true);
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/navigation_scheme", 0, "Godot,Maya,Modo,Custom")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/orbit_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/pan_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/zoom_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/navigation_scheme", 0, "Godot:0,Maya:1,Modo:2,Tablet/Trackpad:4,Custom:3")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/orbit_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse,Mouse Button 4,Mouse Button 5")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/pan_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse,Mouse Button 4,Mouse Button 5")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/zoom_mouse_button", 1, "Left Mouse,Middle Mouse,Right Mouse,Mouse Button 4,Mouse Button 5")
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "editors/3d/navigation/zoom_style", 0, "Vertical,Horizontal")
|
||||
|
||||
_initial_set("editors/3d/navigation/emulate_numpad", false, true);
|
||||
|
|
|
@ -77,7 +77,7 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
|
|||
EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom");
|
||||
} else if (full_name.begins_with("editors/visual_editors/connection_colors") || full_name.begins_with("editors/visual_editors/category_colors")) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/visual_editors/color_theme", "Custom");
|
||||
} else if (full_name == "editors/3d/navigation/orbit_mouse_button" || full_name == "editors/3d/navigation/pan_mouse_button" || full_name == "editors/3d/navigation/zoom_mouse_button") {
|
||||
} else if (full_name == "editors/3d/navigation/orbit_mouse_button" || full_name == "editors/3d/navigation/pan_mouse_button" || full_name == "editors/3d/navigation/zoom_mouse_button" || full_name == "editors/3d/navigation/emulate_3_button_mouse") {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)Node3DEditorViewport::NAVIGATION_CUSTOM);
|
||||
} else if (full_name == "editors/3d/navigation/navigation_scheme") {
|
||||
update_navigation_preset();
|
||||
|
@ -89,6 +89,7 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
Node3DEditorViewport::ViewportNavMouseButton set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
Node3DEditorViewport::ViewportNavMouseButton set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
Node3DEditorViewport::ViewportNavMouseButton set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
bool set_3_button_mouse = false;
|
||||
Ref<InputEventKey> orbit_mod_key_1;
|
||||
Ref<InputEventKey> orbit_mod_key_2;
|
||||
Ref<InputEventKey> pan_mod_key_1;
|
||||
|
@ -102,6 +103,7 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
|
@ -113,6 +115,7 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_RIGHT_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
|
@ -124,18 +127,32 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_LEFT_MOUSE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::ALT);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_TABLET) {
|
||||
set_preset = true;
|
||||
set_orbit_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_pan_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_zoom_mouse_button = Node3DEditorViewport::NAVIGATION_MIDDLE_MOUSE;
|
||||
set_3_button_mouse = true;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
pan_mod_key_1 = InputEventKey::create_reference(Key::SHIFT);
|
||||
pan_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
zoom_mod_key_1 = InputEventKey::create_reference(Key::CTRL);
|
||||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
}
|
||||
// Set settings to the desired preset values.
|
||||
if (set_preset) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/orbit_mouse_button", (int)set_orbit_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/pan_mouse_button", (int)set_pan_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/zoom_mouse_button", (int)set_zoom_mouse_button);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/emulate_3_button_mouse", set_3_button_mouse);
|
||||
_set_shortcut_input("spatial_editor/viewport_orbit_modifier_1", orbit_mod_key_1);
|
||||
_set_shortcut_input("spatial_editor/viewport_orbit_modifier_2", orbit_mod_key_2);
|
||||
_set_shortcut_input("spatial_editor/viewport_pan_modifier_1", pan_mod_key_1);
|
||||
|
@ -775,7 +792,11 @@ PropertyInfo EditorSettingsDialog::_create_mouse_shortcut_property_info(const St
|
|||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Middle Mouse,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Right Mouse";
|
||||
hint_string += "Right Mouse,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Mouse Button 4,";
|
||||
hint_string += _get_shortcut_button_string(p_shortcut_1_name) + _get_shortcut_button_string(p_shortcut_2_name);
|
||||
hint_string += "Mouse Button 5";
|
||||
|
||||
return PropertyInfo(Variant::INT, p_property_name, PROPERTY_HINT_ENUM, hint_string);
|
||||
}
|
||||
|
|
|
@ -2122,6 +2122,18 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
|||
nav_mode = change_nav_from_shortcut;
|
||||
}
|
||||
|
||||
} else if (m->get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON1)) {
|
||||
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_MOUSE_4, shortcut_check_sets, false);
|
||||
if (change_nav_from_shortcut != NAVIGATION_NONE) {
|
||||
nav_mode = change_nav_from_shortcut;
|
||||
}
|
||||
|
||||
} else if (m->get_button_mask().has_flag(MouseButtonMask::MB_XBUTTON2)) {
|
||||
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_MOUSE_5, shortcut_check_sets, false);
|
||||
if (change_nav_from_shortcut != NAVIGATION_NONE) {
|
||||
nav_mode = change_nav_from_shortcut;
|
||||
}
|
||||
|
||||
} else if (EDITOR_GET("editors/3d/navigation/emulate_3_button_mouse")) {
|
||||
// Handle trackpad (no external mouse) use case
|
||||
NavigationMode change_nav_from_shortcut = _get_nav_mode_from_shortcut_check(NAVIGATION_LEFT_MOUSE, shortcut_check_sets, true);
|
||||
|
|
|
@ -190,10 +190,11 @@ public:
|
|||
};
|
||||
|
||||
enum NavigationScheme {
|
||||
NAVIGATION_GODOT,
|
||||
NAVIGATION_MAYA,
|
||||
NAVIGATION_MODO,
|
||||
NAVIGATION_CUSTOM,
|
||||
NAVIGATION_GODOT = 0,
|
||||
NAVIGATION_MAYA = 1,
|
||||
NAVIGATION_MODO = 2,
|
||||
NAVIGATION_CUSTOM = 3,
|
||||
NAVIGATION_TABLET = 4,
|
||||
};
|
||||
|
||||
enum FreelookNavigationScheme {
|
||||
|
@ -206,6 +207,8 @@ public:
|
|||
NAVIGATION_LEFT_MOUSE,
|
||||
NAVIGATION_MIDDLE_MOUSE,
|
||||
NAVIGATION_RIGHT_MOUSE,
|
||||
NAVIGATION_MOUSE_4,
|
||||
NAVIGATION_MOUSE_5,
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue