ENABLE_3DCONNEXION_DEVICES tech set as default

This commit is contained in:
Enrico Turri 2019-10-11 15:51:36 +02:00
parent 1c05d88c00
commit e6403a74ef
14 changed files with 1 additions and 129 deletions

View File

@ -32,13 +32,4 @@
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1)
//====================
// 2.0.0.alpha1 techs
//====================
#define ENABLE_2_0_0_ALPHA1 1
// Enabled 3Dconnexion devices
#define ENABLE_3DCONNEXION_DEVICES (1 && ENABLE_2_0_0_ALPHA1)
#endif // _technologies_h_

View File

@ -271,7 +271,6 @@ void AppConfig::set_recent_projects(const std::vector<std::string>& recent_proje
}
}
#if ENABLE_3DCONNEXION_DEVICES
void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone)
{
std::string key = std::string("mouse_device:") + name;
@ -345,7 +344,6 @@ bool AppConfig::get_mouse_device_rotation_deadzone(const std::string& name, floa
deadzone = (float)::atof(it_val->second.c_str());
return true;
}
#endif // ENABLE_3DCONNEXION_DEVICES
void AppConfig::update_config_dir(const std::string &dir)
{

View File

@ -131,13 +131,11 @@ public:
std::vector<std::string> get_recent_projects() const;
void set_recent_projects(const std::vector<std::string>& recent_projects);
#if ENABLE_3DCONNEXION_DEVICES
void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone);
bool get_mouse_device_translation_speed(const std::string& name, double& speed);
bool get_mouse_device_translation_deadzone(const std::string& name, double& deadzone);
bool get_mouse_device_rotation_speed(const std::string& name, float& speed);
bool get_mouse_device_rotation_deadzone(const std::string& name, float& deadzone);
#endif // ENABLE_3DCONNEXION_DEVICES
static const std::string SECTION_FILAMENTS;
static const std::string SECTION_MATERIALS;

View File

@ -85,7 +85,6 @@ void Camera::select_next_type()
void Camera::set_target(const Vec3d& target)
{
#if ENABLE_3DCONNEXION_DEVICES
// We may let these factors be customizable
static const double ScaleFactor = 1.1;
BoundingBoxf3 test_box = m_scene_box;
@ -94,12 +93,6 @@ void Camera::set_target(const Vec3d& target)
m_target(0) = clamp(test_box.min(0), test_box.max(0), m_target(0));
m_target(1) = clamp(test_box.min(1), test_box.max(1), m_target(1));
m_target(2) = clamp(test_box.min(2), test_box.max(2), m_target(2));
#else
m_target = target;
m_target(0) = clamp(m_scene_box.min(0), m_scene_box.max(0), m_target(0));
m_target(1) = clamp(m_scene_box.min(1), m_scene_box.max(1), m_target(1));
m_target(2) = clamp(m_scene_box.min(2), m_scene_box.max(2), m_target(2));
#endif // ENABLE_3DCONNEXION_DEVICES
}
void Camera::set_theta(float theta, bool apply_limit)
@ -114,7 +107,6 @@ void Camera::set_theta(float theta, bool apply_limit)
}
}
#if ENABLE_3DCONNEXION_DEVICES
void Camera::update_zoom(double delta_zoom)
{
set_zoom(m_zoom / (1.0 - std::max(std::min(delta_zoom, 4.0), -4.0) * 0.1));
@ -130,23 +122,6 @@ void Camera::set_zoom(double zoom)
// Don't allow to zoom too close to the scene.
m_zoom = std::min(zoom, 100.0);
}
#else
void Camera::set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h)
{
zoom = std::max(std::min(zoom, 4.0), -4.0) / 10.0;
zoom = m_zoom / (1.0 - zoom);
// Don't allow to zoom too far outside the scene.
double zoom_min = calc_zoom_to_bounding_box_factor(max_box, canvas_w, canvas_h);
if (zoom_min > 0.0)
zoom = std::max(zoom, zoom_min * 0.7);
// Don't allow to zoom too close to the scene.
zoom = std::min(zoom, 100.0);
m_zoom = zoom;
}
#endif // ENABLE_3DCONNEXION_DEVICES
bool Camera::select_view(const std::string& direction)
{

View File

@ -63,13 +63,8 @@ public:
void set_theta(float theta, bool apply_limit);
double get_zoom() const { return m_zoom; }
#if ENABLE_3DCONNEXION_DEVICES
void update_zoom(double delta_zoom);
void set_zoom(double zoom);
#else
void set_zoom(double zoom, const BoundingBoxf3& max_box, int canvas_w, int canvas_h);
void set_zoom(double zoom) { m_zoom = zoom; }
#endif // ENABLE_3DCONNEXION_DEVICES
const BoundingBoxf3& get_scene_box() const { return m_scene_box; }
void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; }

