ENABLE_3DCONNEXION_DEVICES tech set as default

This commit is contained in:
Enrico Turri 2019-10-11 15:51:36 +02:00
parent 1c05d88c00
commit e6403a74ef
14 changed files with 1 additions and 129 deletions

View file

@ -22,9 +22,7 @@
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp"
#if ENABLE_3DCONNEXION_DEVICES
#include "Mouse3DController.hpp"
#endif // ENABLE_3DCONNEXION_DEVICES
#include "I18N.hpp"
#if ENABLE_RETINA_GL
@ -1394,11 +1392,7 @@ BoundingBoxf3 GLCanvas3D::volumes_bounding_box() const
BoundingBoxf3 GLCanvas3D::scene_bounding_box() const
{
BoundingBoxf3 bb = volumes_bounding_box();
#if ENABLE_3DCONNEXION_DEVICES
bb.merge(m_bed.get_bounding_box(true));
#else
bb.merge(m_bed.get_bounding_box(false));
#endif // ENABLE_3DCONNEXION_DEVICES
if (m_config != nullptr)
{
@ -1546,16 +1540,11 @@ void GLCanvas3D::render()
return;
}
#if ENABLE_3DCONNEXION_DEVICES
const Size& cnv_size = get_canvas_size();
#endif // ENABLE_3DCONNEXION_DEVICES
if (m_camera.requires_zoom_to_bed)
{
zoom_to_bed();
#if !ENABLE_3DCONNEXION_DEVICES
const Size& cnv_size = get_canvas_size();
#endif // !ENABLE_3DCONNEXION_DEVICES
_resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
m_camera.requires_zoom_to_bed = false;
}
@ -1646,9 +1635,7 @@ void GLCanvas3D::render()
m_camera.debug_render();
#endif // ENABLE_CAMERA_STATISTICS
#if ENABLE_3DCONNEXION_DEVICES
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
#endif // ENABLE_3DCONNEXION_DEVICES
wxGetApp().imgui()->render();
@ -2350,17 +2337,14 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
m_dirty |= m_main_toolbar.update_items_state();
m_dirty |= m_undoredo_toolbar.update_items_state();
m_dirty |= m_view_toolbar.update_items_state();
#if ENABLE_3DCONNEXION_DEVICES
bool mouse3d_controller_applied = wxGetApp().plater()->get_mouse3d_controller().apply(m_camera);
m_dirty |= mouse3d_controller_applied;
#endif // ENABLE_3DCONNEXION_DEVICES
if (!m_dirty)
return;
_refresh_if_shown_on_screen();
#if ENABLE_3DCONNEXION_DEVICES
if (m_keep_dirty || mouse3d_controller_applied)
{
m_dirty = true;
@ -2368,10 +2352,6 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
}
else
m_dirty = false;
#else
if (m_keep_dirty)
m_dirty = true;
#endif // ENABLE_3DCONNEXION_DEVICES
}
void GLCanvas3D::on_char(wxKeyEvent& evt)
@ -2417,7 +2397,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
post_event(SimpleEvent(EVT_GLTOOLBAR_COPY));
break;
#if ENABLE_3DCONNEXION_DEVICES
#ifdef __APPLE__
case 'm':
case 'M':
@ -2430,7 +2409,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
m_dirty = true;
break;
}
#endif // ENABLE_3DCONNEXION_DEVICES
#ifdef __APPLE__
case 'v':
@ -2499,19 +2477,11 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case 'B':
case 'b': { zoom_to_bed(); break; }
case 'I':
#if ENABLE_3DCONNEXION_DEVICES
case 'i': { _update_camera_zoom(1.0); break; }
#else
case 'i': { set_camera_zoom(1.0); break; }
#endif // ENABLE_3DCONNEXION_DEVICES
case 'K':
case 'k': { m_camera.select_next_type(); m_dirty = true; break; }
case 'O':
#if ENABLE_3DCONNEXION_DEVICES
case 'o': { _update_camera_zoom(-1.0); break; }
#else
case 'o': { set_camera_zoom(-1.0); break; }
#endif // ENABLE_3DCONNEXION_DEVICES
#if ENABLE_RENDER_PICKING_PASS
case 'T':
case 't': {
@ -2614,12 +2584,10 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
{
#if ENABLE_3DCONNEXION_DEVICES
// try to filter out events coming from mouse 3d
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
if (controller.process_mouse_wheel())
return;
#endif // ENABLE_3DCONNEXION_DEVICES
if (!m_initialized)
return;
@ -2665,11 +2633,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
return;
// Calculate the zoom delta and apply it to the current zoom factor
#if ENABLE_3DCONNEXION_DEVICES
_update_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta());
#else
set_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta());
#endif // ENABLE_3DCONNEXION_DEVICES
}
void GLCanvas3D::on_timer(wxTimerEvent& evt)
@ -3451,15 +3415,6 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
m_dirty = true;
}
#if !ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::set_camera_zoom(double zoom)
{
const Size& cnv_size = get_canvas_size();
m_camera.set_zoom(zoom, _max_bounding_box(false, true), cnv_size.get_width(), cnv_size.get_height());
m_dirty = true;
}
#endif // !ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::update_gizmos_on_off_state()
{
set_as_dirty();
@ -3910,10 +3865,6 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
// updates camera
m_camera.apply_viewport(0, 0, w, h);
#if !ENABLE_3DCONNEXION_DEVICES
m_dirty = false;
#endif // !ENABLE_3DCONNEXION_DEVICES
}
BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_bed_model) const
@ -3941,13 +3892,11 @@ void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box)
m_dirty = true;
}
#if ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::_update_camera_zoom(double zoom)
{
m_camera.update_zoom(zoom);
m_dirty = true;
}
#endif // ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::_refresh_if_shown_on_screen()
{