1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Improved freelook

- Fix movement input affecting all viewports even when clicking outside
- Freelook up movement is now relative
- Prevent tool shortcut conflict when moving
- De-hardcode tool shortcuts (select, move, rotate, scale, wireframe)
- Movement speed depends on zoom distance (like panning)
- Mouse wheel controls speed (Blender-style) due to above point
- Added zoom distance indicator, hides after short delay
This commit is contained in:
Marc Gilleron
2017-05-07 22:59:05 +02:00
parent 66725d9b21
commit aaf9cacf5f
3 changed files with 175 additions and 69 deletions

View File

@@ -113,7 +113,8 @@ private:
bool transforming;
bool orthogonal;
float gizmo_scale;
real_t freelook_speed;
bool freelook_active;
struct _RayResult {
@@ -217,6 +218,10 @@ private:
}
} cursor;
void scale_cursor_distance(real_t scale);
real_t zoom_indicator_delay;
RID move_gizmo_instance[3], rotate_gizmo_instance[3];
String last_message;
@@ -258,6 +263,7 @@ public:
void set_state(const Dictionary &p_state);
Dictionary get_state() const;
void reset();
bool is_freelook_active() const { return freelook_active; }
void focus_selection();
@@ -298,11 +304,13 @@ public:
};
private:
static const unsigned int VIEWPORTS_COUNT = 4;
EditorNode *editor;
EditorSelection *editor_selection;
Control *viewport_base;
SpatialEditorViewport *viewports[4];
SpatialEditorViewport *viewports[VIEWPORTS_COUNT];
VSplitContainer *shader_split;
HSplitContainer *palette_split;
@@ -458,6 +466,8 @@ private:
void _update_default_light_angle();
void _default_light_angle_input(const InputEvent &p_event);
bool is_any_freelook_active() const;
protected:
void _notification(int p_what);
//void _gui_input(InputEvent p_event);