View File

@ -22,9 +22,7 @@
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
#include "GUI_ObjectManipulation.hpp"
#if ENABLE_3DCONNEXION_DEVICES
#include "Mouse3DController.hpp"
#endif // ENABLE_3DCONNEXION_DEVICES
#include "I18N.hpp"
#if ENABLE_RETINA_GL
@ -1394,11 +1392,7 @@ BoundingBoxf3 GLCanvas3D::volumes_bounding_box() const
BoundingBoxf3 GLCanvas3D::scene_bounding_box() const
{
BoundingBoxf3 bb = volumes_bounding_box();
#if ENABLE_3DCONNEXION_DEVICES
bb.merge(m_bed.get_bounding_box(true));
#else
bb.merge(m_bed.get_bounding_box(false));
#endif // ENABLE_3DCONNEXION_DEVICES
if (m_config != nullptr)
{
@ -1546,16 +1540,11 @@ void GLCanvas3D::render()
return;
}
#if ENABLE_3DCONNEXION_DEVICES
const Size& cnv_size = get_canvas_size();
#endif // ENABLE_3DCONNEXION_DEVICES
if (m_camera.requires_zoom_to_bed)
{
zoom_to_bed();
#if !ENABLE_3DCONNEXION_DEVICES
const Size& cnv_size = get_canvas_size();
#endif // !ENABLE_3DCONNEXION_DEVICES
_resize((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
m_camera.requires_zoom_to_bed = false;
}
@ -1646,9 +1635,7 @@ void GLCanvas3D::render()
m_camera.debug_render();
#endif // ENABLE_CAMERA_STATISTICS
#if ENABLE_3DCONNEXION_DEVICES
wxGetApp().plater()->get_mouse3d_controller().render_settings_dialog((unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
#endif // ENABLE_3DCONNEXION_DEVICES
wxGetApp().imgui()->render();
@ -2350,17 +2337,14 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
m_dirty |= m_main_toolbar.update_items_state();
m_dirty |= m_undoredo_toolbar.update_items_state();
m_dirty |= m_view_toolbar.update_items_state();
#if ENABLE_3DCONNEXION_DEVICES
bool mouse3d_controller_applied = wxGetApp().plater()->get_mouse3d_controller().apply(m_camera);
m_dirty |= mouse3d_controller_applied;
#endif // ENABLE_3DCONNEXION_DEVICES
if (!m_dirty)
return;
_refresh_if_shown_on_screen();
#if ENABLE_3DCONNEXION_DEVICES
if (m_keep_dirty || mouse3d_controller_applied)
{
m_dirty = true;
@ -2368,10 +2352,6 @@ void GLCanvas3D::on_idle(wxIdleEvent& evt)
}
else
m_dirty = false;
#else
if (m_keep_dirty)
m_dirty = true;
#endif // ENABLE_3DCONNEXION_DEVICES
}
void GLCanvas3D::on_char(wxKeyEvent& evt)
@ -2417,7 +2397,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
post_event(SimpleEvent(EVT_GLTOOLBAR_COPY));
break;
#if ENABLE_3DCONNEXION_DEVICES
#ifdef __APPLE__
case 'm':
case 'M':
@ -2430,7 +2409,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
m_dirty = true;
break;
}
#endif // ENABLE_3DCONNEXION_DEVICES
#ifdef __APPLE__
case 'v':
@ -2499,19 +2477,11 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
case 'B':
case 'b': { zoom_to_bed(); break; }
case 'I':
#if ENABLE_3DCONNEXION_DEVICES
case 'i': { _update_camera_zoom(1.0); break; }
#else
case 'i': { set_camera_zoom(1.0); break; }
#endif // ENABLE_3DCONNEXION_DEVICES
case 'K':
case 'k': { m_camera.select_next_type(); m_dirty = true; break; }
case 'O':
#if ENABLE_3DCONNEXION_DEVICES
case 'o': { _update_camera_zoom(-1.0); break; }
#else
case 'o': { set_camera_zoom(-1.0); break; }
#endif // ENABLE_3DCONNEXION_DEVICES
#if ENABLE_RENDER_PICKING_PASS
case 'T':
case 't': {
@ -2614,12 +2584,10 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
{
#if ENABLE_3DCONNEXION_DEVICES
// try to filter out events coming from mouse 3d
Mouse3DController& controller = wxGetApp().plater()->get_mouse3d_controller();
if (controller.process_mouse_wheel())
return;
#endif // ENABLE_3DCONNEXION_DEVICES
if (!m_initialized)
return;
@ -2665,11 +2633,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
return;
// Calculate the zoom delta and apply it to the current zoom factor
#if ENABLE_3DCONNEXION_DEVICES
_update_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta());
#else
set_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta());
#endif // ENABLE_3DCONNEXION_DEVICES
}
void GLCanvas3D::on_timer(wxTimerEvent& evt)
@ -3451,15 +3415,6 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
m_dirty = true;
}
#if !ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::set_camera_zoom(double zoom)
{
const Size& cnv_size = get_canvas_size();
m_camera.set_zoom(zoom, _max_bounding_box(false, true), cnv_size.get_width(), cnv_size.get_height());
m_dirty = true;
}
#endif // !ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::update_gizmos_on_off_state()
{
set_as_dirty();
@ -3910,10 +3865,6 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
// updates camera
m_camera.apply_viewport(0, 0, w, h);
#if !ENABLE_3DCONNEXION_DEVICES
m_dirty = false;
#endif // !ENABLE_3DCONNEXION_DEVICES
}
BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_bed_model) const
@ -3941,13 +3892,11 @@ void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box)
m_dirty = true;
}
#if ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::_update_camera_zoom(double zoom)
{
m_camera.update_zoom(zoom);
m_dirty = true;
}
#endif // ENABLE_3DCONNEXION_DEVICES
void GLCanvas3D::_refresh_if_shown_on_screen()
{

View File

@ -486,9 +486,7 @@ public:
void set_color_by(const std::string& value);
const Camera& get_camera() const { return m_camera; }
#if ENABLE_3DCONNEXION_DEVICES
Camera& get_camera() { return m_camera; }
#endif // ENABLE_3DCONNEXION_DEVICES
BoundingBoxf3 volumes_bounding_box() const;
BoundingBoxf3 scene_bounding_box() const;
@ -567,10 +565,6 @@ public:
void do_flatten(const Vec3d& normal, const std::string& snapshot_type);
void do_mirror(const std::string& snapshot_type);
#if !ENABLE_3DCONNEXION_DEVICES
void set_camera_zoom(double zoom);
#endif // !ENABLE_3DCONNEXION_DEVICES
void update_gizmos_on_off_state();
void reset_all_gizmos() { m_gizmos.reset_all_states(); }
@ -644,9 +638,7 @@ private:
BoundingBoxf3 _max_bounding_box(bool include_gizmos, bool include_bed_model) const;
void _zoom_to_box(const BoundingBoxf3& box);
#if ENABLE_3DCONNEXION_DEVICES
void _update_camera_zoom(double zoom);
#endif // ENABLE_3DCONNEXION_DEVICES
void _refresh_if_shown_on_screen();

View File

@ -529,10 +529,8 @@ void ImGuiWrapper::init_style()
set_color(ImGuiCol_SliderGrab, COL_ORANGE_DARK);
set_color(ImGuiCol_SliderGrabActive, COL_ORANGE_LIGHT);
#if ENABLE_3DCONNEXION_DEVICES
// Separator
set_color(ImGuiCol_Separator, COL_ORANGE_LIGHT);
#endif // ENABLE_3DCONNEXION_DEVICES
}
void ImGuiWrapper::render_draw_data(ImDrawData *draw_data)

