Gizmos shortcuts set as default

This commit is contained in:
Enrico Turri 2018-12-04 16:01:25 +01:00
parent 04d7154d40
commit 9bfcf10cc6
5 changed files with 0 additions and 28 deletions

View file

@ -25,8 +25,6 @@
#define ENABLE_ENSURE_ON_BED_WHILE_SCALING (1 && ENABLE_MODELVOLUME_TRANSFORM) #define ENABLE_ENSURE_ON_BED_WHILE_SCALING (1 && ENABLE_MODELVOLUME_TRANSFORM)
// All rotations made using the rotate gizmo are done with respect to the world reference system // All rotations made using the rotate gizmo are done with respect to the world reference system
#define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0) #define ENABLE_WORLD_ROTATIONS (1 && ENABLE_1_42_0)
// Enables shortcut keys for gizmos
#define ENABLE_GIZMOS_SHORTCUT (1 && ENABLE_1_42_0)
// Scene's GUI made using imgui library // Scene's GUI made using imgui library
#define ENABLE_IMGUI (1 && ENABLE_1_42_0) #define ENABLE_IMGUI (1 && ENABLE_1_42_0)
// Modified Sla support gizmo // Modified Sla support gizmo

View file

@ -2738,7 +2738,6 @@ bool GLCanvas3D::Gizmos::is_running() const
return (curr != nullptr) ? (curr->get_state() == GLGizmoBase::On) : false; return (curr != nullptr) ? (curr->get_state() == GLGizmoBase::On) : false;
} }
#if ENABLE_GIZMOS_SHORTCUT
bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection) bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
{ {
if (!m_enabled) if (!m_enabled)
@ -2773,7 +2772,6 @@ bool GLCanvas3D::Gizmos::handle_shortcut(int key, const Selection& selection)
return handled; return handled;
} }
#endif // ENABLE_GIZMOS_SHORTCUT
bool GLCanvas3D::Gizmos::is_dragging() const bool GLCanvas3D::Gizmos::is_dragging() const
{ {
@ -4487,14 +4485,12 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
#endif // ENABLE_MODIFIED_CAMERA_TARGET #endif // ENABLE_MODIFIED_CAMERA_TARGET
default: default:
{ {
#if ENABLE_GIZMOS_SHORTCUT
if (m_gizmos.handle_shortcut(keyCode, m_selection)) if (m_gizmos.handle_shortcut(keyCode, m_selection))
{ {
_update_gizmos_data(); _update_gizmos_data();
m_dirty = true; m_dirty = true;
} }
else else
#endif // ENABLE_GIZMOS_SHORTCUT
evt.Skip(); evt.Skip();
break; break;

View file

@ -630,9 +630,7 @@ private:
EType get_current_type() const; EType get_current_type() const;
bool is_running() const; bool is_running() const;
#if ENABLE_GIZMOS_SHORTCUT
bool handle_shortcut(int key, const Selection& selection); bool handle_shortcut(int key, const Selection& selection);
#endif // ENABLE_GIZMOS_SHORTCUT
bool is_dragging() const; bool is_dragging() const;
void start_dragging(const Selection& selection); void start_dragging(const Selection& selection);

View file

@ -26,9 +26,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include "PresetBundle.hpp" #include "PresetBundle.hpp"
#if ENABLE_GIZMOS_SHORTCUT
#include <wx/defs.h> #include <wx/defs.h>
#endif // ENABLE_GIZMOS_SHORTCUT
// TODO: Display tooltips quicker on Linux // TODO: Display tooltips quicker on Linux
@ -161,9 +159,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent)
: m_parent(parent) : m_parent(parent)
, m_group_id(-1) , m_group_id(-1)
, m_state(Off) , m_state(Off)
#if ENABLE_GIZMOS_SHORTCUT
, m_shortcut_key(0) , m_shortcut_key(0)
#endif // ENABLE_GIZMOS_SHORTCUT
, m_hover_id(-1) , m_hover_id(-1)
, m_dragging(false) , m_dragging(false)
#if ENABLE_IMGUI #if ENABLE_IMGUI
@ -734,9 +730,7 @@ bool GLGizmoRotate3D::on_init()
if (!m_textures[On].load_from_file(path + "rotate_on.png", false)) if (!m_textures[On].load_from_file(path + "rotate_on.png", false))
return false; return false;
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_R; m_shortcut_key = WXK_CONTROL_R;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }
@ -824,9 +818,7 @@ bool GLGizmoScale3D::on_init()
m_grabbers[2].angles(0) = half_pi; m_grabbers[2].angles(0) = half_pi;
m_grabbers[3].angles(0) = half_pi; m_grabbers[3].angles(0) = half_pi;
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_S; m_shortcut_key = WXK_CONTROL_S;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }
@ -1202,9 +1194,7 @@ bool GLGizmoMove3D::on_init()
m_grabbers.push_back(Grabber()); m_grabbers.push_back(Grabber());
} }
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_M; m_shortcut_key = WXK_CONTROL_M;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }
@ -1430,9 +1420,7 @@ bool GLGizmoFlatten::on_init()
if (!m_textures[On].load_from_file(path + "layflat_on.png", false)) if (!m_textures[On].load_from_file(path + "layflat_on.png", false))
return false; return false;
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_F; m_shortcut_key = WXK_CONTROL_F;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }
@ -1769,9 +1757,7 @@ bool GLGizmoSlaSupports::on_init()
if (!m_textures[On].load_from_file(path + "sla_support_points_on.png", false)) if (!m_textures[On].load_from_file(path + "sla_support_points_on.png", false))
return false; return false;
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_L; m_shortcut_key = WXK_CONTROL_L;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }
@ -2292,9 +2278,7 @@ bool GLGizmoCut::on_init()
m_grabbers.emplace_back(); m_grabbers.emplace_back();
#if ENABLE_GIZMOS_SHORTCUT
m_shortcut_key = WXK_CONTROL_C; m_shortcut_key = WXK_CONTROL_C;
#endif // ENABLE_GIZMOS_SHORTCUT
return true; return true;
} }

View file

@ -84,9 +84,7 @@ protected:
int m_group_id; int m_group_id;
EState m_state; EState m_state;
#if ENABLE_GIZMOS_SHORTCUT
int m_shortcut_key; int m_shortcut_key;
#endif // ENABLE_GIZMOS_SHORTCUT
// textures are assumed to be square and all with the same size in pixels, no internal check is done // textures are assumed to be square and all with the same size in pixels, no internal check is done
GLTexture m_textures[Num_States]; GLTexture m_textures[Num_States];
int m_hover_id; int m_hover_id;
@ -113,10 +111,8 @@ public:
EState get_state() const { return m_state; } EState get_state() const { return m_state; }
void set_state(EState state) { m_state = state; on_set_state(); } void set_state(EState state) { m_state = state; on_set_state(); }
#if ENABLE_GIZMOS_SHORTCUT
int get_shortcut_key() const { return m_shortcut_key; } int get_shortcut_key() const { return m_shortcut_key; }
void set_shortcut_key(int key) { m_shortcut_key = key; } void set_shortcut_key(int key) { m_shortcut_key = key; }
#endif // ENABLE_GIZMOS_SHORTCUT
bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); } bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); }
bool is_selectable() const { return on_is_selectable(); } bool is_selectable() const { return on_is_selectable(); }