Follow-up of 6c36577e8e
-> World Z axis set to vertical when disconnecting 3d mouse
This commit is contained in:
parent
33470f7f6d
commit
a6a9ab9dc7
4 changed files with 21 additions and 6 deletions
|
@ -122,6 +122,13 @@ public:
|
|||
// returns true if the camera z axis (forward) is pointing in the negative direction of the world z axis
|
||||
bool is_looking_downward() const { return get_dir_forward().dot(Vec3d::UnitZ()) < 0.0; }
|
||||
|
||||
// forces camera right vector to be parallel to XY plane
|
||||
void recover_from_free_camera()
|
||||
{
|
||||
if (std::abs(get_dir_right()(2)) > EPSILON)
|
||||
look_at(get_position(), m_target, Vec3d::UnitZ());
|
||||
}
|
||||
|
||||
void look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up);
|
||||
|
||||
double max_zoom() const { return 100.0; }
|
||||
|
|
|
@ -388,6 +388,9 @@ void Mouse3DController::disconnected()
|
|||
m_params_by_device[m_device_str] = m_params_ui;
|
||||
m_device_str.clear();
|
||||
m_connected = false;
|
||||
wxGetApp().plater()->get_camera().recover_from_free_camera();
|
||||
wxGetApp().plater()->set_current_canvas_as_dirty();
|
||||
wxWakeUpIdle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -773,7 +776,10 @@ void Mouse3DController::disconnect_device()
|
|||
}
|
||||
m_device_str.clear();
|
||||
m_connected = false;
|
||||
}
|
||||
wxGetApp().plater()->get_camera().recover_from_free_camera();
|
||||
wxGetApp().plater()->set_current_canvas_as_dirty();
|
||||
wxWakeUpIdle();
|
||||
}
|
||||
}
|
||||
|
||||
void Mouse3DController::collect_input()
|
||||
|
|
|
@ -2277,11 +2277,7 @@ void Plater::priv::update_ui_from_settings()
|
|||
|
||||
camera.set_type(wxGetApp().app_config->get("use_perspective_camera"));
|
||||
if (wxGetApp().app_config->get("use_free_camera") != "1")
|
||||
{
|
||||
// forces camera right vector to be parallel to XY plane
|
||||
if (std::abs(camera.get_dir_right()(2)) > EPSILON)
|
||||
camera.look_at(camera.get_position(), camera.get_target(), Vec3d::UnitZ());
|
||||
}
|
||||
camera.recover_from_free_camera();
|
||||
|
||||
view3D->get_canvas3d()->update_ui_from_settings();
|
||||
preview->get_canvas3d()->update_ui_from_settings();
|
||||
|
@ -5661,6 +5657,11 @@ const Camera& Plater::get_camera() const
|
|||
return p->camera;
|
||||
}
|
||||
|
||||
Camera& Plater::get_camera()
|
||||
{
|
||||
return p->camera;
|
||||
}
|
||||
|
||||
const Mouse3DController& Plater::get_mouse3d_controller() const
|
||||
{
|
||||
return p->mouse3d_controller;
|
||||
|
|
|
@ -280,6 +280,7 @@ public:
|
|||
bool init_view_toolbar();
|
||||
|
||||
const Camera& get_camera() const;
|
||||
Camera& get_camera();
|
||||
const Mouse3DController& get_mouse3d_controller() const;
|
||||
Mouse3DController& get_mouse3d_controller();
|
||||
|
||||
|
|
Loading…
Reference in a new issue