View File

@ -157,9 +157,7 @@ void KBShortcutsDialog::fill_shortcuts()
plater_shortcuts.push_back(Shortcut("Z", L("Zoom to selected object")));
plater_shortcuts.push_back(Shortcut("I", L("Zoom in")));
plater_shortcuts.push_back(Shortcut("O", L("Zoom out")));
#if ENABLE_3DCONNEXION_DEVICES
plater_shortcuts.push_back(Shortcut(ctrl+"M", L("Show/Hide 3Dconnexion devices settings dialog")));
#endif // ENABLE_3DCONNEXION_DEVICES
plater_shortcuts.push_back(Shortcut("ESC", L("Unselect gizmo / Clear selection")));
#if ENABLE_RENDER_PICKING_PASS
// Don't localize debugging texts.

View File

@ -24,9 +24,7 @@
#include "PrintHostDialogs.hpp"
#include "wxExtensions.hpp"
#include "GUI_ObjectList.hpp"
#if ENABLE_3DCONNEXION_DEVICES
#include "Mouse3DController.hpp"
#endif // ENABLE_3DCONNEXION_DEVICES
#include "I18N.hpp"
#include <fstream>

View File

@ -1,8 +1,6 @@
#include "libslic3r/libslic3r.h"
#include "Mouse3DController.hpp"
#if ENABLE_3DCONNEXION_DEVICES
#include "Camera.hpp"
#include "GUI_App.hpp"
#include "PresetBundle.hpp"
@ -647,5 +645,3 @@ bool Mouse3DController::handle_packet_button(const DataPacket& packet, unsigned
} // namespace GUI
} // namespace Slic3r
#endif // ENABLE_3DCONNEXION_DEVICES

