Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2020-03-10 15:02:39 +0300
committerEnrico Turri <enricoturri@seznam.cz>2020-03-10 15:02:39 +0300
commita6a9ab9dc7efda2dce6745778f6198d34ed800e8 (patch)
treefde57ad0ed1831399b22d83b0d9eefe3e8e0c4f7 /src/slic3r/GUI
parent33470f7f6d67306de247717a926bc4eef9cece78 (diff)
Follow-up of 6c36577e8e48e27a372f9a53cd2ba2a07e3a49a3 -> World Z axis set to vertical when disconnecting 3d mouse
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r--src/slic3r/GUI/Camera.hpp7
-rw-r--r--src/slic3r/GUI/Mouse3DController.cpp8
-rw-r--r--src/slic3r/GUI/Plater.cpp11
-rw-r--r--src/slic3r/GUI/Plater.hpp1
4 files changed, 21 insertions, 6 deletions
diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp
index 4b9144519..b784e7b96 100644
--- a/src/slic3r/GUI/Camera.hpp
+++ b/src/slic3r/GUI/Camera.hpp
@@ -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; }
diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp
index 0cd39b092..5ff817c59 100644
--- a/src/slic3r/GUI/Mouse3DController.cpp
+++ b/src/slic3r/GUI/Mouse3DController.cpp
@@ -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()
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index d7d6f419d..0beddc358 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -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;
diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp
index dbf706988..89603f703 100644
--- a/src/slic3r/GUI/Plater.hpp
+++ b/src/slic3r/GUI/Plater.hpp
@@ -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();