From cbe9216d79b9042fc70cbb5b8282a78e4c43cb00 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 4 Mar 2020 12:18:59 +0100 Subject: [PATCH] WIP 3Dconnexion refactoring: Fixing compilation on OSX --- src/slic3r/GUI/Mouse3DController.cpp | 24 ++++++++++-------------- src/slic3r/GUI/Mouse3DController.hpp | 4 ++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index a7c66e591..6781ba9ff 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -389,10 +389,10 @@ void Mouse3DController::disconnected() m_connected = false; } -bool Mouse3DController::handle_input(const DataPacketAxis& packet, const Params ¶ms, State &state_in_out) +bool Mouse3DController::handle_input(const DataPacketAxis& packet) { if (! wxGetApp().IsActive()) - return; + return false; { // Synchronize parameters between the UI thread and the background thread. @@ -405,34 +405,30 @@ bool Mouse3DController::handle_input(const DataPacketAxis& packet, const Params } bool updated = false; - //translation - double deadzone = params.translation.deadzone; + // translation + double deadzone = m_params.translation.deadzone; Vec3d translation(std::abs(packet[0]) > deadzone ? -packet[0] : 0.0, std::abs(packet[1]) > deadzone ? packet[1] : 0.0, std::abs(packet[2]) > deadzone ? packet[2] : 0.0); - if (!translation.isApprox(Vec3d::Zero())) - { - state_in_out.append_translation(translation, params.input_queue_max_size); + if (! translation.isApprox(Vec3d::Zero())) { + m_state.append_translation(translation, m_params.input_queue_max_size); updated = true; } - //rotation - deadzone = params.rotation.deadzone; + // rotation + deadzone = m_params.rotation.deadzone; Vec3f rotation(std::abs(packet[3]) > deadzone ? (float)packet[3] : 0.0, std::abs(packet[4]) > deadzone ? (float)packet[4] : 0.0, std::abs(packet[5]) > deadzone ? (float)packet[5] : 0.0); - if (!rotation.isApprox(Vec3f::Zero())) - { - state_in_out.append_rotation(rotation, params.input_queue_max_size); + if (! rotation.isApprox(Vec3f::Zero())) { + m_state.append_rotation(rotation, m_params.input_queue_max_size); updated = true; } -#if 1 if (updated) { wxGetApp().plater()->set_current_canvas_as_dirty(); // ask for an idle event to update 3D scene wxWakeUpIdle(); } -#endif return updated; } diff --git a/src/slic3r/GUI/Mouse3DController.hpp b/src/slic3r/GUI/Mouse3DController.hpp index 33dba2567..99c5511a5 100644 --- a/src/slic3r/GUI/Mouse3DController.hpp +++ b/src/slic3r/GUI/Mouse3DController.hpp @@ -2,7 +2,7 @@ #define slic3r_Mouse3DController_hpp_ // Enabled debug output to console and extended imgui dialog -#define ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT 1 +#define ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT 0 #include "libslic3r/Point.hpp" @@ -180,7 +180,7 @@ public: void disconnected(); typedef std::array DataPacketAxis; // Unpack a 3DConnexion packet provided by the 3DConnexion driver into m_state. Called by Mouse3DHandlerMac.mm - static bool handle_input(const DataPacketAxis& packet, const Params ¶ms, State &state_in_out); + bool handle_input(const DataPacketAxis& packet); #endif // __APPLE__ #ifdef WIN32