View File

@ -1,9 +1,7 @@
#ifndef slic3r_Mouse3DController_hpp_
#define slic3r_Mouse3DController_hpp_
#if ENABLE_3DCONNEXION_DEVICES
// Enabled debug output and extended imgui dialog
// Enabled debug output to console and extended imgui dialog
#define ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT 0
#include "libslic3r/Point.hpp"
@ -169,7 +167,5 @@ private:
} // namespace GUI
} // namespace Slic3r
#endif // ENABLE_3DCONNEXION_DEVICES
#endif // slic3r_Mouse3DController_hpp_

View File

@ -62,9 +62,7 @@
#include "GUI_Preview.hpp"
#include "3DBed.hpp"
#include "Camera.hpp"
#if ENABLE_3DCONNEXION_DEVICES
#include "Mouse3DController.hpp"
#endif // ENABLE_3DCONNEXION_DEVICES
#include "Tab.hpp"
#include "PresetBundle.hpp"
#include "BackgroundSlicingProcess.hpp"
@ -1373,9 +1371,7 @@ struct Plater::priv
Sidebar *sidebar;
Bed3D bed;
Camera camera;
#if ENABLE_3DCONNEXION_DEVICES
Mouse3DController mouse3d_controller;
#endif // ENABLE_3DCONNEXION_DEVICES
View3D* view3D;
GLToolbar view_toolbar;
Preview *preview;
@ -2107,9 +2103,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
// updates camera type from .ini file
camera.set_type(get_config("use_perspective_camera"));
#if ENABLE_3DCONNEXION_DEVICES
mouse3d_controller.init();
#endif // ENABLE_3DCONNEXION_DEVICES
// Initialize the Undo / Redo stack with a first snapshot.
this->take_snapshot(_(L("New Project")));
@ -2117,9 +2111,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
Plater::priv::~priv()
{
#if ENABLE_3DCONNEXION_DEVICES
mouse3d_controller.shutdown();
#endif // ENABLE_3DCONNEXION_DEVICES
if (config != nullptr)
delete config;
@ -5159,7 +5151,6 @@ const Camera& Plater::get_camera() const
return p->camera;
}
#if ENABLE_3DCONNEXION_DEVICES
const Mouse3DController& Plater::get_mouse3d_controller() const
{
return p->mouse3d_controller;
@ -5169,7 +5160,6 @@ Mouse3DController& Plater::get_mouse3d_controller()
{
return p->mouse3d_controller;
}
#endif // ENABLE_3DCONNEXION_DEVICES
bool Plater::can_delete() const { return p->can_delete(); }
bool Plater::can_delete_all() const { return p->can_delete_all(); }

View File

@ -260,10 +260,8 @@ public:
void msw_rescale();
const Camera& get_camera() const;
#if ENABLE_3DCONNEXION_DEVICES
const Mouse3DController& get_mouse3d_controller() const;
Mouse3DController& get_mouse3d_controller();
#endif // ENABLE_3DCONNEXION_DEVICES
// ROII wrapper for suppressing the Undo / Redo snapshot to be taken.
class SuppressSnapshots