From 35bf23859a145989ef79c8cfac20d8c8eefe371c Mon Sep 17 00:00:00 2001 From: marynate Date: Mon, 31 Mar 2014 15:52:27 +0800 Subject: [PATCH] Fix bug in 3d navigation scheme selection; Add modo navigation scheme --- tools/editor/editor_settings.cpp | 2 +- tools/editor/plugins/spatial_editor_plugin.cpp | 14 ++++++++++---- tools/editor/plugins/spatial_editor_plugin.h | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index c5270753f0b..6f4db7412b5 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -404,7 +404,7 @@ void EditorSettings::_load_defaults() { set("3d_editor/default_z_far",500.0); set("3d_editor/navigation_scheme",0); - hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya"); + hints["3d_editor/navigation_scheme"]=PropertyInfo(Variant::INT,"3d_editor/navigation_scheme",PROPERTY_HINT_ENUM,"Godot,Maya,Modo"); set("3d_editor/orbit_modifier",0); hints["3d_editor/orbit_modifier"]=PropertyInfo(Variant::INT,"3d_editor/orbit_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); set("3d_editor/pan_modifier",1); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 600d4f51035..5c019d9f209 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -528,11 +528,11 @@ static int _get_key_modifier(const String& p_property) { SpatialEditorViewport::NavigationScheme SpatialEditorViewport::_get_navigation_schema(const String& p_property) { switch(EditorSettings::get_singleton()->get(p_property).operator int()) { + case 0: return NAVIGATION_GODOT; case 1: return NAVIGATION_MAYA; - case 0: - default: - return NAVIGATION_GODOT; + case 2: return NAVIGATION_MODO; } + return NAVIGATION_GODOT; } bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hilite_only) { @@ -1013,7 +1013,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } - NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_schema"); + NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme"); NavigationMode nav_mode = NAVIGATION_NONE; if (_edit.gizmo.is_valid()) { @@ -1036,6 +1036,12 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { } else if (m.button_mask&1) { if (nav_scheme == NAVIGATION_MAYA && m.mod.alt) { + nav_mode = NAVIGATION_ORBIT; + } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.shift) { + nav_mode = NAVIGATION_PAN; + } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt && m.mod.control) { + nav_mode = NAVIGATION_ZOOM; + } else if (nav_scheme == NAVIGATION_MODO && m.mod.alt) { nav_mode = NAVIGATION_ORBIT; } else { if (clicked) { diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 30eba5faccf..94711a5f021 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -120,7 +120,8 @@ class SpatialEditorViewport : public Control { enum NavigationScheme { NAVIGATION_GODOT, - NAVIGATION_MAYA + NAVIGATION_MAYA, + NAVIGATION_MODO, }; NavigationScheme _get_navigation_schema(const String& p_property);