Removed gizmo reset by double-cliking on grabbers

This commit is contained in:
Enrico Turri 2018-11-30 11:42:36 +01:00
parent 054d202817
commit b83468e763
5 changed files with 1 additions and 99 deletions

View File

@ -13,8 +13,6 @@
//=============
#define ENABLE_1_42_0 1
// Add double click on gizmo grabbers to reset transformation components to their default value
#define ENABLE_GIZMOS_RESET (1 && ENABLE_1_42_0)
// Uses a unique opengl context
#define ENABLE_USE_UNIQUE_GLCONTEXT (1 && ENABLE_1_42_0)
// Disable synchronization of unselected instances

View File

@ -1047,9 +1047,6 @@ GLCanvas3D::Mouse::Mouse()
#if ENABLE_GIZMOS_ON_TOP
, scene_position(DBL_MAX, DBL_MAX, DBL_MAX)
#endif // ENABLE_GIZMOS_ON_TOP
#if ENABLE_GIZMOS_RESET
, ignore_up_event(false)
#endif // ENABLE_GIZMOS_RESET
{
}
@ -2691,18 +2688,6 @@ void GLCanvas3D::Gizmos::update(const Linef3& mouse_ray, bool shift_down, const
curr->update(GLGizmoBase::UpdateData(mouse_ray, mouse_pos, shift_down));
}
#if ENABLE_GIZMOS_RESET
void GLCanvas3D::Gizmos::process_double_click()
{
if (!m_enabled)
return;
GLGizmoBase* curr = _get_current();
if (curr != nullptr)
curr->process_double_click();
}
#endif // ENABLE_GIZMOS_RESET
GLCanvas3D::Gizmos::EType GLCanvas3D::Gizmos::get_current_type() const
{
return m_current;
@ -4546,38 +4531,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_toolbar_action_running = true;
m_toolbar.do_action((unsigned int)toolbar_contains_mouse);
}
#if ENABLE_GIZMOS_RESET
else if (evt.LeftDClick() && m_gizmos.grabber_contains_mouse())
{
m_mouse.ignore_up_event = true;
m_gizmos.process_double_click();
switch (m_gizmos.get_current_type())
{
case Gizmos::Scale:
{
m_selection.scale(m_gizmos.get_scale(), false);
do_scale();
wxGetApp().obj_manipul()->update_settings_value(m_selection);
m_dirty = true;
break;
}
#if !ENABLE_WORLD_ROTATIONS
case Gizmos::Rotate:
{
m_selection.rotate(m_gizmos.get_rotation(), false);
do_rotate();
wxGetApp().obj_manipul()->update_settings_value(m_selection);
m_dirty = true;
break;
}
#endif // !ENABLE_WORLD_ROTATIONS
default:
{
break;
}
}
}
#endif // ENABLE_GIZMOS_RESET
else if (evt.LeftDown() || evt.RightDown())
{
// If user pressed left or right button we first check whether this happened
@ -4610,9 +4563,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
if (evt.LeftDown())
{
m_gizmos.delete_current_grabber(true);
#if ENABLE_GIZMOS_RESET
m_mouse.ignore_up_event = true;
#endif // ENABLE_GIZMOS_RESET
m_dirty = true;
}
}
@ -4871,11 +4821,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging() && !is_layers_editing_enabled())
{
// deselect and propagate event through callback
#if ENABLE_GIZMOS_RESET
if (!m_mouse.ignore_up_event && m_picking_enabled && !m_toolbar_action_running)
#else
if (m_picking_enabled && !m_toolbar_action_running)
#endif // ENABLE_GIZMOS_RESET
{
m_selection.clear();
m_selection.set_mode(Selection::Instance);
@ -4883,10 +4829,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
_update_gizmos_data();
}
#if ENABLE_GIZMOS_RESET
else if (m_mouse.ignore_up_event)
m_mouse.ignore_up_event = false;
#endif // ENABLE_GIZMOS_RESET
}
else if (evt.LeftUp() && m_gizmos.is_dragging())
{

View File

@ -328,9 +328,6 @@ class GLCanvas3D
Vec3d scene_position;
#endif // ENABLE_GIZMOS_ON_TOP
Drag drag;
#if ENABLE_GIZMOS_RESET
bool ignore_up_event;
#endif // ENABLE_GIZMOS_RESET
Mouse();
@ -631,9 +628,6 @@ private:
bool overlay_contains_mouse(const GLCanvas3D& canvas, const Vec2d& mouse_pos) const;
bool grabber_contains_mouse() const;
void update(const Linef3& mouse_ray, bool shift_down, const Point* mouse_pos = nullptr);
#if ENABLE_GIZMOS_RESET
void process_double_click();
#endif // ENABLE_GIZMOS_RESET
Rect get_reset_rect_viewport(const GLCanvas3D& canvas) const;
EType get_current_type() const;

View File

@ -829,14 +829,6 @@ void GLGizmoScale3D::on_update(const UpdateData& data)
do_scale_uniform(data);
}
#if ENABLE_GIZMOS_RESET
void GLGizmoScale3D::on_process_double_click()
{
if (m_hover_id >= 6)
m_scale = Vec3d::Ones();
}
#endif // ENABLE_GIZMOS_RESET
void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const
{
bool single_instance = selection.is_single_full_instance();
@ -1352,7 +1344,7 @@ bool GLGizmoFlatten::on_init()
std::string GLGizmoFlatten::on_get_name() const
{
return L("Flatten");
return L("Place on face");
}
bool GLGizmoFlatten::on_is_activable(const GLCanvas3D::Selection& selection) const

View File

@ -136,10 +136,6 @@ public:
void update(const UpdateData& data);
#if ENABLE_GIZMOS_RESET
void process_double_click() { on_process_double_click(); }
#endif // ENABLE_GIZMOS_RESET
void render(const GLCanvas3D::Selection& selection) const { on_render(selection); }
void render_for_picking(const GLCanvas3D::Selection& selection) const { on_render_for_picking(selection); }
@ -163,9 +159,6 @@ protected:
virtual void on_start_dragging(const GLCanvas3D::Selection& selection) {}
virtual void on_stop_dragging() {}
virtual void on_update(const UpdateData& data) = 0;
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click() {}
#endif // ENABLE_GIZMOS_RESET
virtual void on_render(const GLCanvas3D::Selection& selection) const = 0;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const = 0;
@ -225,11 +218,6 @@ protected:
virtual std::string on_get_name() const { return ""; }
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
virtual void on_update(const UpdateData& data);
#if ENABLE_GIZMOS_RESET
#if !ENABLE_WORLD_ROTATIONS
virtual void on_process_double_click() { m_angle = 0.0; }
#endif // !ENABLE_WORLD_ROTATIONS
#endif // ENABLE_GIZMOS_RESET
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
@ -294,15 +282,6 @@ protected:
g.update(data);
}
}
#if ENABLE_GIZMOS_RESET
#if !ENABLE_WORLD_ROTATIONS
virtual void on_process_double_click()
{
if (m_hover_id != -1)
m_gizmos[m_hover_id].process_double_click();
}
#endif // !ENABLE_WORLD_ROTATIONS
#endif // ENABLE_GIZMOS_RESET
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const
{
@ -346,9 +325,6 @@ protected:
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return !selection.is_wipe_tower(); }
virtual void on_start_dragging(const GLCanvas3D::Selection& selection);
virtual void on_update(const UpdateData& data);
#if ENABLE_GIZMOS_RESET
virtual void on_process_double_click();
#endif // ENABLE_GIZMOS_RESET
virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;