mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
#4987 - Fixed camera switches back to non-Perspective camera after slice
This commit is contained in:
parent
30fb77b8d4
commit
c8d875bee1
3 changed files with 18 additions and 22 deletions
|
@ -32,15 +32,6 @@ double Camera::MaxFovDeg = 60.0;
|
||||||
|
|
||||||
Camera::Camera()
|
Camera::Camera()
|
||||||
: requires_zoom_to_bed(false)
|
: requires_zoom_to_bed(false)
|
||||||
, m_type(Perspective)
|
|
||||||
, m_target(Vec3d::Zero())
|
|
||||||
, m_zenit(45.0f)
|
|
||||||
, m_zoom(1.0)
|
|
||||||
, m_distance(DefaultDistance)
|
|
||||||
, m_gui_scale(1.0)
|
|
||||||
, m_view_matrix(Transform3d::Identity())
|
|
||||||
, m_view_rotation(1., 0., 0., 0.)
|
|
||||||
, m_projection_matrix(Transform3d::Identity())
|
|
||||||
{
|
{
|
||||||
set_default_orientation();
|
set_default_orientation();
|
||||||
}
|
}
|
||||||
|
@ -58,13 +49,14 @@ std::string Camera::get_type_as_string() const
|
||||||
|
|
||||||
void Camera::set_type(EType type)
|
void Camera::set_type(EType type)
|
||||||
{
|
{
|
||||||
if (m_type != type)
|
if (m_type != type) {
|
||||||
{
|
|
||||||
m_type = type;
|
m_type = type;
|
||||||
|
if (m_update_config_on_type_change_enabled) {
|
||||||
wxGetApp().app_config->set("use_perspective_camera", (m_type == Perspective) ? "1" : "0");
|
wxGetApp().app_config->set("use_perspective_camera", (m_type == Perspective) ? "1" : "0");
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Camera::set_type(const std::string& type)
|
void Camera::set_type(const std::string& type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,19 +29,20 @@ struct Camera
|
||||||
bool requires_zoom_to_bed;
|
bool requires_zoom_to_bed;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EType m_type;
|
EType m_type{ Perspective };
|
||||||
Vec3d m_target;
|
bool m_update_config_on_type_change_enabled{ false };
|
||||||
float m_zenit;
|
Vec3d m_target{ Vec3d::Zero() };
|
||||||
double m_zoom;
|
float m_zenit{ 45.0f };
|
||||||
|
double m_zoom{ 1.0 };
|
||||||
// Distance between camera position and camera target measured along the camera Z axis
|
// Distance between camera position and camera target measured along the camera Z axis
|
||||||
mutable double m_distance;
|
mutable double m_distance{ DefaultDistance };
|
||||||
mutable double m_gui_scale;
|
mutable double m_gui_scale{ 1.0 };
|
||||||
|
|
||||||
mutable std::array<int, 4> m_viewport;
|
mutable std::array<int, 4> m_viewport;
|
||||||
mutable Transform3d m_view_matrix;
|
mutable Transform3d m_view_matrix{ Transform3d::Identity() };
|
||||||
// We are calculating the rotation part of the m_view_matrix from m_view_rotation.
|
// We are calculating the rotation part of the m_view_matrix from m_view_rotation.
|
||||||
mutable Eigen::Quaterniond m_view_rotation;
|
mutable Eigen::Quaterniond m_view_rotation{ 1.0, 0.0, 0.0, 0.0 };
|
||||||
mutable Transform3d m_projection_matrix;
|
mutable Transform3d m_projection_matrix{ Transform3d::Identity() };
|
||||||
mutable std::pair<double, double> m_frustrum_zs;
|
mutable std::pair<double, double> m_frustrum_zs;
|
||||||
|
|
||||||
BoundingBoxf3 m_scene_box;
|
BoundingBoxf3 m_scene_box;
|
||||||
|
@ -56,6 +57,8 @@ public:
|
||||||
void set_type(const std::string& type);
|
void set_type(const std::string& type);
|
||||||
void select_next_type();
|
void select_next_type();
|
||||||
|
|
||||||
|
void enable_update_config_on_type_change(bool enable) { m_update_config_on_type_change_enabled = enable; }
|
||||||
|
|
||||||
const Vec3d& get_target() const { return m_target; }
|
const Vec3d& get_target() const { return m_target; }
|
||||||
void set_target(const Vec3d& target);
|
void set_target(const Vec3d& target);
|
||||||
|
|
||||||
|
|
|
@ -2003,6 +2003,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// updates camera type from .ini file
|
// updates camera type from .ini file
|
||||||
|
camera.enable_update_config_on_type_change(true);
|
||||||
camera.set_type(get_config("use_perspective_camera"));
|
camera.set_type(get_config("use_perspective_camera"));
|
||||||
|
|
||||||
// Load the 3DConnexion device database.
|
// Load the 3DConnexion device database.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue