From b97a12da9872ef209d6be0a7209a2ec840663461 Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Sat, 14 Mar 2020 07:14:45 +0100
Subject: [PATCH] Documented the previous merge.

---
 src/slic3r/GUI/GLCanvas3D.cpp | 8 ++++++++
 src/slic3r/GUI/Plater.cpp     | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index ee5d7fcd8..ec89d1b42 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -3472,6 +3472,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
                     m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
                 else
                 {
+                	// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
+                	// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
+                	// which checks an atomics (flushes CPU caches).
+                	// See GH issue #3816.
                     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);
                 }
@@ -3498,6 +3502,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
                 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")
+                	// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
+                	// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
+                	// which checks an atomics (flushes CPU caches).
+                	// See GH issue #3816.
                     m_camera.recover_from_free_camera();
 #endif // ENABLE_AUTO_CONSTRAINED_CAMERA
 
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index fb61c4f24..04f1a6b87 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -2311,13 +2311,6 @@ void Plater::priv::reset_all_gizmos()
 // Update the UI based on the current preferences.
 void Plater::priv::update_ui_from_settings()
 {
-    // TODO: (?)
-    // my ($self) = @_;
-    // if (defined($self->{btn_reslice}) && $self->{buttons_sizer}->IsShown($self->{btn_reslice}) != (! wxTheApp->{app_config}->get("background_processing"))) {
-    //     $self->{buttons_sizer}->Show($self->{btn_reslice}, ! wxTheApp->{app_config}->get("background_processing"));
-    //     $self->{buttons_sizer}->Layout;
-    // }
-
     camera.set_type(wxGetApp().app_config->get("use_perspective_camera"));
     if (wxGetApp().app_config->get("use_free_camera") != "1")
         camera.recover_from_free_camera();