Add View3DController for editor 3D view manipulation
This commit is contained in:
parent
bfbe95e510
commit
27c86165f7
9 changed files with 1609 additions and 1378 deletions
|
|
@ -74,17 +74,52 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {
|
|||
settings["canvas_item_editor/pan_view"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_view"));
|
||||
settings["box_selection_fill_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_fill_color"), EditorStringName(Editor));
|
||||
settings["box_selection_stroke_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor));
|
||||
#ifndef _3D_DISABLED
|
||||
settings["editors/3d/default_fov"] = EDITOR_GET("editors/3d/default_fov");
|
||||
settings["editors/3d/default_z_near"] = EDITOR_GET("editors/3d/default_z_near");
|
||||
settings["editors/3d/default_z_far"] = EDITOR_GET("editors/3d/default_z_far");
|
||||
settings["editors/3d/navigation/invert_x_axis"] = EDITOR_GET("editors/3d/navigation/invert_x_axis");
|
||||
settings["editors/3d/navigation/invert_y_axis"] = EDITOR_GET("editors/3d/navigation/invert_y_axis");
|
||||
settings["editors/3d/navigation/warped_mouse_panning"] = EDITOR_GET("editors/3d/navigation/warped_mouse_panning");
|
||||
settings["editors/3d/navigation/pan_mouse_button"] = EDITOR_GET("editors/3d/navigation/pan_mouse_button");
|
||||
settings["editors/3d/freelook/freelook_navigation_scheme"] = EDITOR_GET("editors/3d/freelook/freelook_navigation_scheme");
|
||||
settings["editors/3d/freelook/freelook_base_speed"] = EDITOR_GET("editors/3d/freelook/freelook_base_speed");
|
||||
settings["editors/3d/freelook/freelook_sensitivity"] = EDITOR_GET("editors/3d/freelook/freelook_sensitivity");
|
||||
settings["editors/3d/freelook/freelook_inertia"] = EDITOR_GET("editors/3d/freelook/freelook_inertia");
|
||||
settings["editors/3d/freelook/freelook_speed_zoom_link"] = EDITOR_GET("editors/3d/freelook/freelook_speed_zoom_link");
|
||||
settings["editors/3d/freelook/freelook_invert_y_axis"] = EDITOR_GET("editors/3d/freelook/freelook_invert_y_axis");
|
||||
settings["editors/3d/navigation/orbit_mouse_button"] = EDITOR_GET("editors/3d/navigation/orbit_mouse_button");
|
||||
settings["editors/3d/navigation_feel/orbit_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/orbit_sensitivity");
|
||||
settings["editors/3d/navigation_feel/orbit_inertia"] = EDITOR_GET("editors/3d/navigation_feel/orbit_inertia");
|
||||
settings["editors/3d/navigation/zoom_style"] = EDITOR_GET("editors/3d/navigation/zoom_style");
|
||||
settings["editors/3d/navigation_feel/zoom_inertia"] = EDITOR_GET("editors/3d/navigation_feel/zoom_inertia");
|
||||
settings["editors/3d/navigation/zoom_mouse_button"] = EDITOR_GET("editors/3d/navigation/zoom_mouse_button");
|
||||
settings["editors/3d/navigation_feel/translation_sensitivity"] = EDITOR_GET("editors/3d/navigation_feel/translation_sensitivity");
|
||||
settings["editors/3d/navigation_feel/translation_inertia"] = EDITOR_GET("editors/3d/navigation_feel/translation_inertia");
|
||||
settings["editors/3d/navigation_feel/angle_snap_threshold"] = EDITOR_GET("editors/3d/navigation_feel/angle_snap_threshold");
|
||||
settings["editors/3d/navigation/emulate_3_button_mouse"] = EDITOR_GET("editors/3d/navigation/emulate_3_button_mouse");
|
||||
settings["editors/3d/navigation/emulate_numpad"] = EDITOR_GET("editors/3d/navigation/emulate_numpad");
|
||||
settings["editors/3d/selection_box_color"] = EDITOR_GET("editors/3d/selection_box_color");
|
||||
settings["spatial_editor/decrease_fov"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/decrease_fov"));
|
||||
settings["spatial_editor/increase_fov"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/increase_fov"));
|
||||
settings["spatial_editor/reset_fov"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/reset_fov"));
|
||||
settings["spatial_editor/viewport_pan_modifier_1"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_pan_modifier_1"));
|
||||
settings["spatial_editor/viewport_pan_modifier_2"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_pan_modifier_2"));
|
||||
settings["spatial_editor/viewport_orbit_modifier_1"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_orbit_modifier_1"));
|
||||
settings["spatial_editor/viewport_orbit_modifier_2"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_orbit_modifier_2"));
|
||||
settings["spatial_editor/viewport_orbit_snap_modifier_1"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_orbit_snap_modifier_1"));
|
||||
settings["spatial_editor/viewport_orbit_snap_modifier_2"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_orbit_snap_modifier_2"));
|
||||
settings["spatial_editor/viewport_zoom_modifier_1"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_zoom_modifier_1"));
|
||||
settings["spatial_editor/viewport_zoom_modifier_2"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/viewport_zoom_modifier_2"));
|
||||
settings["spatial_editor/freelook_forward"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_forward"));
|
||||
settings["spatial_editor/freelook_backwards"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_backwards"));
|
||||
settings["spatial_editor/freelook_left"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_left"));
|
||||
settings["spatial_editor/freelook_right"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_right"));
|
||||
settings["spatial_editor/freelook_up"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_up"));
|
||||
settings["spatial_editor/freelook_down"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_down"));
|
||||
settings["spatial_editor/freelook_speed_modifier"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_speed_modifier"));
|
||||
settings["spatial_editor/freelook_slow_modifier"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("spatial_editor/freelook_slow_modifier"));
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
Array setup_data;
|
||||
setup_data.append(settings);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -34,6 +34,7 @@
|
|||
#include "editor/plugins/editor_plugin.h"
|
||||
#include "editor/scene/3d/node_3d_editor_gizmos.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "scene/debugger/view_3d_controller.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/gui/spin_box.h"
|
||||
|
|
@ -173,16 +174,6 @@ class Node3DEditorViewport : public Control {
|
|||
VIEW_MAX
|
||||
};
|
||||
|
||||
enum ViewType {
|
||||
VIEW_TYPE_USER,
|
||||
VIEW_TYPE_TOP,
|
||||
VIEW_TYPE_BOTTOM,
|
||||
VIEW_TYPE_LEFT,
|
||||
VIEW_TYPE_RIGHT,
|
||||
VIEW_TYPE_FRONT,
|
||||
VIEW_TYPE_REAR,
|
||||
};
|
||||
|
||||
public:
|
||||
static constexpr int32_t GIZMO_BASE_LAYER = 27;
|
||||
static constexpr int32_t GIZMO_EDIT_LAYER = 26;
|
||||
|
|
@ -191,28 +182,6 @@ public:
|
|||
|
||||
static constexpr int32_t FRAME_TIME_HISTORY = 20;
|
||||
|
||||
enum NavigationScheme {
|
||||
NAVIGATION_GODOT = 0,
|
||||
NAVIGATION_MAYA = 1,
|
||||
NAVIGATION_MODO = 2,
|
||||
NAVIGATION_CUSTOM = 3,
|
||||
NAVIGATION_TABLET = 4,
|
||||
};
|
||||
|
||||
enum FreelookNavigationScheme {
|
||||
FREELOOK_DEFAULT,
|
||||
FREELOOK_PARTIALLY_AXIS_LOCKED,
|
||||
FREELOOK_FULLY_AXIS_LOCKED,
|
||||
};
|
||||
|
||||
enum ViewportNavMouseButton {
|
||||
NAVIGATION_LEFT_MOUSE,
|
||||
NAVIGATION_MIDDLE_MOUSE,
|
||||
NAVIGATION_RIGHT_MOUSE,
|
||||
NAVIGATION_MOUSE_4,
|
||||
NAVIGATION_MOUSE_5,
|
||||
};
|
||||
|
||||
private:
|
||||
double cpu_time_history[FRAME_TIME_HISTORY];
|
||||
int cpu_time_history_index;
|
||||
|
|
@ -230,9 +199,7 @@ private:
|
|||
Ref<StandardMaterial3D> ruler_material_xray;
|
||||
|
||||
int index;
|
||||
ViewType view_type;
|
||||
void _menu_option(int p_option);
|
||||
void _set_auto_orthogonal();
|
||||
Node3D *preview_node = nullptr;
|
||||
bool update_preview_node = false;
|
||||
Point2 preview_node_viewport_pos;
|
||||
|
|
@ -260,17 +227,10 @@ private:
|
|||
SubViewport *viewport = nullptr;
|
||||
Camera3D *camera = nullptr;
|
||||
bool transforming = false;
|
||||
bool orthogonal;
|
||||
bool auto_orthogonal;
|
||||
bool lock_rotation;
|
||||
bool transform_gizmo_visible = true;
|
||||
bool collision_reposition = false;
|
||||
real_t gizmo_scale;
|
||||
|
||||
bool freelook_active;
|
||||
real_t freelook_speed;
|
||||
Vector2 previous_mouse_position;
|
||||
|
||||
PanelContainer *info_panel = nullptr;
|
||||
Label *info_label = nullptr;
|
||||
Label *cinema_label = nullptr;
|
||||
|
|
@ -298,6 +258,8 @@ private:
|
|||
_FORCE_INLINE_ bool operator<(const _RayResult &p_rr) const { return depth < p_rr.depth; }
|
||||
};
|
||||
|
||||
void _view_state_changed();
|
||||
|
||||
void _update_name();
|
||||
void _compute_edit(const Point2 &p_point);
|
||||
void _clear_selected();
|
||||
|
|
@ -319,14 +281,8 @@ private:
|
|||
bool _transform_gizmo_select(const Vector2 &p_screenpos, bool p_highlight_only = false);
|
||||
void _transform_gizmo_apply(Node3D *p_node, const Transform3D &p_transform, bool p_local);
|
||||
|
||||
void _nav_pan(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative);
|
||||
void _nav_zoom(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative);
|
||||
void _nav_orbit(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative);
|
||||
void _nav_look(Ref<InputEventWithModifiers> p_event, const Vector2 &p_relative);
|
||||
|
||||
bool _is_shortcut_empty(const String &p_name);
|
||||
bool _is_nav_modifier_pressed(const String &p_name);
|
||||
int _get_shortcut_input_count(const String &p_name);
|
||||
|
||||
float get_znear() const;
|
||||
float get_zfar() const;
|
||||
|
|
@ -342,19 +298,6 @@ private:
|
|||
|
||||
PopupMenu *selection_menu = nullptr;
|
||||
|
||||
enum NavigationZoomStyle {
|
||||
NAVIGATION_ZOOM_VERTICAL,
|
||||
NAVIGATION_ZOOM_HORIZONTAL
|
||||
};
|
||||
|
||||
enum NavigationMode {
|
||||
NAVIGATION_NONE,
|
||||
NAVIGATION_PAN,
|
||||
NAVIGATION_ZOOM,
|
||||
NAVIGATION_ORBIT,
|
||||
NAVIGATION_LOOK,
|
||||
NAVIGATION_MOVE
|
||||
};
|
||||
enum TransformMode {
|
||||
TRANSFORM_NONE,
|
||||
TRANSFORM_ROTATE,
|
||||
|
|
@ -413,59 +356,15 @@ private:
|
|||
bool gizmo_initiated = false;
|
||||
} _edit;
|
||||
|
||||
struct Cursor {
|
||||
Vector3 pos;
|
||||
real_t x_rot, y_rot, distance, fov_scale;
|
||||
real_t unsnapped_x_rot, unsnapped_y_rot;
|
||||
Vector3 eye_pos; // Used in freelook mode
|
||||
bool region_select;
|
||||
Point2 region_begin, region_end;
|
||||
Ref<View3DController> view_3d_controller;
|
||||
void _update_view_3d_controller(bool p_update_all = true);
|
||||
|
||||
Cursor() {
|
||||
// These rotations place the camera in +X +Y +Z, aka south east, facing north west.
|
||||
x_rot = 0.5;
|
||||
y_rot = -0.5;
|
||||
unsnapped_x_rot = x_rot;
|
||||
unsnapped_y_rot = y_rot;
|
||||
distance = 4;
|
||||
fov_scale = 1.0;
|
||||
region_select = false;
|
||||
}
|
||||
};
|
||||
// Viewport camera supports movement smoothing,
|
||||
// so one cursor is the real cursor, while the other can be an interpolated version.
|
||||
Cursor cursor; // Immediate cursor
|
||||
Cursor camera_cursor; // That one may be interpolated (don't modify this one except for smoothing purposes)
|
||||
Cursor previous_cursor; // Storing previous cursor state for canceling purposes
|
||||
void _cursor_interpolated();
|
||||
|
||||
void scale_fov(real_t p_fov_offset);
|
||||
void reset_fov();
|
||||
void scale_cursor_distance(real_t scale);
|
||||
void _freelook_changed();
|
||||
void _freelook_speed_scaled();
|
||||
|
||||
struct ShortcutCheckSet {
|
||||
bool mod_pressed = false;
|
||||
bool shortcut_not_empty = true;
|
||||
int input_count = 0;
|
||||
ViewportNavMouseButton mouse_preference = NAVIGATION_LEFT_MOUSE;
|
||||
NavigationMode result_nav_mode = NAVIGATION_NONE;
|
||||
|
||||
ShortcutCheckSet() {}
|
||||
|
||||
ShortcutCheckSet(bool p_mod_pressed, bool p_shortcut_not_empty, int p_input_count, const ViewportNavMouseButton &p_mouse_preference, const NavigationMode &p_result_nav_mode) :
|
||||
mod_pressed(p_mod_pressed), shortcut_not_empty(p_shortcut_not_empty), input_count(p_input_count), mouse_preference(p_mouse_preference), result_nav_mode(p_result_nav_mode) {
|
||||
}
|
||||
};
|
||||
|
||||
struct ShortcutCheckSetComparator {
|
||||
_FORCE_INLINE_ bool operator()(const ShortcutCheckSet &A, const ShortcutCheckSet &B) const {
|
||||
return A.input_count > B.input_count;
|
||||
}
|
||||
};
|
||||
|
||||
NavigationMode _get_nav_mode_from_shortcut_check(ViewportNavMouseButton p_mouse_button, Vector<ShortcutCheckSet> p_shortcut_check_sets, bool p_use_not_empty);
|
||||
|
||||
void set_freelook_active(bool active_now);
|
||||
void scale_freelook_speed(real_t scale);
|
||||
View3DController::Cursor previous_cursor; // Storing previous cursor state for canceling purposes.
|
||||
|
||||
real_t zoom_indicator_delay;
|
||||
int zoom_failed_attempts_count = 0;
|
||||
|
|
@ -480,9 +379,7 @@ private:
|
|||
void set_message(const String &p_message, float p_time = 5);
|
||||
|
||||
void _view_settings_confirmed(real_t p_interp_delta);
|
||||
void _update_camera(real_t p_interp_delta);
|
||||
void _update_navigation_controls_visibility();
|
||||
Transform3D to_camera_transform(const Cursor &p_cursor) const;
|
||||
void _draw();
|
||||
|
||||
// These allow tool scripts to set the 3D cursor location by updating the camera transform.
|
||||
|
|
@ -497,7 +394,6 @@ private:
|
|||
|
||||
void input(const Ref<InputEvent> &p_event) override;
|
||||
void _sinput(const Ref<InputEvent> &p_event);
|
||||
void _update_freelook(real_t delta);
|
||||
Node3DEditor *spatial_editor = nullptr;
|
||||
|
||||
Camera3D *previewing = nullptr;
|
||||
|
|
@ -518,7 +414,6 @@ private:
|
|||
void _selection_result_pressed(int);
|
||||
void _selection_menu_hide();
|
||||
void _list_select(Ref<InputEventMouseButton> b);
|
||||
Point2 _get_warped_mouse_motion(const Ref<InputEventMouseMotion> &p_ev_mouse_motion) const;
|
||||
|
||||
Vector3 _get_instance_position(const Point2 &p_pos, Node3D *p_node) const;
|
||||
static AABB _calculate_spatial_bounds(const Node3D *p_parent, bool p_omit_top_level = false, const Transform3D *p_bounds_orientation = nullptr);
|
||||
|
|
@ -578,7 +473,6 @@ public:
|
|||
void set_state(const Dictionary &p_state);
|
||||
Dictionary get_state() const;
|
||||
void reset();
|
||||
bool is_freelook_active() const { return freelook_active; }
|
||||
|
||||
Vector3 get_ray_pos(const Vector2 &p_pos) const;
|
||||
Vector3 get_ray(const Vector2 &p_pos) const;
|
||||
|
|
@ -743,9 +637,9 @@ private:
|
|||
|
||||
DynamicBVH gizmo_bvh;
|
||||
|
||||
real_t snap_translate_value;
|
||||
real_t snap_rotate_value;
|
||||
real_t snap_scale_value;
|
||||
real_t snap_translate_value = 0;
|
||||
real_t snap_rotate_value = 0;
|
||||
real_t snap_scale_value = 0;
|
||||
|
||||
Ref<ArrayMesh> active_selection_box_xray;
|
||||
Ref<ArrayMesh> active_selection_box;
|
||||
|
|
@ -1133,7 +1027,7 @@ class ViewportNavigationControl : public Control {
|
|||
Vector2 focused_pos;
|
||||
bool hovered = false;
|
||||
int focused_index = -1;
|
||||
Node3DEditorViewport::NavigationMode nav_mode = Node3DEditorViewport::NavigationMode::NAVIGATION_NONE;
|
||||
View3DController::NavigationMode nav_mode = View3DController::NavigationMode::NAV_MODE_NONE;
|
||||
|
||||
const float AXIS_CIRCLE_RADIUS = 30.0f * EDSCALE;
|
||||
|
||||
|
|
@ -1146,6 +1040,6 @@ protected:
|
|||
void _update_navigation();
|
||||
|
||||
public:
|
||||
void set_navigation_mode(Node3DEditorViewport::NavigationMode p_nav_mode);
|
||||
void set_navigation_mode(View3DController::NavigationMode p_nav_mode);
|
||||
void set_viewport(Node3DEditorViewport *p_viewport);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#include "editor/settings/input_event_configuration_dialog.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "editor/themes/editor_theme_manager.h"
|
||||
#include "scene/debugger/view_3d_controller.h"
|
||||
#include "scene/gui/check_button.h"
|
||||
#include "scene/gui/panel_container.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
|
|
@ -86,7 +87,7 @@ void EditorSettingsDialog::_settings_property_edited() {
|
|||
} 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" || full_name == "editors/3d/navigation/emulate_3_button_mouse") {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)Node3DEditorViewport::NAVIGATION_CUSTOM);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)View3DController::NAV_SCHEME_CUSTOM);
|
||||
} else if (full_name == "editors/3d/navigation/navigation_scheme") {
|
||||
update_navigation_preset();
|
||||
_update_shortcuts();
|
||||
|
|
@ -94,10 +95,10 @@ void EditorSettingsDialog::_settings_property_edited() {
|
|||
}
|
||||
|
||||
void EditorSettingsDialog::update_navigation_preset() {
|
||||
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
|
||||
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;
|
||||
View3DController::NavigationScheme nav_scheme = (View3DController::NavigationScheme)EDITOR_GET("editors/3d/navigation/navigation_scheme").operator int();
|
||||
View3DController::NavigationMouseButton set_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
View3DController::NavigationMouseButton set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
View3DController::NavigationMouseButton set_zoom_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
bool set_3_button_mouse = false;
|
||||
Ref<InputEventKey> orbit_mod_key_1;
|
||||
Ref<InputEventKey> orbit_mod_key_2;
|
||||
|
|
@ -109,11 +110,11 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
Ref<InputEventKey> orbit_snap_mod_key_2;
|
||||
bool set_preset = false;
|
||||
|
||||
if (nav_scheme == Node3DEditorViewport::NAVIGATION_GODOT) {
|
||||
if (nav_scheme == View3DController::NAV_SCHEME_GODOT) {
|
||||
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_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_zoom_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
|
|
@ -123,11 +124,11 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_snap_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_snap_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA) {
|
||||
} else if (nav_scheme == View3DController::NAV_SCHEME_MAYA) {
|
||||
set_preset = true;
|
||||
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_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_zoom_mouse_button = View3DController::NAV_MOUSE_BUTTON_RIGHT;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
|
|
@ -137,11 +138,11 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
zoom_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_snap_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_snap_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) {
|
||||
} else if (nav_scheme == View3DController::NAV_SCHEME_MODO) {
|
||||
set_preset = true;
|
||||
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_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
set_zoom_mouse_button = View3DController::NAV_MOUSE_BUTTON_LEFT;
|
||||
set_3_button_mouse = false;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
|
|
@ -151,11 +152,11 @@ void EditorSettingsDialog::update_navigation_preset() {
|
|||
zoom_mod_key_2 = InputEventKey::create_reference(Key::CTRL);
|
||||
orbit_snap_mod_key_1 = InputEventKey::create_reference(Key::NONE);
|
||||
orbit_snap_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
} else if (nav_scheme == Node3DEditorViewport::NAVIGATION_TABLET) {
|
||||
} else if (nav_scheme == View3DController::NAV_SCHEME_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_orbit_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_pan_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_zoom_mouse_button = View3DController::NAV_MOUSE_BUTTON_MIDDLE;
|
||||
set_3_button_mouse = true;
|
||||
orbit_mod_key_1 = InputEventKey::create_reference(Key::ALT);
|
||||
orbit_mod_key_2 = InputEventKey::create_reference(Key::NONE);
|
||||
|
|
@ -428,7 +429,7 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A
|
|||
bool path_is_pan_mod = p_path == "spatial_editor/viewport_pan_modifier_1" || p_path == "spatial_editor/viewport_pan_modifier_2";
|
||||
bool path_is_zoom_mod = p_path == "spatial_editor/viewport_zoom_modifier_1" || p_path == "spatial_editor/viewport_zoom_modifier_2";
|
||||
if (path_is_orbit_mod || path_is_pan_mod || path_is_zoom_mod) {
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)Node3DEditorViewport::NAVIGATION_CUSTOM);
|
||||
EditorSettings::get_singleton()->set_manually("editors/3d/navigation/navigation_scheme", (int)View3DController::NAV_SCHEME_CUSTOM);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue