Merge remote-tracking branch 'remotes/origin/et_free_camera'

This commit is contained in:
bubnikv 2020-03-14 07:02:08 +01:00
commit 37b3780a72
2 changed files with 28 additions and 2 deletions

View file

@ -42,12 +42,22 @@
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG (0 && ENABLE_THUMBNAIL_GENERATOR)
//==================
//================
// 2.2.0.rc1 techs
//==================
//================
#define ENABLE_2_2_0_RC1 1
// Enable hack to remove crash when closing on OSX 10.9.5
#define ENABLE_HACK_CLOSING_ON_OSX_10_9_5 (1 && ENABLE_2_2_0_RC1)
//============
// 2.2.0 techs
//============
#define ENABLE_2_2_0 1
// Enable automatic switch to constrained camera when manipulating the scene using regular mouse
// while 3D mouse is connected and free camera is not selected
#define ENABLE_AUTO_CONSTRAINED_CAMERA (1 && ENABLE_2_2_0)
#endif // _technologies_h_

View file

@ -3466,11 +3466,22 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined())
{
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.);
#if ENABLE_AUTO_CONSTRAINED_CAMERA
if (wxGetApp().app_config->get("use_free_camera") == "1")
// Virtual track ball (similar to the 3DConnexion mouse).
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
else
{
m_camera.recover_from_free_camera();
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
}
#else
if (wxGetApp().plater()->get_mouse3d_controller().connected() || (wxGetApp().app_config->get("use_free_camera") == "1"))
// Virtual track ball (similar to the 3DConnexion mouse).
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
else
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
m_dirty = true;
}
@ -3485,6 +3496,11 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
float z = 0.0f;
const Vec3d& cur_pos = _mouse_to_3d(pos, &z);
Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
#if ENABLE_AUTO_CONSTRAINED_CAMERA
if (wxGetApp().app_config->get("use_free_camera") != "1")
m_camera.recover_from_free_camera();
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
m_camera.set_target(m_camera.get_target() + orig - cur_pos);
m_dirty = true;
}