From a15bf7cc25e682570ae9bee9b1fd1928f72e12aa Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 1 Nov 2018 10:06:55 +0100 Subject: [PATCH] New selection set as default --- src/libslic3r/Model.cpp | 11 - src/libslic3r/Technologies.hpp | 5 +- src/slic3r/GUI/3DScene.cpp | 112 --- src/slic3r/GUI/3DScene.hpp | 52 -- src/slic3r/GUI/GLCanvas3D.cpp | 856 +--------------------- src/slic3r/GUI/GLCanvas3D.hpp | 117 --- src/slic3r/GUI/GLCanvas3DManager.cpp | 56 -- src/slic3r/GUI/GLCanvas3DManager.hpp | 17 - src/slic3r/GUI/GLGizmo.cpp | 421 ----------- src/slic3r/GUI/GLGizmo.hpp | 118 --- src/slic3r/GUI/GLToolbar.cpp | 6 - src/slic3r/GUI/GLToolbar.hpp | 6 - src/slic3r/GUI/GUI_ObjectList.cpp | 15 - src/slic3r/GUI/GUI_ObjectManipulation.cpp | 2 - src/slic3r/GUI/GUI_ObjectManipulation.hpp | 5 - src/slic3r/GUI/Plater.cpp | 370 +--------- 16 files changed, 20 insertions(+), 2149 deletions(-) diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 9aad49397..89b476d75 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -693,23 +693,12 @@ void ModelObject::center_around_origin() if (v->is_model_part()) bb.merge(v->mesh.bounding_box()); -#if ENABLE_EXTENDED_SELECTION // Shift is the vector from the center of the bounding box to the origin Vec3d shift = -bb.center(); -#else - // Shift is the vector from the center of the bottom face of the bounding box to the origin - Vec3d shift = -bb.center(); - shift(2) = -bb.min(2); -#endif // ENABLE_EXTENDED_SELECTION this->translate(shift); this->origin_translation += shift; -#if !ENABLE_EXTENDED_SELECTION - // set z to zero, translation in z has already been done within the mesh - shift(2) = 0.0; -#endif // !ENABLE_EXTENDED_SELECTION - if (!this->instances.empty()) { for (ModelInstance *i : this->instances) { i->set_offset(i->get_offset() - shift); diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index a844d5f4b..73d342f08 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -17,9 +17,8 @@ #define ENABLE_GIZMOS_RESET (1 && ENABLE_1_42_0) // Uses a unique opengl context #define ENABLE_USE_UNIQUE_GLCONTEXT (1 && ENABLE_1_42_0) -// New selections -#define ENABLE_EXTENDED_SELECTION (1 && ENABLE_1_42_0) -#define DISABLE_INSTANCES_SYNCH (1 && ENABLE_EXTENDED_SELECTION) +// Disable synchronization of unselected instances +#define DISABLE_INSTANCES_SYNCH (1 && ENABLE_1_42_0) // Modified camera target behavior #define ENABLE_MODIFIED_CAMERA_TARGET (1 && ENABLE_1_42_0) // Add Geometry::Transformation class and use it into ModelInstance, ModelVolume and GLVolume diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 924b969e0..7745710e1 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -209,10 +209,6 @@ GLVolume::GLVolume(float r, float g, float b, float a) , m_transformed_convex_hull_bounding_box_dirty(true) , m_convex_hull(nullptr) , composite_id(-1) -#if !ENABLE_EXTENDED_SELECTION - , select_group_id(-1) - , drag_group_id(-1) -#endif // !ENABLE_EXTENDED_SELECTION , extruder_id(0) , selected(false) , is_active(true) @@ -270,14 +266,11 @@ const Vec3d& GLVolume::get_rotation() const void GLVolume::set_rotation(const Vec3d& rotation) { -#if ENABLE_EXTENDED_SELECTION static const double TWO_PI = 2.0 * (double)PI; -#endif // ENABLE_EXTENDED_SELECTION if (m_rotation != rotation) { m_rotation = rotation; -#if ENABLE_EXTENDED_SELECTION for (int i = 0; i < 3; ++i) { while (m_rotation(i) < 0.0) @@ -289,7 +282,6 @@ void GLVolume::set_rotation(const Vec3d& rotation) m_rotation(i) -= TWO_PI; } } -#endif // ENABLE_EXTENDED_SELECTION m_world_matrix_dirty = true; m_transformed_bounding_box_dirty = true; m_transformed_convex_hull_bounding_box_dirty = true; @@ -312,12 +304,10 @@ void GLVolume::set_offset(const Vec3d& offset) } } -#if ENABLE_EXTENDED_SELECTION const Vec3d& GLVolume::get_scaling_factor() const { return m_scaling_factor; } -#endif // ENABLE_EXTENDED_SELECTION void GLVolume::set_scaling_factor(const Vec3d& scaling_factor) { @@ -368,26 +358,6 @@ void GLVolume::set_convex_hull(const TriangleMesh& convex_hull) m_convex_hull = &convex_hull; } -#if !ENABLE_EXTENDED_SELECTION -void GLVolume::set_select_group_id(const std::string& select_by) -{ - if (select_by == "object") - select_group_id = object_idx() * 1000000; - else if (select_by == "volume") - select_group_id = object_idx() * 1000000 + volume_idx() * 1000; - else if (select_by == "instance") - select_group_id = composite_id; -} - -void GLVolume::set_drag_group_id(const std::string& drag_by) -{ - if (drag_by == "object") - drag_group_id = object_idx() * 1000; - else if (drag_by == "instance") - drag_group_id = object_idx() * 1000 + instance_idx(); -} -#endif // !ENABLE_EXTENDED_SELECTION - #if !ENABLE_MODELVOLUME_TRANSFORM const Transform3f& GLVolume::world_matrix() const { @@ -722,23 +692,12 @@ void GLVolume::generate_layer_height_texture(const PrintObject *print_object, bo #define LAYER_HEIGHT_TEXTURE_WIDTH 1024 #define LAYER_HEIGHT_TEXTURE_HEIGHT 1024 -#if ENABLE_EXTENDED_SELECTION std::vector GLVolumeCollection::load_object( const ModelObject *model_object, int obj_idx, const std::vector &instance_idxs, const std::string &color_by, bool use_VBOs) -#else -std::vector GLVolumeCollection::load_object( - const ModelObject *model_object, - int obj_idx, - const std::vector &instance_idxs, - const std::string &color_by, - const std::string &select_by, - const std::string &drag_by, - bool use_VBOs) -#endif // ENABLE_EXTENDED_SELECTION { static float colors[4][4] = { { 1.0f, 1.0f, 0.0f, 1.f }, @@ -789,10 +748,6 @@ std::vector GLVolumeCollection::load_object( v.bounding_box = v.indexed_vertex_array.bounding_box(); v.indexed_vertex_array.finalize_geometry(use_VBOs); v.composite_id = obj_idx * 1000000 + volume_idx * 1000 + instance_idx; -#if !ENABLE_EXTENDED_SELECTION - v.set_select_group_id(select_by); - v.set_drag_group_id(drag_by); -#endif // !ENABLE_EXTENDED_SELECTION if (model_volume->is_model_part()) { v.set_convex_hull(model_volume->get_convex_hull()); @@ -884,10 +839,6 @@ int GLVolumeCollection::load_wipe_tower_preview( v.bounding_box = v.indexed_vertex_array.bounding_box(); v.indexed_vertex_array.finalize_geometry(use_VBOs); v.composite_id = obj_idx * 1000000; -#if !ENABLE_EXTENDED_SELECTION - v.select_group_id = obj_idx * 1000000; - v.drag_group_id = obj_idx * 1000; -#endif // !ENABLE_EXTENDED_SELECTION v.is_wipe_tower = true; v.shader_outside_printer_detection_enabled = ! size_unknown; return int(this->volumes.size() - 1); @@ -1083,26 +1034,6 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con } } -#if !ENABLE_EXTENDED_SELECTION -void GLVolumeCollection::set_select_by(const std::string& select_by) -{ - for (GLVolume *vol : this->volumes) - { - if (vol != nullptr) - vol->set_select_group_id(select_by); - } -} - -void GLVolumeCollection::set_drag_by(const std::string& drag_by) -{ - for (GLVolume *vol : this->volumes) - { - if (vol != nullptr) - vol->set_drag_group_id(drag_by); - } -} -#endif // !ENABLE_EXTENDED_SELECTION - std::vector GLVolumeCollection::get_current_print_zs(bool active_only) const { // Collect layer top positions of all volumes. @@ -1874,23 +1805,6 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas) s_canvas_mgr.reset_volumes(canvas); } -#if !ENABLE_EXTENDED_SELECTION -void _3DScene::deselect_volumes(wxGLCanvas* canvas) -{ - s_canvas_mgr.deselect_volumes(canvas); -} - -void _3DScene::select_volume(wxGLCanvas* canvas, unsigned int id) -{ - s_canvas_mgr.select_volume(canvas, id); -} - -void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector& selections) -{ - s_canvas_mgr.update_volumes_selection(canvas, selections); -} -#endif // !ENABLE_EXTENDED_SELECTION - int _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) { return s_canvas_mgr.check_volumes_outside_state(canvas, config); @@ -1906,17 +1820,10 @@ bool _3DScene::move_volume_down(wxGLCanvas* canvas, unsigned int id) return s_canvas_mgr.move_volume_down(canvas, id); } -#if ENABLE_EXTENDED_SELECTION GUI::GLCanvas3D* _3DScene::get_canvas(wxGLCanvas* canvas) { return s_canvas_mgr.get_canvas(canvas); } -#else -void _3DScene::set_objects_selections(wxGLCanvas* canvas, const std::vector& selections) -{ - s_canvas_mgr.set_objects_selections(canvas, selections); -} -#endif // ENABLE_EXTENDED_SELECTION void _3DScene::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config) { @@ -1963,23 +1870,6 @@ void _3DScene::set_color_by(wxGLCanvas* canvas, const std::string& value) s_canvas_mgr.set_color_by(canvas, value); } -#if !ENABLE_EXTENDED_SELECTION -void _3DScene::set_select_by(wxGLCanvas* canvas, const std::string& value) -{ - s_canvas_mgr.set_select_by(canvas, value); -} - -void _3DScene::set_drag_by(wxGLCanvas* canvas, const std::string& value) -{ - s_canvas_mgr.set_drag_by(canvas, value); -} - -std::string _3DScene::get_select_by(wxGLCanvas* canvas) -{ - return s_canvas_mgr.get_select_by(canvas); -} -#endif // !ENABLE_EXTENDED_SELECTION - bool _3DScene::is_layers_editing_enabled(wxGLCanvas* canvas) { return s_canvas_mgr.is_layers_editing_enabled(canvas); @@ -2157,12 +2047,10 @@ int _3DScene::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) return s_canvas_mgr.get_in_object_volume_id(canvas, scene_vol_idx); } -#if ENABLE_EXTENDED_SELECTION void _3DScene::mirror_selection(wxGLCanvas* canvas, Axis axis) { s_canvas_mgr.mirror_selection(canvas, axis); } -#endif // ENABLE_EXTENDED_SELECTION void _3DScene::reload_scene(wxGLCanvas* canvas, bool force) { diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 35638b2ef..d33f34b85 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -290,12 +290,6 @@ public: float render_color[4]; // An ID containing the object ID, volume ID and instance ID. int composite_id; -#if !ENABLE_EXTENDED_SELECTION - // An ID for group selection. It may be the same for all meshes of all object instances, or for just a single object instance. - int select_group_id; - // An ID for group dragging. It may be the same for all meshes of all object instances, or for just a single object instance. - int drag_group_id; -#endif // !ENABLE_EXTENDED_SELECTION // An ID containing the extruder ID (used to select color). int extruder_id; // Is this object selected? @@ -365,9 +359,7 @@ public: const Vec3d& get_rotation() const; void set_rotation(const Vec3d& rotation); -#if ENABLE_EXTENDED_SELECTION const Vec3d& get_scaling_factor() const; -#endif // ENABLE_EXTENDED_SELECTION void set_scaling_factor(const Vec3d& scaling_factor); const Vec3d& get_mirror() const; @@ -381,11 +373,6 @@ public: void set_convex_hull(const TriangleMesh& convex_hull); -#if !ENABLE_EXTENDED_SELECTION - void set_select_group_id(const std::string& select_by); - void set_drag_group_id(const std::string& drag_by); -#endif // !ENABLE_EXTENDED_SELECTION - int object_idx() const { return this->composite_id / 1000000; } int volume_idx() const { return (this->composite_id / 1000) % 1000; } int instance_idx() const { return this->composite_id % 1000; } @@ -450,9 +437,7 @@ public: #endif // ENABLE_MODELVOLUME_TRANSFORM }; -#if ENABLE_EXTENDED_SELECTION typedef std::vector GLVolumePtrs; -#endif // ENABLE_EXTENDED_SELECTION class GLVolumeCollection { @@ -461,32 +446,17 @@ class GLVolumeCollection float print_box_max[3]; public: -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs volumes; -#else - std::vector volumes; -#endif // ENABLE_EXTENDED_SELECTION GLVolumeCollection() {}; ~GLVolumeCollection() { clear(); }; -#if ENABLE_EXTENDED_SELECTION std::vector load_object( const ModelObject *model_object, int obj_idx, const std::vector &instance_idxs, const std::string &color_by, bool use_VBOs); -#else - std::vector load_object( - const ModelObject *model_object, - int obj_idx, - const std::vector &instance_idxs, - const std::string &color_by, - const std::string &select_by, - const std::string &drag_by, - bool use_VBOs); -#endif // ENABLE_EXTENDED_SELECTION int load_wipe_tower_preview( int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool use_VBOs, bool size_unknown, float brim_width); @@ -520,11 +490,6 @@ public: void update_colors_by_extruder(const DynamicPrintConfig* config); -#if !ENABLE_EXTENDED_SELECTION - void set_select_by(const std::string& select_by); - void set_drag_by(const std::string& drag_by); -#endif // !ENABLE_EXTENDED_SELECTION - // Returns a vector containing the sorted list of all the print_zs of the volumes contained in this collection std::vector get_current_print_zs(bool active_only) const; @@ -552,20 +517,11 @@ public: static unsigned int get_volumes_count(wxGLCanvas* canvas); static void reset_volumes(wxGLCanvas* canvas); -#if !ENABLE_EXTENDED_SELECTION - static void deselect_volumes(wxGLCanvas* canvas); - static void select_volume(wxGLCanvas* canvas, unsigned int id); - static void update_volumes_selection(wxGLCanvas* canvas, const std::vector& selections); -#endif // !ENABLE_EXTENDED_SELECTION static int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config); static bool move_volume_up(wxGLCanvas* canvas, unsigned int id); static bool move_volume_down(wxGLCanvas* canvas, unsigned int id); -#if ENABLE_EXTENDED_SELECTION static GUI::GLCanvas3D* get_canvas(wxGLCanvas* canvas); -#else - static void set_objects_selections(wxGLCanvas* canvas, const std::vector& selections); -#endif // ENABLE_EXTENDED_SELECTION static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config); static void set_print(wxGLCanvas* canvas, Print* print); @@ -581,12 +537,6 @@ public: static void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons); static void set_color_by(wxGLCanvas* canvas, const std::string& value); -#if !ENABLE_EXTENDED_SELECTION - static void set_select_by(wxGLCanvas* canvas, const std::string& value); - static void set_drag_by(wxGLCanvas* canvas, const std::string& value); - - static std::string get_select_by(wxGLCanvas* canvas); -#endif // !ENABLE_EXTENDED_SELECTION static bool is_layers_editing_enabled(wxGLCanvas* canvas); static bool is_layers_editing_allowed(wxGLCanvas* canvas); @@ -628,9 +578,7 @@ public: static int get_first_volume_id(wxGLCanvas* canvas, int obj_idx); static int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx); -#if ENABLE_EXTENDED_SELECTION static void mirror_selection(wxGLCanvas* canvas, Axis axis); -#endif // ENABLE_EXTENDED_SELECTION static void reload_scene(wxGLCanvas* canvas, bool force); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 5a03be086..5ea74fc17 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1093,14 +1093,7 @@ const Vec3d GLCanvas3D::Mouse::Drag::Invalid_3D_Point(DBL_MAX, DBL_MAX, DBL_MAX) GLCanvas3D::Mouse::Drag::Drag() : start_position_2D(Invalid_2D_Point) , start_position_3D(Invalid_3D_Point) -#if !ENABLE_EXTENDED_SELECTION - , volume_center_offset(0, 0, 0) - , move_with_shift(false) -#endif // !ENABLE_EXTENDED_SELECTION , move_volume_idx(-1) -#if !ENABLE_EXTENDED_SELECTION - , gizmo_volume_idx(-1) -#endif // !ENABLE_EXTENDED_SELECTION { } @@ -1133,7 +1126,6 @@ bool GLCanvas3D::Mouse::is_start_position_3D_defined() const return (drag.start_position_3D != Drag::Invalid_3D_Point); } -#if ENABLE_EXTENDED_SELECTION GLCanvas3D::Selection::VolumeCache::VolumeCache() : m_position(Vec3d::Zero()) , m_rotation(Vec3d::Zero()) @@ -1918,7 +1910,6 @@ void GLCanvas3D::Selection::_synchronize_unselected_instances() } } } -#endif // ENABLE_EXTENDED_SELECTION const float GLCanvas3D::Gizmos::OverlayTexturesScale = 0.75f; const float GLCanvas3D::Gizmos::OverlayOffsetX = 10.0f * OverlayTexturesScale; @@ -2006,22 +1997,12 @@ void GLCanvas3D::Gizmos::set_enabled(bool enable) m_enabled = enable; } -#if ENABLE_EXTENDED_SELECTION std::string GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const GLCanvas3D::Selection& selection) -#else -void GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos) -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION std::string name = ""; -#endif // ENABLE_EXTENDED_SELECTION if (!m_enabled) -#if ENABLE_EXTENDED_SELECTION return name; -#else - return; -#endif // ENABLE_EXTENDED_SELECTION float cnv_h = (float)canvas.get_canvas_size().get_height(); float height = _get_total_overlay_height(); @@ -2035,32 +2016,20 @@ void GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, const Vec2 float half_tex_size = 0.5f * tex_size; // we currently use circular icons for gizmo, so we check the radius -#if ENABLE_EXTENDED_SELECTION if (it->second->is_activable(selection) && (it->second->get_state() != GLGizmoBase::On)) -#else - if (it->second->get_state() != GLGizmoBase::On) -#endif // ENABLE_EXTENDED_SELECTION { bool inside = (mouse_pos - Vec2d(OverlayOffsetX + half_tex_size, top_y + half_tex_size)).norm() < half_tex_size; it->second->set_state(inside ? GLGizmoBase::Hover : GLGizmoBase::Off); -#if ENABLE_EXTENDED_SELECTION if (inside) name = it->second->get_name(); -#endif // ENABLE_EXTENDED_SELECTION } top_y += (tex_size + OverlayGapY); } -#if ENABLE_EXTENDED_SELECTION return name; -#endif // ENABLE_EXTENDED_SELECTION } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const GLCanvas3D::Selection& selection) -#else -void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos) -#endif // ENABLE_EXTENDED_SELECTION { if (!m_enabled) return; @@ -2077,11 +2046,7 @@ void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec float half_tex_size = 0.5f * tex_size; // we currently use circular icons for gizmo, so we check the radius -#if ENABLE_EXTENDED_SELECTION if (it->second->is_activable(selection) && ((mouse_pos - Vec2d(OverlayOffsetX + half_tex_size, top_y + half_tex_size)).norm() < half_tex_size)) -#else - if ((mouse_pos - Vec2d(OverlayOffsetX + half_tex_size, top_y + half_tex_size)).norm() < half_tex_size) -#endif // ENABLE_EXTENDED_SELECTION { if ((it->second->get_state() == GLGizmoBase::On)) { @@ -2105,7 +2070,6 @@ void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec it->second->set_state(GLGizmoBase::On); } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::update_on_off_state(const Selection& selection) { GizmosMap::iterator it = m_gizmos.find(m_current); @@ -2118,7 +2082,6 @@ void GLCanvas3D::Gizmos::update_on_off_state(const Selection& selection) } } } -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::reset_all_states() { @@ -2149,7 +2112,6 @@ void GLCanvas3D::Gizmos::set_hover_id(int id) } } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::enable_grabber(EType type, unsigned int id, bool enable) { if (!m_enabled) @@ -2164,7 +2126,6 @@ void GLCanvas3D::Gizmos::enable_grabber(EType type, unsigned int id, bool enable it->second->disable_grabber(id); } } -#endif // ENABLE_EXTENDED_SELECTION bool GLCanvas3D::Gizmos::overlay_contains_mouse(const GLCanvas3D& canvas, const Vec2d& mouse_pos) const { @@ -2246,7 +2207,6 @@ bool GLCanvas3D::Gizmos::is_dragging() const return (curr != nullptr) ? curr->is_dragging() : false; } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::start_dragging(const GLCanvas3D::Selection& selection) { if (!m_enabled) @@ -2256,17 +2216,6 @@ void GLCanvas3D::Gizmos::start_dragging(const GLCanvas3D::Selection& selection) if (curr != nullptr) curr->start_dragging(selection); } -#else -void GLCanvas3D::Gizmos::start_dragging(const BoundingBoxf3& box) -{ - if (!m_enabled) - return; - - GLGizmoBase* curr = _get_current(); - if (curr != nullptr) - curr->start_dragging(box); -} -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::stop_dragging() { @@ -2278,7 +2227,6 @@ void GLCanvas3D::Gizmos::stop_dragging() curr->stop_dragging(); } -#if ENABLE_EXTENDED_SELECTION Vec3d GLCanvas3D::Gizmos::get_displacement() const { if (!m_enabled) @@ -2287,26 +2235,6 @@ Vec3d GLCanvas3D::Gizmos::get_displacement() const GizmosMap::const_iterator it = m_gizmos.find(Move); return (it != m_gizmos.end()) ? reinterpret_cast(it->second)->get_displacement() : Vec3d::Zero(); } -#else -Vec3d GLCanvas3D::Gizmos::get_position() const -{ - if (!m_enabled) - return Vec3d::Zero(); - - GizmosMap::const_iterator it = m_gizmos.find(Move); - return (it != m_gizmos.end()) ? reinterpret_cast(it->second)->get_position() : Vec3d::Zero(); -} - -void GLCanvas3D::Gizmos::set_position(const Vec3d& position) -{ - if (!m_enabled) - return; - - GizmosMap::const_iterator it = m_gizmos.find(Move); - if (it != m_gizmos.end()) - reinterpret_cast(it->second)->set_position(position); -} -#endif // ENABLE_EXTENDED_SELECTION Vec3d GLCanvas3D::Gizmos::get_scale() const { @@ -2395,26 +2323,16 @@ void GLCanvas3D::Gizmos::delete_current_grabber(bool delete_all) reinterpret_cast(it->second)->delete_current_grabber(delete_all); } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::render_current_gizmo(const GLCanvas3D::Selection& selection) const -#else -void GLCanvas3D::Gizmos::render_current_gizmo(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { if (!m_enabled) return; ::glDisable(GL_DEPTH_TEST); -#if ENABLE_EXTENDED_SELECTION _render_current_gizmo(selection); -#else - if (box.radius() > 0.0) - _render_current_gizmo(box); -#endif // ENABLE_EXTENDED_SELECTION } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::render_current_gizmo_for_picking_pass(const GLCanvas3D::Selection& selection) const { if (!m_enabled) @@ -2424,17 +2342,6 @@ void GLCanvas3D::Gizmos::render_current_gizmo_for_picking_pass(const GLCanvas3D: if (curr != nullptr) curr->render_for_picking(selection); } -#else -void GLCanvas3D::Gizmos::render_current_gizmo_for_picking_pass(const BoundingBoxf3& box) const -{ - if (!m_enabled) - return; - - GLGizmoBase* curr = _get_current(); - if (curr != nullptr) - curr->render_for_picking(box); -} -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::render_overlay(const GLCanvas3D& canvas) const { @@ -2485,21 +2392,12 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas) const } } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::Gizmos::_render_current_gizmo(const GLCanvas3D::Selection& selection) const { GLGizmoBase* curr = _get_current(); if (curr != nullptr) curr->render(selection); } -#else -void GLCanvas3D::Gizmos::_render_current_gizmo(const BoundingBoxf3& box) const -{ - GLGizmoBase* curr = _get_current(); - if (curr != nullptr) - curr->render(box); -} -#endif // ENABLE_EXTENDED_SELECTION float GLCanvas3D::Gizmos::_get_total_overlay_height() const { @@ -2825,35 +2723,18 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const } wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); -#if ENABLE_EXTENDED_SELECTION wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); -#else -wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, ObjectSelectEvent); -#endif // ENABLE_EXTENDED_SELECTION wxDEFINE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDEFINE_EVENT(EVT_GLCANVAS_DOUBLE_CLICK, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDEFINE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, Vec2dEvent); wxDEFINE_EVENT(EVT_GLCANVAS_MODEL_UPDATE, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_REMOVE_OBJECT, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_ARRANGE, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDEFINE_EVENT(EVT_GLCANVAS_ROTATE_OBJECT, Event); -wxDEFINE_EVENT(EVT_GLCANVAS_SCALE_UNIFORMLY, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDEFINE_EVENT(EVT_GLCANVAS_INCREASE_INSTANCES, Event); wxDEFINE_EVENT(EVT_GLCANVAS_INSTANCE_MOVED, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent); wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event); wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>); -#if !ENABLE_EXTENDED_SELECTION -wxDEFINE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent); -wxDEFINE_EVENT(EVT_GIZMO_ROTATE, Vec3dEvent); -wxDEFINE_EVENT(EVT_GIZMO_FLATTEN, Vec3dEvent); -#endif // !ENABLE_EXTENDED_SELECTION - GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) : m_canvas(canvas) , m_context(nullptr) @@ -2875,14 +2756,8 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) , m_shader_enabled(false) , m_dynamic_background_enabled(false) , m_multisample_allowed(false) -#if ENABLE_EXTENDED_SELECTION , m_regenerate_volumes(true) -#endif // ENABLE_EXTENDED_SELECTION , m_color_by("volume") -#if !ENABLE_EXTENDED_SELECTION - , m_select_by("object") - , m_drag_by("instance") -#endif // !ENABLE_EXTENDED_SELECTION , m_reload_delayed(false) { if (m_canvas != nullptr) @@ -2893,9 +2768,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas) m_timer.SetOwner(m_canvas); } -#if ENABLE_EXTENDED_SELECTION m_selection.set_volumes(&m_volumes.volumes); -#endif // ENABLE_EXTENDED_SELECTION } GLCanvas3D::~GLCanvas3D() @@ -3028,9 +2901,7 @@ void GLCanvas3D::reset_volumes() return; #endif // !ENABLE_USE_UNIQUE_GLCONTEXT -#if ENABLE_EXTENDED_SELECTION m_selection.clear(); -#endif // ENABLE_EXTENDED_SELECTION m_volumes.release_geometry(); m_volumes.clear(); m_dirty = true; @@ -3040,48 +2911,6 @@ void GLCanvas3D::reset_volumes() _reset_warning_texture(); } -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3D::deselect_volumes() -{ - for (GLVolume* vol : m_volumes.volumes) - { - if (vol != nullptr) - vol->selected = false; - } -} - -void GLCanvas3D::select_volume(unsigned int id) -{ - if (id < (unsigned int)m_volumes.volumes.size()) - { - GLVolume* vol = m_volumes.volumes[id]; - if (vol != nullptr) - vol->selected = true; - } -} - -void GLCanvas3D::update_volumes_selection(const std::vector& selections) -{ - if (m_model == nullptr) - return; - - if (selections.empty()) - return; - - for (unsigned int obj_idx = 0; obj_idx < (unsigned int)m_model->objects.size(); ++obj_idx) - { - if ((selections[obj_idx] == 1) && (obj_idx < (unsigned int)m_objects_volumes_idxs.size())) - { - const std::vector& volume_idxs = m_objects_volumes_idxs[obj_idx]; - for (int v : volume_idxs) - { - select_volume(v); - } - } - } -} -#endif // !ENABLE_EXTENDED_SELECTION - int GLCanvas3D::check_volumes_outside_state(const DynamicPrintConfig* config) const { ModelInstance::EPrintVolumeState state; @@ -3095,10 +2924,6 @@ bool GLCanvas3D::move_volume_up(unsigned int id) { std::swap(m_volumes.volumes[id - 1], m_volumes.volumes[id]); std::swap(m_volumes.volumes[id - 1]->composite_id, m_volumes.volumes[id]->composite_id); -#if !ENABLE_EXTENDED_SELECTION - std::swap(m_volumes.volumes[id - 1]->select_group_id, m_volumes.volumes[id]->select_group_id); - std::swap(m_volumes.volumes[id - 1]->drag_group_id, m_volumes.volumes[id]->drag_group_id); -#endif // !ENABLE_EXTENDED_SELECTION return true; } @@ -3111,23 +2936,12 @@ bool GLCanvas3D::move_volume_down(unsigned int id) { std::swap(m_volumes.volumes[id + 1], m_volumes.volumes[id]); std::swap(m_volumes.volumes[id + 1]->composite_id, m_volumes.volumes[id]->composite_id); -#if !ENABLE_EXTENDED_SELECTION - std::swap(m_volumes.volumes[id + 1]->select_group_id, m_volumes.volumes[id]->select_group_id); - std::swap(m_volumes.volumes[id + 1]->drag_group_id, m_volumes.volumes[id]->drag_group_id); -#endif // !ENABLE_EXTENDED_SELECTION return true; } return false; } -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3D::set_objects_selections(const std::vector& selections) -{ - m_objects_selections = selections; -} -#endif // !ENABLE_EXTENDED_SELECTION - void GLCanvas3D::set_config(DynamicPrintConfig* config) { m_config = config; @@ -3141,9 +2955,7 @@ void GLCanvas3D::set_print(Print* print) void GLCanvas3D::set_model(Model* model) { m_model = model; -#if ENABLE_EXTENDED_SELECTION m_selection.set_model(m_model); -#endif // ENABLE_EXTENDED_SELECTION } void GLCanvas3D::set_bed_shape(const Pointfs& shape) @@ -3201,30 +3013,6 @@ void GLCanvas3D::set_color_by(const std::string& value) m_color_by = value; } -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3D::set_select_by(const std::string& value) -{ - m_select_by = value; - m_volumes.set_select_by(value); -} - -void GLCanvas3D::set_drag_by(const std::string& value) -{ - m_drag_by = value; - m_volumes.set_drag_by(value); -} - -const std::string& GLCanvas3D::get_select_by() const -{ - return m_select_by; -} - -const std::string& GLCanvas3D::get_drag_by() const -{ - return m_drag_by; -} -#endif // !ENABLE_EXTENDED_SELECTION - float GLCanvas3D::get_camera_zoom() const { return m_camera.zoom; @@ -3279,9 +3067,7 @@ void GLCanvas3D::enable_legend_texture(bool enable) void GLCanvas3D::enable_picking(bool enable) { m_picking_enabled = enable; -#if ENABLE_EXTENDED_SELECTION m_selection.set_mode(Selection::Instance); -#endif // ENABLE_EXTENDED_SELECTION } void GLCanvas3D::enable_moving(bool enable) @@ -3345,13 +3131,11 @@ void GLCanvas3D::zoom_to_volumes() } #if ENABLE_MODIFIED_CAMERA_TARGET -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::zoom_to_selection() { if (!m_selection.is_empty()) _zoom_to_bounding_box(m_selection.get_bounding_box()); } -#endif // ENABLE_EXTENDED_SELECTION #endif // ENABLE_MODIFIED_CAMERA_TARGET void GLCanvas3D::select_view(const std::string& direction) @@ -3405,7 +3189,6 @@ void GLCanvas3D::update_gizmos_data() if (!m_gizmos.is_enabled()) return; -#if ENABLE_EXTENDED_SELECTION bool enable_move_z = !m_selection.is_wipe_tower(); m_gizmos.enable_grabber(Gizmos::Move, 2, enable_move_z); bool enable_scale_xyz = m_selection.is_single_full_instance(); @@ -3429,32 +3212,6 @@ void GLCanvas3D::update_gizmos_data() m_gizmos.set_rotation(Vec3d::Zero()); m_gizmos.set_flattening_data(nullptr); } -#else - int id = _get_first_selected_object_id(); - if ((id != -1) && (m_model != nullptr)) - { - ModelObject* model_object = m_model->objects[id]; - if (model_object != nullptr) - { - ModelInstance* model_instance = model_object->instances[0]; - if (model_instance != nullptr) - { - m_gizmos.set_position(model_instance->get_offset()); - m_gizmos.set_scale(model_instance->get_scaling_factor()); - m_gizmos.set_rotation(model_instance->get_rotation()); - m_gizmos.set_flattening_data(model_object); - m_gizmos.set_model_object_ptr(model_object); - } - } - } - else - { - m_gizmos.set_position(Vec3d::Zero()); - m_gizmos.set_scale(Vec3d::Ones()); - m_gizmos.set_rotation(Vec3d::Zero()); - m_gizmos.set_flattening_data(nullptr); - } -#endif // ENABLE_EXTENDED_SELECTION } // Returns a Rect object denoting size and position of the Reset button used by a gizmo. @@ -3522,9 +3279,7 @@ void GLCanvas3D::render() } _render_objects(); -#if ENABLE_EXTENDED_SELECTION _render_selection(); -#endif // ENABLE_EXTENDED_SELECTION if (!is_custom_bed) // textured bed needs to be rendered after objects { @@ -3567,11 +3322,7 @@ std::vector GLCanvas3D::load_object(const ModelObject& model_object, int ob instance_idxs.push_back(i); } } -#if ENABLE_EXTENDED_SELECTION return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_color_by, m_use_VBOs && m_initialized); -#else - return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_color_by, m_select_by, m_drag_by, m_use_VBOs && m_initialized); -#endif // ENABLE_EXTENDED_SELECTION } std::vector GLCanvas3D::load_object(const Model& model, int obj_idx) @@ -3602,31 +3353,24 @@ int GLCanvas3D::get_in_object_volume_id(int scene_vol_idx) const return ((0 <= scene_vol_idx) && (scene_vol_idx < (int)m_volumes.volumes.size())) ? m_volumes.volumes[scene_vol_idx]->volume_idx() : -1; } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::mirror_selection(Axis axis) { m_selection.mirror(axis); _on_mirror(); wxGetApp().obj_manipul()->update_settings_value(m_selection); } -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3D::reload_scene(bool force) { if ((m_canvas == nullptr) || (m_config == nullptr) || (m_model == nullptr)) return; -#if !ENABLE_EXTENDED_SELECTION - reset_volumes(); -#endif // !ENABLE_EXTENDED_SELECTION - #if !ENABLE_USE_UNIQUE_GLCONTEXT // ensures this canvas is current if (!set_current()) return; #endif // !ENABLE_USE_UNIQUE_GLCONTEXT -#if ENABLE_EXTENDED_SELECTION if (m_regenerate_volumes) { reset_volumes(); @@ -3634,7 +3378,6 @@ void GLCanvas3D::reload_scene(bool force) // to update the toolbar post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT)); } -#endif // ENABLE_EXTENDED_SELECTION set_bed_shape(dynamic_cast(m_config->option("bed_shape"))->values); @@ -3646,7 +3389,6 @@ void GLCanvas3D::reload_scene(bool force) m_reload_delayed = false; -#if ENABLE_EXTENDED_SELECTION if (m_regenerate_volumes) { for (unsigned int obj_idx = 0; obj_idx < (unsigned int)m_model->objects.size(); ++obj_idx) @@ -3656,26 +3398,9 @@ void GLCanvas3D::reload_scene(bool force) } update_gizmos_data(); -#else - m_objects_volumes_idxs.clear(); - for (unsigned int obj_idx = 0; obj_idx < (unsigned int)m_model->objects.size(); ++obj_idx) - { - m_objects_volumes_idxs.push_back(load_object(*m_model, obj_idx)); - } - - // 1st call to reset if no objects left - update_gizmos_data(); - update_volumes_selection(m_objects_selections); - // 2nd call to restore selection, if any - if (!m_objects_selections.empty()) - update_gizmos_data(); -#endif // ENABLE_EXTENDED_SELECTION - -#if ENABLE_EXTENDED_SELECTION if (m_regenerate_volumes) { -#endif // ENABLE_EXTENDED_SELECTION if (m_config->has("nozzle_diameter")) { // Should the wipe tower be visualized ? @@ -3705,9 +3430,7 @@ void GLCanvas3D::reload_scene(bool force) } update_volumes_colors_by_extruder(); -#if ENABLE_EXTENDED_SELECTION } -#endif // ENABLE_EXTENDED_SELECTION // checks for geometry outside the print volume to render it accordingly if (!m_volumes.empty()) @@ -3736,10 +3459,8 @@ void GLCanvas3D::reload_scene(bool force) post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, false)); } -#if ENABLE_EXTENDED_SELECTION // restore to default value m_regenerate_volumes = true; -#endif // ENABLE_EXTENDED_SELECTION } void GLCanvas3D::load_gcode_preview(const GCodePreviewData& preview_data, const std::vector& str_tool_colors) @@ -3903,19 +3624,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) // key B/b case 66: case 98: { zoom_to_bed(); break; } -#if !ENABLE_EXTENDED_SELECTION - // key L/l - case 76: - case 108: { post_event(Event(EVT_GLCANVAS_ROTATE_OBJECT, -1)); break; } - // key R/r - case 82: - case 114: { post_event(Event(EVT_GLCANVAS_ROTATE_OBJECT, +1)); break; } - // key S/s - case 83: - case 115: { post_event(SimpleEvent(EVT_GLCANVAS_SCALE_UNIFORMLY)); break; } -#endif // !ENABLE_EXTENDED_SELECTION #if ENABLE_MODIFIED_CAMERA_TARGET -#if ENABLE_EXTENDED_SELECTION // key Z/z case 90: case 122: @@ -3927,11 +3636,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) break; } -#else - // key Z/z - case 90: - case 122: { zoom_to_volumes(); break; } -#endif // ENABLE_EXTENDED_SELECTION #else // key Z/z case 90: @@ -3957,11 +3661,7 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) // Performs layers editing updates, if enabled if (is_layers_editing_enabled()) { -#if ENABLE_EXTENDED_SELECTION int object_idx_selected = m_selection.get_object_idx(); -#else - int object_idx_selected = _get_first_selected_object_id(); -#endif // ENABLE_EXTENDED_SELECTION if (object_idx_selected != -1) { // A volume is selected. Test, whether hovering over a layer thickness bar. @@ -4005,13 +3705,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { Point pos(evt.GetX(), evt.GetY()); -#if ENABLE_EXTENDED_SELECTION int selected_object_idx = m_selection.get_object_idx(); int layer_editing_object_idx = is_layers_editing_enabled() ? selected_object_idx : -1; -#else - int selected_object_idx = _get_first_selected_object_id(); - int layer_editing_object_idx = is_layers_editing_enabled() ? selected_object_idx : -1; -#endif // ENABLE_EXTENDED_SELECTION m_layers_editing.last_object_id = layer_editing_object_idx; bool gizmos_overlay_contains_mouse = m_gizmos.overlay_contains_mouse(*this, m_mouse.position); int toolbar_contains_mouse = m_toolbar.contains_mouse(m_mouse.position); @@ -4032,10 +3727,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_mouse.position = Vec2d(-1.0, -1.0); m_dirty = true; } -#if !ENABLE_EXTENDED_SELECTION - else if (evt.LeftDClick() && (m_hover_volume_id != -1) && !gizmos_overlay_contains_mouse && (toolbar_contains_mouse == -1)) - post_event(SimpleEvent(EVT_GLCANVAS_DOUBLE_CLICK)); -#endif // !ENABLE_EXTENDED_SELECTION else if (evt.LeftDClick() && (toolbar_contains_mouse != -1)) { m_toolbar_action_running = true; @@ -4050,33 +3741,17 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { case Gizmos::Scale: { -#if ENABLE_EXTENDED_SELECTION m_selection.scale(m_gizmos.get_scale()); _on_scale(); -#else - post_event(Vec3dEvent(EVT_GIZMO_SCALE, m_gizmos.get_scale())); -#endif // ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - wxGetApp().obj_manipul()->update_scale_values(); -#endif // ENABLE_EXTENDED_SELECTION m_dirty = true; break; } case Gizmos::Rotate: { -#if ENABLE_EXTENDED_SELECTION m_selection.rotate(m_gizmos.get_rotation()); _on_rotate(); -#else - post_event(Vec3dEvent(EVT_GIZMO_ROTATE, std::move(m_gizmos.get_rotation()))); -#endif // ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - wxGetApp().obj_manipul()->update_rotation_values(); -#endif // ENABLE_EXTENDED_SELECTION m_dirty = true; break; } @@ -4091,9 +3766,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { // If user pressed left or right button we first check whether this happened // on a volume or not. -#if !ENABLE_EXTENDED_SELECTION - int volume_idx = m_hover_volume_id; -#endif // !ENABLE_EXTENDED_SELECTION m_layers_editing.state = LayersEditing::Unknown; if ((layer_editing_object_idx != -1) && m_layers_editing.bar_rect_contains(*this, pos(0), pos(1))) { @@ -4127,45 +3799,23 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } } -#if ENABLE_EXTENDED_SELECTION else if (!m_selection.is_empty() && gizmos_overlay_contains_mouse) { m_gizmos.update_on_off_state(*this, m_mouse.position, m_selection); update_gizmos_data(); m_dirty = true; } -#else - else if ((selected_object_idx != -1) && gizmos_overlay_contains_mouse) - { - update_gizmos_data(); - m_gizmos.update_on_off_state(*this, m_mouse.position); - m_dirty = true; - } -#endif // ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION else if (evt.LeftDown() && !m_selection.is_empty() && m_gizmos.grabber_contains_mouse()) -#else - else if (evt.LeftDown() && (selected_object_idx != -1) && m_gizmos.grabber_contains_mouse()) -#endif // ENABLE_EXTENDED_SELECTION { update_gizmos_data(); -#if ENABLE_EXTENDED_SELECTION m_selection.start_dragging(); m_gizmos.start_dragging(m_selection); -#else - m_gizmos.start_dragging(_selected_volumes_bounding_box()); - m_mouse.drag.gizmo_volume_idx = _get_first_selected_volume_id(selected_object_idx); -#endif // ENABLE_EXTENDED_SELECTION if (m_gizmos.get_current_type() == Gizmos::Flatten) { // Rotate the object so the normal points downward: -#if ENABLE_EXTENDED_SELECTION m_selection.rotate(m_gizmos.get_flattening_rotation()); _on_flatten(); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - post_event(Vec3dEvent(EVT_GIZMO_FLATTEN, m_gizmos.get_flattening_rotation())); -#endif // ENABLE_EXTENDED_SELECTION } m_dirty = true; @@ -4185,13 +3835,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // Don't deselect a volume if layer editing is enabled. We want the object to stay selected // during the scene manipulation. -#if ENABLE_EXTENDED_SELECTION if (m_picking_enabled && ((m_hover_volume_id != -1) || !is_layers_editing_enabled())) -#else - if (m_picking_enabled && ((volume_idx != -1) || !is_layers_editing_enabled())) -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION if (evt.LeftDown() && (m_hover_volume_id != -1)) { bool already_selected = m_selection.contains_volume(m_hover_volume_id); @@ -4211,76 +3856,27 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT)); m_dirty = true; } -#else - if (volume_idx != -1) - { - deselect_volumes(); - select_volume(volume_idx); - int group_id = m_volumes.volumes[volume_idx]->select_group_id; - if (group_id != -1) - { - for (GLVolume* vol : m_volumes.volumes) - { - if ((vol != nullptr) && (vol->select_group_id == group_id)) - vol->selected = true; - } - } - - update_gizmos_data(); - m_dirty = true; - } -#endif // ENABLE_EXTENDED_SELECTION } // propagate event through callback -#if !ENABLE_EXTENDED_SELECTION - if (m_picking_enabled && (volume_idx != -1)) - _on_select(volume_idx, selected_object_idx); -#endif // !ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION if (m_hover_volume_id != -1) -#else - if (volume_idx != -1) -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION if (evt.LeftDown() && m_moving_enabled && (m_mouse.drag.move_volume_idx == -1)) -#else - if (evt.LeftDown() && m_moving_enabled) -#endif // ENABLE_EXTENDED_SELECTION { // The mouse_to_3d gets the Z coordinate from the Z buffer at the screen coordinate pos x, y, // an converts the screen space coordinate to unscaled object space. -#if ENABLE_EXTENDED_SELECTION Vec3d pos3d = _mouse_to_3d(pos); -#else - Vec3d pos3d = (volume_idx == -1) ? Vec3d(DBL_MAX, DBL_MAX, DBL_MAX) : _mouse_to_3d(pos); -#endif // Only accept the initial position, if it is inside the volume bounding box. -#if ENABLE_EXTENDED_SELECTION BoundingBoxf3 volume_bbox = m_volumes.volumes[m_hover_volume_id]->transformed_bounding_box(); -#else - BoundingBoxf3 volume_bbox = m_volumes.volumes[volume_idx]->transformed_bounding_box(); -#endif // ENABLE_EXTENDED_SELECTION volume_bbox.offset(1.0); if (volume_bbox.contains(pos3d)) { // The dragging operation is initiated. -#if ENABLE_EXTENDED_SELECTION m_mouse.drag.move_volume_idx = m_hover_volume_id; m_selection.start_dragging(); -#else - m_mouse.drag.move_with_shift = evt.ShiftDown(); - m_mouse.drag.move_volume_idx = volume_idx; -#endif // ENABLE_EXTENDED_SELECTION m_mouse.drag.start_position_3D = pos3d; -#if !ENABLE_EXTENDED_SELECTION - // Remember the shift to to the object center.The object center will later be used - // to limit the object placement close to the bed. - m_mouse.drag.volume_center_offset = volume_bbox.center() - pos3d; -#endif // !ENABLE_EXTENDED_SELECTION } } else if (evt.RightDown()) @@ -4291,7 +3887,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) render(); if (m_hover_volume_id != -1) { -#if ENABLE_EXTENDED_SELECTION // if right clicking on volume, propagate event through callback (shows context menu) if (m_volumes.volumes[m_hover_volume_id]->hover && !m_volumes.volumes[m_hover_volume_id]->is_wipe_tower) { @@ -4305,11 +3900,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) render(); post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast())); } -#else - // if right clicking on volume, propagate event through callback (shows context menu) - if (m_volumes.volumes[volume_idx]->hover) - post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast())); -#endif // ENABLE_EXTENDED_SELECTION } } } @@ -4322,60 +3912,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // Get new position at the same Z of the initial click point. float z0 = 0.0f; float z1 = 1.0f; -#if ENABLE_EXTENDED_SELECTION // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag Vec3d cur_pos = m_selection.contains_volume(m_hover_volume_id) ? Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)) : m_mouse.drag.start_position_3D; -#else - Vec3d cur_pos = Linef3(_mouse_to_3d(pos, &z0), _mouse_to_3d(pos, &z1)).intersect_plane(m_mouse.drag.start_position_3D(2)); -#endif // ENABLE_EXTENDED_SELECTION - -#if !ENABLE_EXTENDED_SELECTION - // Clip the new position, so the object center remains close to the bed. - cur_pos += m_mouse.drag.volume_center_offset; - Point cur_pos2(scale_(cur_pos(0)), scale_(cur_pos(1))); - if (!m_bed.contains(cur_pos2)) - { - Point ip = m_bed.point_projection(cur_pos2); - cur_pos(0) = unscale(ip(0)); - cur_pos(1) = unscale(ip(1)); - } - cur_pos -= m_mouse.drag.volume_center_offset; -#endif // !ENABLE_EXTENDED_SELECTION // Calculate the translation vector. Vec3d displacement = cur_pos - m_mouse.drag.start_position_3D; -#if ENABLE_EXTENDED_SELECTION m_selection.translate(displacement); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - // Get the volume being dragged. - GLVolume* volume = m_volumes.volumes[m_mouse.drag.move_volume_idx]; - // Get all volumes belonging to the same group, if any. - std::vector volumes; - int group_id = m_mouse.drag.move_with_shift ? volume->select_group_id : volume->drag_group_id; - if (group_id == -1) - volumes.push_back(volume); - else - { - for (GLVolume* v : m_volumes.volumes) - { - if (v != nullptr) - { - if ((m_mouse.drag.move_with_shift && (v->select_group_id == group_id)) || (!m_mouse.drag.move_with_shift && (v->drag_group_id == group_id))) - volumes.push_back(v); - } - } - } - - // Apply new temporary volume origin and ignore Z. - for (GLVolume* v : volumes) - { - v->set_offset(v->get_offset() + Vec3d(displacement(0), displacement(1), 0.0)); - } - - wxGetApp().obj_manipul()->update_position_value(volume->get_offset()); - m_mouse.drag.start_position_3D = cur_pos; -#endif // ENABLE_EXTENDED_SELECTION m_dirty = true; } @@ -4387,95 +3930,44 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_mouse.dragging = true; m_gizmos.update(mouse_ray(pos), &pos); -#if !ENABLE_EXTENDED_SELECTION - std::vector volumes; - if (m_mouse.drag.gizmo_volume_idx != -1) - { - GLVolume* volume = m_volumes.volumes[m_mouse.drag.gizmo_volume_idx]; - // Get all volumes belonging to the same group, if any. - if (volume->select_group_id == -1) - volumes.push_back(volume); - else - { - for (GLVolume* v : m_volumes.volumes) - { - if ((v != nullptr) && (v->select_group_id == volume->select_group_id)) - volumes.push_back(v); - } - } - } -#endif // !ENABLE_EXTENDED_SELECTION - switch (m_gizmos.get_current_type()) { case Gizmos::Move: { // Apply new temporary offset -#if ENABLE_EXTENDED_SELECTION m_selection.translate(m_gizmos.get_displacement()); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - GLVolume* volume = m_volumes.volumes[m_mouse.drag.gizmo_volume_idx]; - Vec3d offset = m_gizmos.get_position() - volume->get_offset(); - for (GLVolume* v : volumes) - { - v->set_offset(v->get_offset() + offset); - } - wxGetApp().obj_manipul()->update_position_value(volume->get_offset()); -#endif // ENABLE_EXTENDED_SELECTION break; } case Gizmos::Scale: { // Apply new temporary scale factors -#if ENABLE_EXTENDED_SELECTION m_selection.scale(m_gizmos.get_scale()); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - const Vec3d& scale = m_gizmos.get_scale(); - for (GLVolume* v : volumes) - { - v->set_scaling_factor(scale); - } - wxGetApp().obj_manipul()->update_scale_value(scale); -#endif // ENABLE_EXTENDED_SELECTION break; } case Gizmos::Rotate: { // Apply new temporary rotations -#if ENABLE_EXTENDED_SELECTION m_selection.rotate(m_gizmos.get_rotation()); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - // Apply new temporary rotation - const Vec3d& rotation = m_gizmos.get_rotation(); - for (GLVolume* v : volumes) - { - v->set_rotation(rotation); - } - wxGetApp().obj_manipul()->update_rotation_value(rotation); -#endif // ENABLE_EXTENDED_SELECTION break; } default: break; } -#if ENABLE_EXTENDED_SELECTION -#else - if (!volumes.empty()) - { - BoundingBoxf3 bb; - for (const GLVolume* volume : volumes) - { - bb.merge(volume->transformed_bounding_box()); - } - const Vec3d& size = bb.size(); - const Vec3d& scale = m_gizmos.get_scale(); - post_event(Vec3dsEvent<2>(EVT_GLCANVAS_UPDATE_GEOMETRY, {size, scale})); - } -#endif // ENABLE_EXTENDED_SELECTION +// if (!volumes.empty()) +// { +// BoundingBoxf3 bb; +// for (const GLVolume* volume : volumes) +// { +// bb.merge(volume->transformed_bounding_box()); +// } +// const Vec3d& size = bb.size(); +// const Vec3d& scale = m_gizmos.get_scale(); +// post_event(Vec3dsEvent<2>(EVT_GLCANVAS_UPDATE_GEOMETRY, {size, scale})); +// } m_dirty = true; } @@ -4534,40 +4026,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } else if ((m_mouse.drag.move_volume_idx != -1) && m_mouse.dragging) { -#if ENABLE_EXTENDED_SELECTION m_regenerate_volumes = false; _on_move(); wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - // get all volumes belonging to the same group, if any - std::vector volume_idxs; - int vol_id = m_mouse.drag.move_volume_idx; - int group_id = m_mouse.drag.move_with_shift ? m_volumes.volumes[vol_id]->select_group_id : m_volumes.volumes[vol_id]->drag_group_id; - if (group_id == -1) - volume_idxs.push_back(vol_id); - else - { - for (int i = 0; i < (int)m_volumes.volumes.size(); ++i) - { - if ((m_mouse.drag.move_with_shift && (m_volumes.volumes[i]->select_group_id == group_id)) || (m_volumes.volumes[i]->drag_group_id == group_id)) - volume_idxs.push_back(i); - } - } - - _on_move(volume_idxs); - - // force re-selection of the wipe tower, if needed - if ((volume_idxs.size() == 1) && m_volumes.volumes[volume_idxs[0]]->is_wipe_tower) - select_volume(volume_idxs[0]); -#endif // ENABLE_EXTENDED_SELECTION } else if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_hover_volume_id != -1) { -#if ENABLE_EXTENDED_SELECTION int id = m_selection.get_object_idx(); -#else - int id = _get_first_selected_object_id(); -#endif // ENABLE_EXTENDED_SELECTION if ((id != -1) && (m_model != nullptr)) { m_gizmos.clicked_on_object(Vec2d(pos(0), pos(1))); @@ -4582,14 +4047,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if (m_picking_enabled && !m_toolbar_action_running) #endif // ENABLE_GIZMOS_RESET { -#if ENABLE_EXTENDED_SELECTION m_selection.clear(); wxGetApp().obj_manipul()->update_settings_value(m_selection); post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT)); -#else - deselect_volumes(); - _on_select(-1, -1); -#endif // ENABLE_EXTENDED_SELECTION update_gizmos_data(); } #if ENABLE_GIZMOS_RESET @@ -4603,61 +4063,28 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) { case Gizmos::Move: { -#if ENABLE_EXTENDED_SELECTION m_regenerate_volumes = false; _on_move(); -#else - // get all volumes belonging to the same group, if any - std::vector volume_idxs; - int vol_id = m_mouse.drag.gizmo_volume_idx; - int group_id = m_volumes.volumes[vol_id]->select_group_id; - if (group_id == -1) - volume_idxs.push_back(vol_id); - else - { - for (int i = 0; i < (int)m_volumes.volumes.size(); ++i) - { - if (m_volumes.volumes[i]->select_group_id == group_id) - volume_idxs.push_back(i); - } - } - - _on_move(volume_idxs); -#endif // ENABLE_EXTENDED_SELECTION - break; } case Gizmos::Scale: { -#if ENABLE_EXTENDED_SELECTION _on_scale(); -#endif // ENABLE_EXTENDED_SELECTION break; } case Gizmos::Rotate: { -#if ENABLE_EXTENDED_SELECTION _on_rotate(); -#else - post_event(Vec3dEvent(EVT_GIZMO_ROTATE, m_gizmos.get_rotation())); -#endif // ENABLE_EXTENDED_SELECTION break; } default: break; } m_gizmos.stop_dragging(); -#if ENABLE_EXTENDED_SELECTION wxGetApp().obj_manipul()->update_settings_value(m_selection); -#else - wxGetApp().obj_manipul()->update_values(); -#endif // ENABLE_EXTENDED_SELECTION } m_mouse.drag.move_volume_idx = -1; -#if !ENABLE_EXTENDED_SELECTION - m_mouse.drag.gizmo_volume_idx = -1; -#endif // !ENABLE_EXTENDED_SELECTION m_mouse.set_start_position_3D_as_invalid(); m_mouse.set_start_position_2D_as_invalid(); m_mouse.dragging = false; @@ -4859,16 +4286,6 @@ bool GLCanvas3D::_init_toolbar() if (!m_toolbar.add_separator()) return false; -#if !ENABLE_EXTENDED_SELECTION - item.name = "settings"; - item.tooltip = GUI::L_str("Settings..."); - item.sprite_id = 8; - item.is_toggable = false; - item.action_event = EVT_GLTOOLBAR_SETTINGS; - if (!m_toolbar.add_item(item)) - return false; -#endif // !ENABLE_EXTENDED_SELECTION - item.name = "layersediting"; item.tooltip = GUI::L_str("Layers editing"); item.sprite_id = 9; @@ -4880,16 +4297,6 @@ bool GLCanvas3D::_init_toolbar() if (!m_toolbar.add_separator()) return false; -#if !ENABLE_EXTENDED_SELECTION - item.name = "selectbyparts"; - item.tooltip = GUI::L_str("Select by parts"); - item.sprite_id = 10; - item.is_toggable = true; - item.action_event = EVT_GLTOOLBAR_SELECTBYPARTS; - if (!m_toolbar.add_item(item)) - return false; -#endif // !ENABLE_EXTENDED_SELECTION - enable_toolbar_item("add", true); return true; @@ -4984,53 +4391,6 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box() const return bb; } -#if !ENABLE_EXTENDED_SELECTION -BoundingBoxf3 GLCanvas3D::_selected_volumes_bounding_box() const -{ - BoundingBoxf3 bb; - - std::vector selected_volumes; - for (const GLVolume* volume : m_volumes.volumes) - { - if ((volume != nullptr) && !volume->is_wipe_tower && volume->selected) - selected_volumes.push_back(volume); - } - - bool use_drag_group_id = selected_volumes.size() > 1; - if (use_drag_group_id) - { - int drag_group_id = selected_volumes[0]->drag_group_id; - for (const GLVolume* volume : selected_volumes) - { - if (drag_group_id != volume->drag_group_id) - { - use_drag_group_id = false; - break; - } - } - } - - if (use_drag_group_id) - { - for (const GLVolume* volume : selected_volumes) - { - bb.merge(volume->bounding_box); - } - - bb = bb.transformed(selected_volumes[0]->world_matrix().cast()); - } - else - { - for (const GLVolume* volume : selected_volumes) - { - bb.merge(volume->transformed_bounding_box()); - } - } - - return bb; -} -#endif // !ENABLE_EXTENDED_SELECTION - void GLCanvas3D::_zoom_to_bounding_box(const BoundingBoxf3& bbox) { // Calculate the zoom factor needed to adjust viewport to bounding box. @@ -5121,11 +4481,7 @@ void GLCanvas3D::_mark_volumes_for_layer_height() const for (GLVolume* vol : m_volumes.volumes) { -#if ENABLE_EXTENDED_SELECTION int object_id = vol->object_idx(); -#else - int object_id = int(vol->select_group_id / 1000000); -#endif // ENABLE_EXTENDED_SELECTION int shader_id = m_layers_editing.get_shader_program_id(); if (is_layers_editing_enabled() && (shader_id != -1) && vol->selected && @@ -5180,22 +4536,12 @@ void GLCanvas3D::_picking_pass() const ::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _render_volumes(true); -#if ENABLE_EXTENDED_SELECTION m_gizmos.render_current_gizmo_for_picking_pass(m_selection); -#else - m_gizmos.render_current_gizmo_for_picking_pass(_selected_volumes_bounding_box()); -#endif // ENABLE_EXTENDED_SELECTION if (m_multisample_allowed) ::glEnable(GL_MULTISAMPLE); int volume_id = -1; -#if !ENABLE_EXTENDED_SELECTION - for (GLVolume* vol : m_volumes.volumes) - { - vol->hover = false; - } -#endif // !ENABLE_EXTENDED_SELECTION GLubyte color[4] = { 0, 0, 0, 0 }; const Size& cnv_size = get_canvas_size(); @@ -5209,18 +4555,6 @@ void GLCanvas3D::_picking_pass() const if ((0 <= volume_id) && (volume_id < (int)m_volumes.volumes.size())) { m_hover_volume_id = volume_id; -#if !ENABLE_EXTENDED_SELECTION - m_volumes.volumes[volume_id]->hover = true; - int group_id = m_volumes.volumes[volume_id]->select_group_id; - if (group_id != -1) - { - for (GLVolume* vol : m_volumes.volumes) - { - if (vol->select_group_id == group_id) - vol->hover = true; - } - } -#endif // !ENABLE_EXTENDED_SELECTION m_gizmos.set_hover_id(-1); } else @@ -5229,22 +4563,15 @@ void GLCanvas3D::_picking_pass() const m_gizmos.set_hover_id(inside ? (254 - (int)color[2]) : -1); } -#if ENABLE_EXTENDED_SELECTION _update_volumes_hover_state(); -#endif // ENABLE_EXTENDED_SELECTION // updates gizmos overlay -#if ENABLE_EXTENDED_SELECTION if (!m_selection.is_empty()) { std::string name = m_gizmos.update_hover_state(*this, pos, m_selection); if (!name.empty()) set_tooltip(name); } -#else - if (_get_first_selected_object_id() != -1) - m_gizmos.update_hover_state(*this, pos); -#endif // ENABLE_EXTENDED_SELECTION else m_gizmos.reset_all_states(); @@ -5344,14 +4671,12 @@ void GLCanvas3D::_render_objects() const ::glDisable(GL_LIGHTING); } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::_render_selection() const { Gizmos::EType type = m_gizmos.get_current_type(); bool show_indirect_selection = m_gizmos.is_running() && ((type == Gizmos::Rotate) || (type == Gizmos::Scale) || (type == Gizmos::Flatten)); m_selection.render(show_indirect_selection); } -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3D::_render_cutting_plane() const { @@ -5395,11 +4720,7 @@ void GLCanvas3D::_render_layer_editing_overlay() const // If the active object was not allocated at the Print, go away.This should only be a momentary case between an object addition / deletion // and an update by Platter::async_apply_config. -#if ENABLE_EXTENDED_SELECTION int object_idx = volume->object_idx(); -#else - int object_idx = int(volume->select_group_id / 1000000); -#endif // ENABLE_EXTENDED_SELECTION if ((int)m_print->objects().size() <= object_idx) return; @@ -5459,11 +4780,7 @@ void GLCanvas3D::_render_volumes(bool fake_colors) const void GLCanvas3D::_render_current_gizmo() const { -#if ENABLE_EXTENDED_SELECTION m_gizmos.render_current_gizmo(m_selection); -#else - m_gizmos.render_current_gizmo(_selected_volumes_bounding_box()); -#endif // ENABLE_EXTENDED_SELECTION } void GLCanvas3D::_render_gizmos_overlay() const @@ -5504,7 +4821,6 @@ void GLCanvas3D::_render_camera_target() const } #endif // ENABLE_SHOW_CAMERA_TARGET -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::_update_volumes_hover_state() const { for (GLVolume* v : m_volumes.volumes) @@ -5539,7 +4855,6 @@ void GLCanvas3D::_update_volumes_hover_state() const } } } -#endif // ENABLE_EXTENDED_SELECTION float GLCanvas3D::_get_layers_editing_cursor_z_relative() const { @@ -5643,42 +4958,6 @@ void GLCanvas3D::_stop_timer() m_timer.Stop(); } -#if !ENABLE_EXTENDED_SELECTION -int GLCanvas3D::_get_first_selected_object_id() const -{ - if (m_print != nullptr) - { - int objects_count = (int)m_print->objects().size(); - - for (const GLVolume* vol : m_volumes.volumes) - { - if ((vol != nullptr) && vol->selected) - { - int object_id = vol->select_group_id / 1000000; - // Objects with object_id >= 1000 have a specific meaning, for example the wipe tower proxy. - if (object_id < 10000) - return (object_id >= objects_count) ? -1 : object_id; - } - } - } - return -1; -} - -int GLCanvas3D::_get_first_selected_volume_id(int object_id) const -{ - int volume_id = -1; - - for (const GLVolume* vol : m_volumes.volumes) - { - ++volume_id; - if ((vol != nullptr) && vol->selected && (object_id == vol->select_group_id / 1000000)) - return volume_id; - } - - return -1; -} -#endif // !ENABLE_EXTENDED_SELECTION - void GLCanvas3D::_load_print_toolpaths() { #if !ENABLE_USE_UNIQUE_GLCONTEXT @@ -5806,11 +5085,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c tbb::parallel_for( tbb::blocked_range(0, ctxt.layers.size(), grain_size), [&ctxt, &new_volume](const tbb::blocked_range& range) { -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs vols; -#else - std::vector vols; -#endif // ENABLE_EXTENDED_SELECTION if (ctxt.color_by_tool()) { for (size_t i = 0; i < ctxt.number_tools(); ++i) vols.emplace_back(new_volume(ctxt.color_tool(i))); @@ -5969,11 +5244,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector& str_ tbb::blocked_range(0, n_items, grain_size), [&ctxt, &new_volume](const tbb::blocked_range& range) { // Bounding box of this slab of a wipe tower. -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs vols; -#else - std::vector vols; -#endif // ENABLE_EXTENDED_SELECTION if (ctxt.color_by_tool()) { for (size_t i = 0; i < ctxt.number_tools(); ++i) vols.emplace_back(new_volume(ctxt.color_tool(i))); @@ -6199,15 +5470,9 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat m_gcode_preview_volume_index.first_volumes.pop_back(); if (initial_volumes_count != m_volumes.volumes.size()) { -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs::iterator begin = m_volumes.volumes.begin() + initial_volumes_count; GLVolumePtrs::iterator end = m_volumes.volumes.end(); for (GLVolumePtrs::iterator it = begin; it < end; ++it) -#else - std::vector::iterator begin = m_volumes.volumes.begin() + initial_volumes_count; - std::vector::iterator end = m_volumes.volumes.end(); - for (std::vector::iterator it = begin; it < end; ++it) -#endif // ENABLE_EXTENDED_SELECTION { GLVolume* volume = *it; delete volume; @@ -6278,15 +5543,9 @@ void GLCanvas3D::_load_gcode_travel_paths(const GCodePreviewData& preview_data, // an error occourred - restore to previous state and return if (initial_volumes_count != m_volumes.volumes.size()) { -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs::iterator begin = m_volumes.volumes.begin() + initial_volumes_count; GLVolumePtrs::iterator end = m_volumes.volumes.end(); for (GLVolumePtrs::iterator it = begin; it < end; ++it) -#else - std::vector::iterator begin = m_volumes.volumes.begin() + initial_volumes_count; - std::vector::iterator end = m_volumes.volumes.end(); - for (std::vector::iterator it = begin; it < end; ++it) -#endif // ENABLE_EXTENDED_SELECTION { GLVolume* volume = *it; delete volume; @@ -6590,11 +5849,7 @@ void GLCanvas3D::_load_shells() instance_ids[i] = i; } -#if ENABLE_EXTENDED_SELECTION m_volumes.load_object(model_obj, object_id, instance_ids, "object", m_use_VBOs && m_initialized); -#else - m_volumes.load_object(model_obj, object_id, instance_ids, "object", "object", "object", m_use_VBOs && m_initialized); -#endif // ENABLE_EXTENDED_SELECTION ++object_id; } @@ -6617,17 +5872,10 @@ void GLCanvas3D::_update_gcode_volumes_visibility(const GCodePreviewData& previe unsigned int size = (unsigned int)m_gcode_preview_volume_index.first_volumes.size(); for (unsigned int i = 0; i < size; ++i) { -#if ENABLE_EXTENDED_SELECTION GLVolumePtrs::iterator begin = m_volumes.volumes.begin() + m_gcode_preview_volume_index.first_volumes[i].id; GLVolumePtrs::iterator end = (i + 1 < size) ? m_volumes.volumes.begin() + m_gcode_preview_volume_index.first_volumes[i + 1].id : m_volumes.volumes.end(); for (GLVolumePtrs::iterator it = begin; it != end; ++it) -#else - std::vector::iterator begin = m_volumes.volumes.begin() + m_gcode_preview_volume_index.first_volumes[i].id; - std::vector::iterator end = (i + 1 < size) ? m_volumes.volumes.begin() + m_gcode_preview_volume_index.first_volumes[i + 1].id : m_volumes.volumes.end(); - - for (std::vector::iterator it = begin; it != end; ++it) -#endif // ENABLE_EXTENDED_SELECTION { GLVolume* volume = *it; @@ -6716,7 +5964,6 @@ void GLCanvas3D::_show_warning_texture_if_needed() } } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3D::_on_move() { if (m_model == nullptr) @@ -6893,87 +6140,6 @@ void GLCanvas3D::_on_mirror() post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS)); } -#else -void GLCanvas3D::_on_move(const std::vector& volume_idxs) -{ - if (m_model == nullptr) - return; - - std::set done; // prevent moving instances twice - bool object_moved = false; - Vec3d wipe_tower_origin = Vec3d::Zero(); - for (int volume_idx : volume_idxs) - { - GLVolume* volume = m_volumes.volumes[volume_idx]; - int obj_idx = volume->object_idx(); - int instance_idx = volume->instance_idx(); - - // prevent moving instances twice - char done_id[64]; - ::sprintf(done_id, "%d_%d", obj_idx, instance_idx); - if (done.find(done_id) != done.end()) - continue; - - done.insert(done_id); - - if (obj_idx < 1000) - { - // Move a regular object. - ModelObject* model_object = m_model->objects[obj_idx]; - if (model_object != nullptr) - { - model_object->instances[instance_idx]->set_offset(volume->get_offset()); - model_object->invalidate_bounding_box(); - wxGetApp().obj_manipul()->update_position_values(); - object_moved = true; - } - } - else if (obj_idx == 1000) - // Move a wipe tower proxy. - wipe_tower_origin = volume->get_offset(); - } - - if (object_moved) - post_event(SimpleEvent(EVT_GLCANVAS_INSTANCE_MOVED)); - - if (wipe_tower_origin != Vec3d::Zero()) - post_event(Vec3dEvent(EVT_GLCANVAS_WIPETOWER_MOVED, std::move(wipe_tower_origin))); -} -#endif // ENABLE_EXTENDED_SELECTION - -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3D::_on_select(int volume_idx, int object_idx) -{ - int vol_id = -1; - int obj_id = -1; - - if ((volume_idx != -1) && (volume_idx < (int)m_volumes.volumes.size())) - { - if (m_select_by == "volume") - { - if (m_volumes.volumes[volume_idx]->object_idx() != object_idx) - { - set_select_by("object"); - obj_id = m_volumes.volumes[volume_idx]->object_idx(); - vol_id = -1; - } - else - { - obj_id = object_idx; - vol_id = m_volumes.volumes[volume_idx]->volume_idx(); - } - } - else if (m_select_by == "object") - { - obj_id = m_volumes.volumes[volume_idx]->object_idx(); - vol_id = -1; - } - } - - post_event(ObjectSelectEvent(obj_id, vol_id)); - wxGetApp().obj_list()->select_current_volume(obj_id, vol_id); -} -#endif // !ENABLE_EXTENDED_SELECTION std::vector GLCanvas3D::_parse_colors(const std::vector& colors) { diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 779dce98b..dc2f03817 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -82,21 +82,7 @@ public: void set_bottom(float bottom); }; -#if ENABLE_EXTENDED_SELECTION wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); -#else -struct ObjectSelectEvent; -wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, ObjectSelectEvent); -struct ObjectSelectEvent : public ArrayEvent -{ - ObjectSelectEvent(ptrdiff_t object_id, ptrdiff_t volume_id, wxObject *origin = nullptr) - : ArrayEvent(EVT_GLCANVAS_OBJECT_SELECT, {object_id, volume_id}, origin) - {} - - ptrdiff_t object_id() const { return data[0]; } - ptrdiff_t volume_id() const { return data[1]; } -}; -#endif // ENABLE_EXTENDED_SELECTION using Vec2dEvent = Event; template using Vec2dsEvent = ArrayEvent; @@ -106,30 +92,16 @@ template using Vec3dsEvent = ArrayEvent; wxDECLARE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_VIEWPORT_CHANGED, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDECLARE_EVENT(EVT_GLCANVAS_DOUBLE_CLICK, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDECLARE_EVENT(EVT_GLCANVAS_RIGHT_CLICK, Vec2dEvent); wxDECLARE_EVENT(EVT_GLCANVAS_MODEL_UPDATE, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_REMOVE_OBJECT, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_ARRANGE, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDECLARE_EVENT(EVT_GLCANVAS_ROTATE_OBJECT, Event); // data: -1 => rotate left, +1 => rotate right -wxDECLARE_EVENT(EVT_GLCANVAS_SCALE_UNIFORMLY, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDECLARE_EVENT(EVT_GLCANVAS_INCREASE_INSTANCES, Event); // data: +1 => increase, -1 => decrease wxDECLARE_EVENT(EVT_GLCANVAS_INSTANCE_MOVED, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent); wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event); wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>); -#if !ENABLE_EXTENDED_SELECTION -wxDECLARE_EVENT(EVT_GIZMO_SCALE, Vec3dEvent); -wxDECLARE_EVENT(EVT_GIZMO_ROTATE, Vec3dEvent); -wxDECLARE_EVENT(EVT_GIZMO_FLATTEN, Vec3dEvent); -#endif // !ENABLE_EXTENDED_SELECTION - - class GLCanvas3D { struct GCodePreviewVolumeIndex @@ -356,15 +328,7 @@ class GLCanvas3D Point start_position_2D; Vec3d start_position_3D; -#if !ENABLE_EXTENDED_SELECTION - Vec3d volume_center_offset; - - bool move_with_shift; -#endif // !ENABLE_EXTENDED_SELECTION int move_volume_idx; -#if !ENABLE_EXTENDED_SELECTION - int gizmo_volume_idx; -#endif // !ENABLE_EXTENDED_SELECTION public: Drag(); @@ -386,7 +350,6 @@ class GLCanvas3D bool is_start_position_3D_defined() const; }; -#if ENABLE_EXTENDED_SELECTION public: class Selection { @@ -529,8 +492,6 @@ public: }; private: -#endif // ENABLE_EXTENDED_SELECTION - class Gizmos { static const float OverlayTexturesScale; @@ -564,20 +525,13 @@ private: bool is_enabled() const; void set_enabled(bool enable); -#if ENABLE_EXTENDED_SELECTION std::string update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection); void update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection); void update_on_off_state(const Selection& selection); -#else - void update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos); - void update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos); -#endif // ENABLE_EXTENDED_SELECTION void reset_all_states(); void set_hover_id(int id); -#if ENABLE_EXTENDED_SELECTION void enable_grabber(EType type, unsigned int id, bool enable); -#endif // ENABLE_EXTENDED_SELECTION bool overlay_contains_mouse(const GLCanvas3D& canvas, const Vec2d& mouse_pos) const; bool grabber_contains_mouse() const; @@ -591,19 +545,10 @@ private: bool is_running() const; bool is_dragging() const; -#if ENABLE_EXTENDED_SELECTION void start_dragging(const Selection& selection); -#else - void start_dragging(const BoundingBoxf3& box); -#endif // ENABLE_EXTENDED_SELECTION void stop_dragging(); -#if ENABLE_EXTENDED_SELECTION Vec3d get_displacement() const; -#else - Vec3d get_position() const; - void set_position(const Vec3d& position); -#endif // ENABLE_EXTENDED_SELECTION Vec3d get_scale() const; void set_scale(const Vec3d& scale); @@ -619,13 +564,8 @@ private: void clicked_on_object(const Vec2d& mouse_position); void delete_current_grabber(bool delete_all = false); -#if ENABLE_EXTENDED_SELECTION void render_current_gizmo(const Selection& selection) const; void render_current_gizmo_for_picking_pass(const Selection& selection) const; -#else - void render_current_gizmo(const BoundingBoxf3& box) const; - void render_current_gizmo_for_picking_pass(const BoundingBoxf3& box) const; -#endif // ENABLE_EXTENDED_SELECTION void render_overlay(const GLCanvas3D& canvas) const; @@ -633,11 +573,7 @@ private: void _reset(); void _render_overlay(const GLCanvas3D& canvas) const; -#if ENABLE_EXTENDED_SELECTION void _render_current_gizmo(const Selection& selection) const; -#else - void _render_current_gizmo(const BoundingBoxf3& box) const; -#endif // ENABLE_EXTENDED_SELECTION float _get_total_overlay_height() const; GLGizmoBase* _get_current() const; @@ -697,9 +633,7 @@ private: mutable GLToolbar m_toolbar; mutable GLVolumeCollection m_volumes; -#if ENABLE_EXTENDED_SELECTION Selection m_selection; -#endif // ENABLE_EXTENDED_SELECTION DynamicPrintConfig* m_config; Print* m_print; Model* m_model; @@ -718,21 +652,11 @@ private: bool m_shader_enabled; bool m_dynamic_background_enabled; bool m_multisample_allowed; -#if ENABLE_EXTENDED_SELECTION bool m_regenerate_volumes; -#endif // ENABLE_EXTENDED_SELECTION std::string m_color_by; -#if !ENABLE_EXTENDED_SELECTION - std::string m_select_by; - std::string m_drag_by; -#endif // !ENABLE_EXTENDED_SELECTION bool m_reload_delayed; -#if !ENABLE_EXTENDED_SELECTION - std::vector> m_objects_volumes_idxs; - std::vector m_objects_selections; -#endif // !ENABLE_EXTENDED_SELECTION GCodePreviewVolumeIndex m_gcode_preview_volume_index; @@ -759,27 +683,16 @@ public: unsigned int get_volumes_count() const; void reset_volumes(); -#if !ENABLE_EXTENDED_SELECTION - void deselect_volumes(); - void select_volume(unsigned int id); - void update_volumes_selection(const std::vector& selections); -#endif // !ENABLE_EXTENDED_SELECTION int check_volumes_outside_state(const DynamicPrintConfig* config) const; bool move_volume_up(unsigned int id); bool move_volume_down(unsigned int id); -#if !ENABLE_EXTENDED_SELECTION - void set_objects_selections(const std::vector& selections); -#endif // !ENABLE_EXTENDED_SELECTION - void set_config(DynamicPrintConfig* config); void set_print(Print* print); void set_model(Model* model); -#if ENABLE_EXTENDED_SELECTION const Selection& get_selection() const { return m_selection; } Selection& get_selection() { return m_selection; } -#endif // ENABLE_EXTENDED_SELECTION // Set the bed shape to a single closed 2D polygon(array of two element arrays), // triangulate the bed and store the triangles into m_bed.m_triangles, @@ -794,13 +707,6 @@ public: void set_cutting_plane(float z, const ExPolygons& polygons); void set_color_by(const std::string& value); -#if !ENABLE_EXTENDED_SELECTION - void set_select_by(const std::string& value); - void set_drag_by(const std::string& value); - - const std::string& get_select_by() const; - const std::string& get_drag_by() const; -#endif // !ENABLE_EXTENDED_SELECTION float get_camera_zoom() const; @@ -830,9 +736,7 @@ public: void zoom_to_bed(); void zoom_to_volumes(); #if ENABLE_MODIFIED_CAMERA_TARGET -#if ENABLE_EXTENDED_SELECTION void zoom_to_selection(); -#endif // ENABLE_EXTENDED_SELECTION #endif // ENABLE_MODIFIED_CAMERA_TARGET void select_view(const std::string& direction); void set_viewport_from_scene(const GLCanvas3D& other); @@ -853,9 +757,7 @@ public: int get_first_volume_id(int obj_idx) const; int get_in_object_volume_id(int scene_vol_idx) const; -#if ENABLE_EXTENDED_SELECTION void mirror_selection(Axis axis); -#endif // ENABLE_EXTENDED_SELECTION void reload_scene(bool force); @@ -893,9 +795,6 @@ private: void _resize(unsigned int w, unsigned int h); BoundingBoxf3 _max_bounding_box() const; -#if !ENABLE_EXTENDED_SELECTION - BoundingBoxf3 _selected_volumes_bounding_box() const; -#endif // !ENABLE_EXTENDED_SELECTION void _zoom_to_bounding_box(const BoundingBoxf3& bbox); float _get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) const; @@ -909,9 +808,7 @@ private: void _render_bed(float theta) const; void _render_axes(bool depth_test) const; void _render_objects() const; -#if ENABLE_EXTENDED_SELECTION void _render_selection() const; -#endif // ENABLE_EXTENDED_SELECTION void _render_cutting_plane() const; void _render_warning_texture() const; void _render_legend_texture() const; @@ -924,9 +821,7 @@ private: void _render_camera_target() const; #endif // ENABLE_SHOW_CAMERA_TARGET -#if ENABLE_EXTENDED_SELECTION void _update_volumes_hover_state() const; -#endif // ENABLE_EXTENDED_SELECTION float _get_layers_editing_cursor_z_relative() const; void _perform_layer_editing_action(wxMouseEvent* evt = nullptr); @@ -944,11 +839,6 @@ private: void _start_timer(); void _stop_timer(); -#if !ENABLE_EXTENDED_SELECTION - int _get_first_selected_object_id() const; - int _get_first_selected_volume_id(int object_id) const; -#endif // !ENABLE_EXTENDED_SELECTION - // Create 3D thick extrusion lines for a skirt and brim. // Adds a new Slic3r::GUI::3DScene::Volume to volumes. void _load_print_toolpaths(); @@ -977,18 +867,11 @@ private: void _update_toolpath_volumes_outside_state(); void _show_warning_texture_if_needed(); -#if ENABLE_EXTENDED_SELECTION void _on_move(); void _on_rotate(); void _on_scale(); void _on_flatten(); void _on_mirror(); -#else - void _on_move(const std::vector& volume_idxs); -#endif // ENABLE_EXTENDED_SELECTION -#if !ENABLE_EXTENDED_SELECTION - void _on_select(int volume_idx, int object_idx); -#endif // !ENABLE_EXTENDED_SELECTION // generates the legend texture in dependence of the current shown view type void _generate_legend_texture(const GCodePreviewData& preview_data, const std::vector& tool_colors); diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index 9a673b703..55697e2be 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -246,29 +246,6 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas) it->second->reset_volumes(); } -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3DManager::deselect_volumes(wxGLCanvas* canvas) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->deselect_volumes(); -} - -void GLCanvas3DManager::select_volume(wxGLCanvas* canvas, unsigned int id) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->select_volume(id); -} - -void GLCanvas3DManager::update_volumes_selection(wxGLCanvas* canvas, const std::vector& selections) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->update_volumes_selection(selections); -} -#endif // !ENABLE_EXTENDED_SELECTION - int GLCanvas3DManager::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const { CanvasesMap::const_iterator it = _get_canvas(canvas); @@ -287,20 +264,11 @@ bool GLCanvas3DManager::move_volume_down(wxGLCanvas* canvas, unsigned int id) return (it != m_canvases.end()) ? it->second->move_volume_down(id) : false; } -#if ENABLE_EXTENDED_SELECTION GLCanvas3D* GLCanvas3DManager::get_canvas(wxGLCanvas* canvas) { CanvasesMap::const_iterator it = _get_canvas(canvas); return (it != m_canvases.end()) ? it->second : nullptr; } -#else -void GLCanvas3DManager::set_objects_selections(wxGLCanvas* canvas, const std::vector& selections) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->set_objects_selections(selections); -} -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3DManager::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config) { @@ -364,28 +332,6 @@ void GLCanvas3DManager::set_color_by(wxGLCanvas* canvas, const std::string& valu it->second->set_color_by(value); } -#if !ENABLE_EXTENDED_SELECTION -void GLCanvas3DManager::set_select_by(wxGLCanvas* canvas, const std::string& value) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->set_select_by(value); -} - -void GLCanvas3DManager::set_drag_by(wxGLCanvas* canvas, const std::string& value) -{ - CanvasesMap::iterator it = _get_canvas(canvas); - if (it != m_canvases.end()) - it->second->set_drag_by(value); -} - -std::string GLCanvas3DManager::get_select_by(wxGLCanvas* canvas) const -{ - CanvasesMap::const_iterator it = _get_canvas(canvas); - return (it != m_canvases.end()) ? it->second->get_select_by() : ""; -} -#endif // !ENABLE_EXTENDED_SELECTION - bool GLCanvas3DManager::is_layers_editing_enabled(wxGLCanvas* canvas) const { CanvasesMap::const_iterator it = _get_canvas(canvas); @@ -596,14 +542,12 @@ int GLCanvas3DManager::get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol return (it != m_canvases.end()) ? it->second->get_in_object_volume_id(scene_vol_idx) : -1; } -#if ENABLE_EXTENDED_SELECTION void GLCanvas3DManager::mirror_selection(wxGLCanvas* canvas, Axis axis) { CanvasesMap::iterator it = _get_canvas(canvas); if (it != m_canvases.end()) it->second->mirror_selection(axis); } -#endif // ENABLE_EXTENDED_SELECTION void GLCanvas3DManager::reload_scene(wxGLCanvas* canvas, bool force) { diff --git a/src/slic3r/GUI/GLCanvas3DManager.hpp b/src/slic3r/GUI/GLCanvas3DManager.hpp index 66d5fb1cd..6ce805bdd 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.hpp +++ b/src/slic3r/GUI/GLCanvas3DManager.hpp @@ -87,20 +87,11 @@ public: unsigned int get_volumes_count(wxGLCanvas* canvas) const; void reset_volumes(wxGLCanvas* canvas); -#if !ENABLE_EXTENDED_SELECTION - void deselect_volumes(wxGLCanvas* canvas); - void select_volume(wxGLCanvas* canvas, unsigned int id); - void update_volumes_selection(wxGLCanvas* canvas, const std::vector& selections); -#endif // !ENABLE_EXTENDED_SELECTION int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const; bool move_volume_up(wxGLCanvas* canvas, unsigned int id); bool move_volume_down(wxGLCanvas* canvas, unsigned int id); -#if ENABLE_EXTENDED_SELECTION GLCanvas3D* get_canvas(wxGLCanvas* canvas); -#else - void set_objects_selections(wxGLCanvas* canvas, const std::vector& selections); -#endif // ENABLE_EXTENDED_SELECTION void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config); void set_print(wxGLCanvas* canvas, Print* print); @@ -116,12 +107,6 @@ public: void set_cutting_plane(wxGLCanvas* canvas, float z, const ExPolygons& polygons); void set_color_by(wxGLCanvas* canvas, const std::string& value); -#if !ENABLE_EXTENDED_SELECTION - void set_select_by(wxGLCanvas* canvas, const std::string& value); - void set_drag_by(wxGLCanvas* canvas, const std::string& value); - - std::string get_select_by(wxGLCanvas* canvas) const; -#endif // !ENABLE_EXTENDED_SELECTION bool is_layers_editing_enabled(wxGLCanvas* canvas) const; bool is_layers_editing_allowed(wxGLCanvas* canvas) const; @@ -163,9 +148,7 @@ public: int get_first_volume_id(wxGLCanvas* canvas, int obj_idx) const; int get_in_object_volume_id(wxGLCanvas* canvas, int scene_vol_idx) const; -#if ENABLE_EXTENDED_SELECTION void mirror_selection(wxGLCanvas* canvas, Axis axis); -#endif // ENABLE_EXTENDED_SELECTION void reload_scene(wxGLCanvas* canvas, bool force); diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 90c2e0bce..6deedb0b3 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -4,9 +4,6 @@ #include "GUI.hpp" #include "../../libslic3r/Utils.hpp" -#if !ENABLE_EXTENDED_SELECTION -#include "../../slic3r/GUI/GLCanvas3D.hpp" -#endif // !ENABLE_EXTENDED_SELECTION #include #include "../../libslic3r/Geometry.hpp" @@ -26,91 +23,6 @@ static const float AXES_COLOR[3][3] = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f namespace Slic3r { namespace GUI { -#if !ENABLE_EXTENDED_SELECTION -// returns the intersection of the given ray with the plane parallel to plane XY and passing through the given center -// coordinates are local to the plane -Vec3d intersection_on_plane_xy(const Linef3& ray, const Vec3d& center) -{ - Transform3d m = Transform3d::Identity(); - m.translate(-center); - Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0)); - return Vec3d(mouse_pos_2d(0), mouse_pos_2d(1), 0.0); -} - -// returns the intersection of the given ray with the plane parallel to plane XZ and passing through the given center -// coordinates are local to the plane -Vec3d intersection_on_plane_xz(const Linef3& ray, const Vec3d& center) -{ - Transform3d m = Transform3d::Identity(); - m.rotate(Eigen::AngleAxisd(-0.5 * (double)PI, Vec3d::UnitX())); - m.translate(-center); - Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0)); - return Vec3d(mouse_pos_2d(0), 0.0, mouse_pos_2d(1)); -} - -// returns the intersection of the given ray with the plane parallel to plane YZ and passing through the given center -// coordinates are local to the plane -Vec3d intersection_on_plane_yz(const Linef3& ray, const Vec3d& center) -{ - Transform3d m = Transform3d::Identity(); - m.rotate(Eigen::AngleAxisd(-0.5f * (double)PI, Vec3d::UnitY())); - m.translate(-center); - Vec2d mouse_pos_2d = to_2d(transform(ray, m).intersect_plane(0.0)); - - return Vec3d(0.0, mouse_pos_2d(1), -mouse_pos_2d(0)); -} - -// return an index: -// 0 for plane XY -// 1 for plane XZ -// 2 for plane YZ -// which indicates which plane is best suited for intersecting the given unit vector -// giving precedence to the plane with the given index -unsigned int select_best_plane(const Vec3d& unit_vector, unsigned int preferred_plane) -{ - unsigned int ret = preferred_plane; - - // 1st checks if the given vector is not parallel to the given preferred plane - double dot_to_normal = 0.0; - switch (ret) - { - case 0: // plane xy - { - dot_to_normal = std::abs(unit_vector.dot(Vec3d::UnitZ())); - break; - } - case 1: // plane xz - { - dot_to_normal = std::abs(unit_vector.dot(-Vec3d::UnitY())); - break; - } - case 2: // plane yz - { - dot_to_normal = std::abs(unit_vector.dot(Vec3d::UnitX())); - break; - } - default: - { - break; - } - } - - // if almost parallel, select the plane whose normal direction is closest to the given vector direction, - // otherwise return the given preferred plane index - if (dot_to_normal < 0.1) - { - typedef std::map ProjsMap; - ProjsMap projs_map; - projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(Vec3d::UnitZ())), 0)); // plane xy - projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(-Vec3d::UnitY())), 1)); // plane xz - projs_map.insert(ProjsMap::value_type(std::abs(unit_vector.dot(Vec3d::UnitX())), 2)); // plane yz - ret = projs_map.rbegin()->second; - } - - return ret; -} -#endif // !ENABLE_EXTENDED_SELECTION - const float GLGizmoBase::Grabber::SizeFactor = 0.025f; const float GLGizmoBase::Grabber::MinHalfSize = 1.5f; const float GLGizmoBase::Grabber::DraggingScaleFactor = 1.25f; @@ -262,11 +174,7 @@ void GLGizmoBase::disable_grabber(unsigned int id) on_disable_grabber(id); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoBase::start_dragging(const GLCanvas3D::Selection& selection) -#else -void GLGizmoBase::start_dragging(const BoundingBoxf3& box) -#endif // ENABLE_EXTENDED_SELECTION { m_dragging = true; @@ -275,11 +183,7 @@ void GLGizmoBase::start_dragging(const BoundingBoxf3& box) m_grabbers[i].dragging = (m_hover_id == i); } -#if ENABLE_EXTENDED_SELECTION on_start_dragging(selection); -#else - on_start_dragging(box); -#endif // ENABLE_EXTENDED_SELECTION } void GLGizmoBase::stop_dragging() @@ -385,15 +289,9 @@ bool GLGizmoRotate::on_init() return true; } -#if ENABLE_EXTENDED_SELECTION void GLGizmoRotate::on_start_dragging(const GLCanvas3D::Selection& selection) -#else -void GLGizmoRotate::on_start_dragging(const BoundingBoxf3& box) -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION const BoundingBoxf3& box = selection.get_bounding_box(); -#endif // ENABLE_EXTENDED_SELECTION m_center = box.center(); m_radius = Offset + box.radius(); m_snap_coarse_in_radius = m_radius / 3.0f; @@ -437,16 +335,11 @@ void GLGizmoRotate::on_update(const Linef3& mouse_ray, const Point* mouse_positi m_angle = theta; } -#if ENABLE_EXTENDED_SELECTION void GLGizmoRotate::on_render(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoRotate::on_render(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { if (!m_grabbers[0].enabled) return; -#if ENABLE_EXTENDED_SELECTION const BoundingBoxf3& box = selection.get_bounding_box(); bool single_instance = selection.is_single_full_instance(); @@ -460,10 +353,6 @@ void GLGizmoRotate::on_render(const BoundingBoxf3& box) const if ((single_instance && (m_hover_id == 0)) || m_dragging) set_tooltip(axis + format((float)Geometry::rad2deg(m_angle), 4) + "\u00B0"); -#else - if (m_dragging) - set_tooltip(format(m_angle * 180.0f / (float)PI, 4)); -#endif // ENABLE_EXTENDED_SELECTION else { m_center = box.center(); @@ -501,22 +390,14 @@ void GLGizmoRotate::on_render(const BoundingBoxf3& box) const ::glPopMatrix(); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoRotate::on_render_for_picking(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoRotate::on_render_for_picking(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { ::glDisable(GL_DEPTH_TEST); ::glPushMatrix(); transform_to_local(); -#if ENABLE_EXTENDED_SELECTION render_grabbers_for_picking(selection.get_bounding_box()); -#else - render_grabbers_for_picking(box); -#endif // ENABLE_EXTENDED_SELECTION ::glPopMatrix(); } @@ -733,19 +614,11 @@ std::string GLGizmoRotate3D::on_get_name() const return L("Rotate"); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoRotate3D::on_start_dragging(const GLCanvas3D::Selection& selection) { if ((0 <= m_hover_id) && (m_hover_id < 3)) m_gizmos[m_hover_id].start_dragging(selection); } -#else -void GLGizmoRotate3D::on_start_dragging(const BoundingBoxf3& box) -{ - if ((0 <= m_hover_id) && (m_hover_id < 3)) - m_gizmos[m_hover_id].start_dragging(box); -} -#endif // ENABLE_EXTENDED_SELECTION void GLGizmoRotate3D::on_stop_dragging() { @@ -753,7 +626,6 @@ void GLGizmoRotate3D::on_stop_dragging() m_gizmos[m_hover_id].stop_dragging(); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const { if ((m_hover_id == -1) || (m_hover_id == 0)) @@ -765,24 +637,8 @@ void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const if ((m_hover_id == -1) || (m_hover_id == 2)) m_gizmos[Z].render(selection); } -#else -void GLGizmoRotate3D::on_render(const BoundingBoxf3& box) const -{ - if ((m_hover_id == -1) || (m_hover_id == 0)) - m_gizmos[X].render(box); - - if ((m_hover_id == -1) || (m_hover_id == 1)) - m_gizmos[Y].render(box); - - if ((m_hover_id == -1) || (m_hover_id == 2)) - m_gizmos[Z].render(box); -} -#endif // ENABLE_EXTENDED_SELECTION const float GLGizmoScale3D::Offset = 5.0f; -#if !ENABLE_EXTENDED_SELECTION -const Vec3d GLGizmoScale3D::OffsetVec = (double)GLGizmoScale3D::Offset * Vec3d::Ones(); -#endif // !ENABLE_EXTENDED_SELECTION GLGizmoScale3D::GLGizmoScale3D(GLCanvas3D& parent) : GLGizmoBase(parent) @@ -830,20 +686,12 @@ std::string GLGizmoScale3D::on_get_name() const return L("Scale"); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoScale3D::on_start_dragging(const GLCanvas3D::Selection& selection) -#else -void GLGizmoScale3D::on_start_dragging(const BoundingBoxf3& box) -#endif // ENABLE_EXTENDED_SELECTION { if (m_hover_id != -1) { m_starting_drag_position = m_grabbers[m_hover_id].center; -#if ENABLE_EXTENDED_SELECTION m_starting_box = selection.get_bounding_box(); -#else - m_starting_box = BoundingBoxf3(box.min - OffsetVec, box.max + OffsetVec); -#endif // ENABLE_EXTENDED_SELECTION } } @@ -867,13 +715,8 @@ void GLGizmoScale3D::on_process_double_click() } #endif // ENABLE_GIZMOS_RESET -#if ENABLE_EXTENDED_SELECTION void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION bool single_instance = selection.is_single_full_instance(); Vec3f scale = single_instance ? 100.0f * selection.get_volume(*selection.get_volume_idxs().begin())->get_scaling_factor().cast() : 100.0f * m_scale.cast(); @@ -891,25 +734,9 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const tooltip += "Z: " + format(scale(2), 4) + "%"; set_tooltip(tooltip); } -#else - if (m_grabbers[0].dragging || m_grabbers[1].dragging) - set_tooltip("X: " + format(100.0f * m_scale(0), 4) + "%"); - else if (m_grabbers[2].dragging || m_grabbers[3].dragging) - set_tooltip("Y: " + format(100.0f * m_scale(1), 4) + "%"); - else if (m_grabbers[4].dragging || m_grabbers[5].dragging) - set_tooltip("Z: " + format(100.0f * m_scale(2), 4) + "%"); - else if (m_grabbers[6].dragging || m_grabbers[7].dragging || m_grabbers[8].dragging || m_grabbers[9].dragging) - { - std::string tooltip = "X: " + format(100.0f * m_scale(0), 4) + "%\n"; - tooltip += "Y: " + format(100.0f * m_scale(1), 4) + "%\n"; - tooltip += "Z: " + format(100.0f * m_scale(2), 4) + "%"; - set_tooltip(tooltip); - } -#endif // ENABLE_EXTENDED_SELECTION ::glEnable(GL_DEPTH_TEST); -#if ENABLE_EXTENDED_SELECTION BoundingBoxf3 box; Transform3d transform = Transform3d::Identity(); Vec3d angles = Vec3d::Zero(); @@ -942,74 +769,45 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const box = selection.get_bounding_box(); m_box = box; -#else - m_box = BoundingBoxf3(box.min - OffsetVec, box.max + OffsetVec); -#endif // ENABLE_EXTENDED_SELECTION const Vec3d& center = m_box.center(); -#if ENABLE_EXTENDED_SELECTION Vec3d offset_x = offsets_transform * Vec3d((double)Offset, 0.0, 0.0); Vec3d offset_y = offsets_transform * Vec3d(0.0, (double)Offset, 0.0); Vec3d offset_z = offsets_transform * Vec3d(0.0, 0.0, (double)Offset); -#endif // ENABLE_EXTENDED_SELECTION // x axis -#if ENABLE_EXTENDED_SELECTION m_grabbers[0].center = transform * Vec3d(m_box.min(0), center(1), center(2)) - offset_x; m_grabbers[1].center = transform * Vec3d(m_box.max(0), center(1), center(2)) + offset_x; -#else - m_grabbers[0].center = Vec3d(m_box.min(0), center(1), center(2)); - m_grabbers[1].center = Vec3d(m_box.max(0), center(1), center(2)); -#endif // ENABLE_EXTENDED_SELECTION ::memcpy((void*)m_grabbers[0].color, (const void*)&AXES_COLOR[0], 3 * sizeof(float)); ::memcpy((void*)m_grabbers[1].color, (const void*)&AXES_COLOR[0], 3 * sizeof(float)); // y axis -#if ENABLE_EXTENDED_SELECTION m_grabbers[2].center = transform * Vec3d(center(0), m_box.min(1), center(2)) - offset_y; m_grabbers[3].center = transform * Vec3d(center(0), m_box.max(1), center(2)) + offset_y; -#else - m_grabbers[2].center = Vec3d(center(0), m_box.min(1), center(2)); - m_grabbers[3].center = Vec3d(center(0), m_box.max(1), center(2)); -#endif // ENABLE_EXTENDED_SELECTION ::memcpy((void*)m_grabbers[2].color, (const void*)&AXES_COLOR[1], 3 * sizeof(float)); ::memcpy((void*)m_grabbers[3].color, (const void*)&AXES_COLOR[1], 3 * sizeof(float)); // z axis -#if ENABLE_EXTENDED_SELECTION m_grabbers[4].center = transform * Vec3d(center(0), center(1), m_box.min(2)) - offset_z; m_grabbers[5].center = transform * Vec3d(center(0), center(1), m_box.max(2)) + offset_z; -#else - m_grabbers[4].center = Vec3d(center(0), center(1), m_box.min(2)); - m_grabbers[5].center = Vec3d(center(0), center(1), m_box.max(2)); -#endif // ENABLE_EXTENDED_SELECTION ::memcpy((void*)m_grabbers[4].color, (const void*)&AXES_COLOR[2], 3 * sizeof(float)); ::memcpy((void*)m_grabbers[5].color, (const void*)&AXES_COLOR[2], 3 * sizeof(float)); // uniform -#if ENABLE_EXTENDED_SELECTION m_grabbers[6].center = transform * Vec3d(m_box.min(0), m_box.min(1), center(2)) - offset_x - offset_y; m_grabbers[7].center = transform * Vec3d(m_box.max(0), m_box.min(1), center(2)) + offset_x - offset_y; m_grabbers[8].center = transform * Vec3d(m_box.max(0), m_box.max(1), center(2)) + offset_x + offset_y; m_grabbers[9].center = transform * Vec3d(m_box.min(0), m_box.max(1), center(2)) - offset_x + offset_y; -#else - m_grabbers[6].center = Vec3d(m_box.min(0), m_box.min(1), center(2)); - m_grabbers[7].center = Vec3d(m_box.max(0), m_box.min(1), center(2)); - m_grabbers[8].center = Vec3d(m_box.max(0), m_box.max(1), center(2)); - m_grabbers[9].center = Vec3d(m_box.min(0), m_box.max(1), center(2)); -#endif // ENABLE_EXTENDED_SELECTION for (int i = 6; i < 10; ++i) { ::memcpy((void*)m_grabbers[i].color, (const void*)m_highlight_color, 3 * sizeof(float)); } -#if ENABLE_EXTENDED_SELECTION // sets grabbers orientation for (int i = 0; i < 10; ++i) { m_grabbers[i].angles = angles; } -#endif // ENABLE_EXTENDED_SELECTION ::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f); @@ -1084,21 +882,12 @@ void GLGizmoScale3D::on_render(const BoundingBoxf3& box) const } } -#if ENABLE_EXTENDED_SELECTION void GLGizmoScale3D::on_render_for_picking(const GLCanvas3D::Selection& selection) const { ::glDisable(GL_DEPTH_TEST); render_grabbers_for_picking(selection.get_bounding_box()); } -#else -void GLGizmoScale3D::on_render_for_picking(const BoundingBoxf3& box) const -{ - ::glDisable(GL_DEPTH_TEST); - - render_grabbers_for_picking(box); -} -#endif // ENABLE_EXTENDED_SELECTION void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int id_2) const { @@ -1114,11 +903,7 @@ void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int void GLGizmoScale3D::do_scale_x(const Linef3& mouse_ray) { -#if ENABLE_EXTENDED_SELECTION double ratio = calc_ratio(mouse_ray); -#else - double ratio = calc_ratio(1, mouse_ray, m_starting_box.center()); -#endif // ENABLE_EXTENDED_SELECTION if (ratio > 0.0) m_scale(0) = m_starting_scale(0) * ratio; @@ -1126,11 +911,7 @@ void GLGizmoScale3D::do_scale_x(const Linef3& mouse_ray) void GLGizmoScale3D::do_scale_y(const Linef3& mouse_ray) { -#if ENABLE_EXTENDED_SELECTION double ratio = calc_ratio(mouse_ray); -#else - double ratio = calc_ratio(2, mouse_ray, m_starting_box.center()); -#endif // ENABLE_EXTENDED_SELECTION if (ratio > 0.0) m_scale(1) = m_starting_scale(1) * ratio; @@ -1138,11 +919,7 @@ void GLGizmoScale3D::do_scale_y(const Linef3& mouse_ray) void GLGizmoScale3D::do_scale_z(const Linef3& mouse_ray) { -#if ENABLE_EXTENDED_SELECTION double ratio = calc_ratio(mouse_ray); -#else - double ratio = calc_ratio(1, mouse_ray, m_starting_box.center()); -#endif // ENABLE_EXTENDED_SELECTION if (ratio > 0.0) m_scale(2) = m_starting_scale(2) * ratio; @@ -1150,19 +927,12 @@ void GLGizmoScale3D::do_scale_z(const Linef3& mouse_ray) void GLGizmoScale3D::do_scale_uniform(const Linef3& mouse_ray) { -#if ENABLE_EXTENDED_SELECTION double ratio = calc_ratio(mouse_ray); -#else - Vec3d center = m_starting_box.center(); - center(2) = m_box.min(2); - double ratio = calc_ratio(0, mouse_ray, center); -#endif // ENABLE_EXTENDED_SELECTION if (ratio > 0.0) m_scale = m_starting_scale * ratio; } -#if ENABLE_EXTENDED_SELECTION double GLGizmoScale3D::calc_ratio(const Linef3& mouse_ray) const { double ratio = 0.0; @@ -1189,53 +959,12 @@ double GLGizmoScale3D::calc_ratio(const Linef3& mouse_ray) const return ratio; } -#else -double GLGizmoScale3D::calc_ratio(unsigned int preferred_plane_id, const Linef3& mouse_ray, const Vec3d& center) const -{ - double ratio = 0.0; - - Vec3d starting_vec = m_starting_drag_position - center; - double len_starting_vec = starting_vec.norm(); - if (len_starting_vec == 0.0) - return ratio; - - Vec3d starting_vec_dir = starting_vec.normalized(); - Vec3d mouse_dir = mouse_ray.unit_vector(); - - unsigned int plane_id = select_best_plane(mouse_dir, preferred_plane_id); - // ratio is given by the projection of the calculated intersection on the starting vector divided by the starting vector length - switch (plane_id) - { - case 0: - { - ratio = starting_vec_dir.dot(intersection_on_plane_xy(mouse_ray, center)) / len_starting_vec; - break; - } - case 1: - { - ratio = starting_vec_dir.dot(intersection_on_plane_xz(mouse_ray, center)) / len_starting_vec; - break; - } - case 2: - { - ratio = starting_vec_dir.dot(intersection_on_plane_yz(mouse_ray, center)) / len_starting_vec; - break; - } - } - - return ratio; -} -#endif // ENABLE_EXTENDED_SELECTION const double GLGizmoMove3D::Offset = 10.0; GLGizmoMove3D::GLGizmoMove3D(GLCanvas3D& parent) : GLGizmoBase(parent) -#if ENABLE_EXTENDED_SELECTION , m_displacement(Vec3d::Zero()) -#else - , m_position(Vec3d::Zero()) -#endif // ENABLE_EXTENDED_SELECTION , m_starting_drag_position(Vec3d::Zero()) , m_starting_box_center(Vec3d::Zero()) , m_starting_box_bottom_center(Vec3d::Zero()) @@ -1271,18 +1000,12 @@ std::string GLGizmoMove3D::on_get_name() const return L("Move"); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoMove3D::on_start_dragging(const GLCanvas3D::Selection& selection) -#else -void GLGizmoMove3D::on_start_dragging(const BoundingBoxf3& box) -#endif // ENABLE_EXTENDED_SELECTION { if (m_hover_id != -1) { -#if ENABLE_EXTENDED_SELECTION m_displacement = Vec3d::Zero(); const BoundingBoxf3& box = selection.get_bounding_box(); -#endif // ENABLE_EXTENDED_SELECTION m_starting_drag_position = m_grabbers[m_hover_id].center; m_starting_box_center = box.center(); m_starting_box_bottom_center = box.center(); @@ -1290,39 +1013,23 @@ void GLGizmoMove3D::on_start_dragging(const BoundingBoxf3& box) } } -#if ENABLE_EXTENDED_SELECTION void GLGizmoMove3D::on_stop_dragging() { m_displacement = Vec3d::Zero(); } -#endif // ENABLE_EXTENDED_SELECTION void GLGizmoMove3D::on_update(const Linef3& mouse_ray, const Point* mouse_pos) { -#if ENABLE_EXTENDED_SELECTION if (m_hover_id == 0) m_displacement(0) = calc_projection(mouse_ray); else if (m_hover_id == 1) m_displacement(1) = calc_projection(mouse_ray); else if (m_hover_id == 2) m_displacement(2) = calc_projection(mouse_ray); -#else - if (m_hover_id == 0) - m_position(0) = 2.0 * m_starting_box_center(0) + calc_projection(X, 1, mouse_ray) - m_starting_drag_position(0); - else if (m_hover_id == 1) - m_position(1) = 2.0 * m_starting_box_center(1) + calc_projection(Y, 2, mouse_ray) - m_starting_drag_position(1); - else if (m_hover_id == 2) - m_position(2) = 2.0 * m_starting_box_bottom_center(2) + calc_projection(Z, 1, mouse_ray) - m_starting_drag_position(2); -#endif // ENABLE_EXTENDED_SELECTION } -#if ENABLE_EXTENDED_SELECTION void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { -#if ENABLE_EXTENDED_SELECTION bool show_position = selection.is_single_full_instance(); const Vec3d& position = selection.get_bounding_box().center(); @@ -1332,20 +1039,10 @@ void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const set_tooltip("Y: " + format(show_position ? position(1) : m_displacement(1), 2)); else if ((show_position && (m_hover_id == 2)) || m_grabbers[2].dragging) set_tooltip("Z: " + format(show_position ? position(2) : m_displacement(2), 2)); -#else - if (m_grabbers[0].dragging) - set_tooltip("X: " + format(m_position(0), 2)); - else if (m_grabbers[1].dragging) - set_tooltip("Y: " + format(m_position(1), 2)); - else if (m_grabbers[2].dragging) - set_tooltip("Z: " + format(m_position(2), 2)); -#endif // ENABLE_EXTENDED_SELECTION ::glEnable(GL_DEPTH_TEST); -#if ENABLE_EXTENDED_SELECTION const BoundingBoxf3& box = selection.get_bounding_box(); -#endif // ENABLE_EXTENDED_SELECTION const Vec3d& center = box.center(); // x axis @@ -1394,23 +1091,13 @@ void GLGizmoMove3D::on_render(const BoundingBoxf3& box) const } } -#if ENABLE_EXTENDED_SELECTION void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection) const { ::glDisable(GL_DEPTH_TEST); render_grabbers_for_picking(selection.get_bounding_box()); } -#else -void GLGizmoMove3D::on_render_for_picking(const BoundingBoxf3& box) const -{ - ::glDisable(GL_DEPTH_TEST); - render_grabbers_for_picking(box); -} -#endif // ENABLE_EXTENDED_SELECTION - -#if ENABLE_EXTENDED_SELECTION double GLGizmoMove3D::calc_projection(const Linef3& mouse_ray) const { double projection = 0.0; @@ -1433,43 +1120,6 @@ double GLGizmoMove3D::calc_projection(const Linef3& mouse_ray) const } return projection; } -#else -double GLGizmoMove3D::calc_projection(Axis axis, unsigned int preferred_plane_id, const Linef3& mouse_ray) const -{ - double projection = 0.0; - - Vec3d starting_vec = (axis == Z) ? m_starting_drag_position - m_starting_box_bottom_center : m_starting_drag_position - m_starting_box_center; - double len_starting_vec = starting_vec.norm(); - if (len_starting_vec == 0.0) - return projection; - - Vec3d starting_vec_dir = starting_vec.normalized(); - Vec3d mouse_dir = mouse_ray.unit_vector(); - - unsigned int plane_id = select_best_plane(mouse_dir, preferred_plane_id); - - switch (plane_id) - { - case 0: - { - projection = starting_vec_dir.dot(intersection_on_plane_xy(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center)); - break; - } - case 1: - { - projection = starting_vec_dir.dot(intersection_on_plane_xz(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center)); - break; - } - case 2: - { - projection = starting_vec_dir.dot(intersection_on_plane_yz(mouse_ray, (axis == Z) ? m_starting_box_bottom_center : m_starting_box_center)); - break; - } - } - - return projection; -} -#endif // ENABLE_EXTENDED_SELECTION GLGizmoFlatten::GLGizmoFlatten(GLCanvas3D& parent) : GLGizmoBase(parent) @@ -1502,42 +1152,24 @@ std::string GLGizmoFlatten::on_get_name() const return L("Flatten"); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoFlatten::on_start_dragging(const GLCanvas3D::Selection& selection) -#else -void GLGizmoFlatten::on_start_dragging(const BoundingBoxf3& box) -#endif // ENABLE_EXTENDED_SELECTION { if (m_hover_id != -1) { m_normal = m_planes[m_hover_id].normal; -#if ENABLE_EXTENDED_SELECTION m_starting_center = selection.get_bounding_box().center(); -#else - m_starting_center = box.center(); -#endif // ENABLE_EXTENDED_SELECTION } } -#if ENABLE_EXTENDED_SELECTION void GLGizmoFlatten::on_render(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { // the dragged_offset is a vector measuring where was the object moved // with the gizmo being on. This is reset in set_flattening_data and // does not work correctly when there are multiple copies. Vec3d dragged_offset(Vec3d::Zero()); -#if ENABLE_EXTENDED_SELECTION if (m_starting_center == Vec3d::Zero()) m_starting_center = selection.get_bounding_box().center(); dragged_offset = selection.get_bounding_box().center() - m_starting_center; -#else - if (m_starting_center == Vec3d::Zero()) - m_starting_center = box.center(); - dragged_offset = box.center() - m_starting_center; -#endif // ENABLE_EXTENDED_SELECTION ::glEnable(GL_BLEND); ::glEnable(GL_DEPTH_TEST); @@ -1549,7 +1181,6 @@ void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const else ::glColor4f(0.9f, 0.9f, 0.9f, 0.5f); -#if ENABLE_EXTENDED_SELECTION int instance_idx = selection.get_instance_idx(); if ((instance_idx != -1) && (m_model_object != nullptr)) { @@ -1565,30 +1196,13 @@ void GLGizmoFlatten::on_render(const BoundingBoxf3& box) const ::glEnd(); ::glPopMatrix(); } -#else - for (const InstanceData& inst : m_instances) { - Transform3d m = inst.matrix; - m.pretranslate(dragged_offset); - ::glPushMatrix(); - ::glMultMatrixd(m.data()); - ::glBegin(GL_POLYGON); - for (const Vec3d& vertex : m_planes[i].vertices) - ::glVertex3dv(vertex.data()); - ::glEnd(); - ::glPopMatrix(); - } -#endif // ENABLE_EXTENDED_SELECTION } ::glEnable(GL_CULL_FACE); ::glDisable(GL_BLEND); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoFlatten::on_render_for_picking(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const -#endif // ENABLE_EXTENDED_SELECTION { ::glEnable(GL_DEPTH_TEST); ::glDisable(GL_CULL_FACE); @@ -1596,7 +1210,6 @@ void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const for (unsigned int i = 0; i < m_planes.size(); ++i) { ::glColor3f(1.0f, 1.0f, picking_color_component(i)); -#if ENABLE_EXTENDED_SELECTION int instance_idx = selection.get_instance_idx(); if ((instance_idx != -1) && (m_model_object != nullptr)) { @@ -1610,17 +1223,6 @@ void GLGizmoFlatten::on_render_for_picking(const BoundingBoxf3& box) const ::glEnd(); ::glPopMatrix(); } -#else - for (const InstanceData& inst : m_instances) { - ::glPushMatrix(); - ::glMultMatrixd(inst.matrix.data()); - ::glBegin(GL_POLYGON); - for (const Vec3d& vertex : m_planes[i].vertices) - ::glVertex3dv(vertex.data()); - ::glEnd(); - ::glPopMatrix(); - } -#endif // ENABLE_EXTENDED_SELECTION } ::glEnable(GL_CULL_FACE); @@ -1631,15 +1233,6 @@ void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object) m_starting_center = Vec3d::Zero(); m_model_object = model_object; -#if !ENABLE_EXTENDED_SELECTION - // ...and save the updated positions of the object instances: - if (m_model_object && !m_model_object->instances.empty()) { - m_instances.clear(); - for (const auto* instance : m_model_object->instances) - m_instances.emplace_back(instance->world_matrix()); - } -#endif // !ENABLE_EXTENDED_SELECTION - if (is_plane_update_necessary()) update_planes(); } @@ -1890,11 +1483,7 @@ void GLGizmoSlaSupports::set_model_object_ptr(ModelObject* model_object) update_mesh(); } -#if ENABLE_EXTENDED_SELECTION void GLGizmoSlaSupports::on_render(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const -#endif { ::glEnable(GL_BLEND); ::glEnable(GL_DEPTH_TEST); @@ -1903,15 +1492,9 @@ void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const // with the gizmo being on. This is reset in set_flattening_data and // does not work correctly when there are multiple copies. -#if ENABLE_EXTENDED_SELECTION if (m_starting_center == Vec3d::Zero()) m_starting_center = selection.get_bounding_box().center(); Vec3d dragged_offset = selection.get_bounding_box().center() - m_starting_center; -#else - if (m_starting_center == Vec3d::Zero()) - m_starting_center = box.center(); - Vec3d dragged_offset(box.center() - m_starting_center); -#endif // ENABLE_EXTENDED_SELECTION for (auto& g : m_grabbers) { g.color[0] = 1.f; @@ -1929,11 +1512,7 @@ void GLGizmoSlaSupports::on_render(const BoundingBoxf3& box) const } -#if ENABLE_EXTENDED_SELECTION void GLGizmoSlaSupports::on_render_for_picking(const GLCanvas3D::Selection& selection) const -#else -void GLGizmoSlaSupports::on_render_for_picking(const BoundingBoxf3& box) const -#endif { ::glEnable(GL_DEPTH_TEST); for (unsigned int i=0; i m_planes; -#if !ENABLE_EXTENDED_SELECTION - struct InstanceData - { - Transform3d matrix; - InstanceData(const Transform3d& matrix) : matrix(matrix) {} - }; - std::vector m_instances; -#endif // !ENABLE_EXTENDED_SELECTION mutable Vec3d m_starting_center; const ModelObject* m_model_object = nullptr; @@ -463,22 +361,11 @@ public: protected: virtual bool on_init(); virtual std::string on_get_name() const; -#if ENABLE_EXTENDED_SELECTION virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return selection.is_single_full_instance(); } -#endif // ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION virtual void on_start_dragging(const GLCanvas3D::Selection& selection); -#else - virtual void on_start_dragging(const BoundingBoxf3& box); -#endif // ENABLE_EXTENDED_SELECTION virtual void on_update(const Linef3& mouse_ray, const Point* mouse_pos) {} -#if ENABLE_EXTENDED_SELECTION virtual void on_render(const GLCanvas3D::Selection& selection) const; virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; -#else - virtual void on_render(const BoundingBoxf3& box) const; - virtual void on_render_for_picking(const BoundingBoxf3& box) const; -#endif // ENABLE_EXTENDED_SELECTION virtual void on_set_state() { if (m_state == On && is_plane_update_necessary()) @@ -515,13 +402,8 @@ public: private: bool on_init(); void on_update(const Linef3& mouse_ray, const Point* mouse_pos); -#if ENABLE_EXTENDED_SELECTION virtual void on_render(const GLCanvas3D::Selection& selection) const; virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; -#else - virtual void on_render(const BoundingBoxf3& box) const; - virtual void on_render_for_picking(const BoundingBoxf3& box) const; -#endif // ENABLE_EXTENDED_SELECTION void render_grabbers(bool picking = false) const; void render_tooltip_texture() const; diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 265fc2042..26ca4a4dc 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -25,13 +25,7 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_FEWER, SimpleEvent); wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT_OBJECTS, SimpleEvent); wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT_VOLUMES, SimpleEvent); wxDEFINE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDEFINE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDEFINE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDEFINE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION GLToolbarItem::Data::Data() diff --git a/src/slic3r/GUI/GLToolbar.hpp b/src/slic3r/GUI/GLToolbar.hpp index 9f3853530..6669bc966 100644 --- a/src/slic3r/GUI/GLToolbar.hpp +++ b/src/slic3r/GUI/GLToolbar.hpp @@ -25,13 +25,7 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_FEWER, SimpleEvent); wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT_OBJECTS, SimpleEvent); wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT_VOLUMES, SimpleEvent); wxDECLARE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDECLARE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION wxDECLARE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent); -#if !ENABLE_EXTENDED_SELECTION -wxDECLARE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent); -#endif // !ENABLE_EXTENDED_SELECTION class GLToolbarItem { diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 243da5136..1c3150ce5 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -960,10 +960,8 @@ void ObjectList::split(const bool split_part) m_parts_changed = true; parts_changed(m_selected_object_id); -#if ENABLE_EXTENDED_SELECTION // restores selection _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection().add_object(m_selected_object_id); -#endif // ENABLE_EXTENDED_SELECTION } bool ObjectList::get_volume_by_item(const bool split_part, const wxDataViewItem& item, ModelVolume*& volume) @@ -1071,11 +1069,7 @@ void ObjectList::part_selection_changed() m_selected_object_id = obj_idx; -#if ENABLE_EXTENDED_SELECTION wxGetApp().obj_manipul()->update_settings_value(_3DScene::get_canvas(wxGetApp().canvas3D())->get_selection()); -#else - wxGetApp().obj_manipul()->update_values(); -#endif // ENABLE_EXTENDED_SELECTION } void ObjectList::update_manipulation_sizer(const bool is_simple_mode) @@ -1094,9 +1088,6 @@ void ObjectList::add_object_to_list(size_t obj_idx) auto model_object = (*m_objects)[obj_idx]; wxString item_name = model_object->name; auto item = m_objects_model->Add(item_name); -#if !ENABLE_EXTENDED_SELECTION - /*Select*/select_item(item); -#endif // !ENABLE_EXTENDED_SELECTION // Add error icon if detected auto-repaire auto stats = model_object->volumes[0]->mesh.stl.stats; @@ -1224,7 +1215,6 @@ bool ObjectList::multiple_selection() const void ObjectList::update_selections() { -#if ENABLE_EXTENDED_SELECTION auto& selection = _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection(); wxDataViewItemArray sels; @@ -1234,13 +1224,10 @@ void ObjectList::update_selections() sels.Add(m_objects_model->GetItemByVolumeId(gl_vol->object_idx(), gl_vol->volume_idx())); } select_items(sels); - -#endif // ENABLE_EXTENDED_SELECTION } void ObjectList::update_selections_on_canvas() { -#if ENABLE_EXTENDED_SELECTION auto& selection = _3DScene::get_canvas(wxGetApp().canvas3D())->get_selection(); const int sel_cnt = GetSelectedItemsCount(); @@ -1288,8 +1275,6 @@ void ObjectList::update_selections_on_canvas() add_to_selection(item, selection, false); _3DScene::render(wxGetApp().canvas3D()); - -#endif // ENABLE_EXTENDED_SELECTION } void ObjectList::select_item(const wxDataViewItem& item) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 78031cf30..8cb7944f6 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -266,7 +266,6 @@ void ObjectManipulation::update_settings_list() parent->GetParent()->Layout(); } -#if ENABLE_EXTENDED_SELECTION void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& selection) { if (selection.is_single_full_object()) @@ -344,7 +343,6 @@ void ObjectManipulation::reset_scale_value() m_og->set_value("scale_y", 100); m_og->set_value("scale_z", 100); } -#endif // ENABLE_EXTENDED_SELECTION void ObjectManipulation::update_values() { diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp index 13b9290a0..4192041cd 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp @@ -6,9 +6,7 @@ #include #include "Preset.hpp" -#if ENABLE_EXTENDED_SELECTION #include "GLCanvas3D.hpp" -#endif // ENABLE_EXTENDED_SELECTION class wxBoxSizer; @@ -16,7 +14,6 @@ namespace Slic3r { namespace GUI { class ConfigOptionsGroup; - class OG_Settings { protected: @@ -47,13 +44,11 @@ public: int ol_selection(); void update_settings_list(); -#if ENABLE_EXTENDED_SELECTION void update_settings_value(const GLCanvas3D::Selection& selection); void reset_settings_value(); void reset_position_value(); void reset_rotation_value(); void reset_scale_value(); -#endif // ENABLE_EXTENDED_SELECTION void update_values(); // update position values displacements or "gizmos" diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1c21a27ca..828e43952 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -754,18 +754,6 @@ std::vector& Sidebar::combos_filament() return p->combos_filament; } -#if !ENABLE_EXTENDED_SELECTION -// Plater::Object - -struct PlaterObject -{ - std::string name; - bool selected; - - PlaterObject(std::string name) : name(std::move(name)), selected(false) {} -}; -#endif // !ENABLE_EXTENDED_SELECTION - // Plater::DropTarget class PlaterDropTarget : public wxFileDropTarget @@ -817,9 +805,6 @@ struct Plater::priv Slic3r::Print print; Slic3r::Model model; Slic3r::GCodePreviewData gcode_preview_data; -#if !ENABLE_EXTENDED_SELECTION - std::vector objects; -#endif // !ENABLE_EXTENDED_SELECTION // GUI elements wxNotebook *notebook; @@ -835,9 +820,6 @@ struct Plater::priv priv(Plater *q, MainFrame *main_frame); -#if !ENABLE_EXTENDED_SELECTION - std::vector collect_selections(); -#endif // !ENABLE_EXTENDED_SELECTION void update(bool force_autocenter = false); void select_view(const std::string& direction); void update_ui_from_settings(); @@ -849,30 +831,15 @@ struct Plater::priv std::vector load_model_objects(const ModelObjectPtrs &model_objects); std::unique_ptr get_export_file(GUI::FileType file_type); -#if ENABLE_EXTENDED_SELECTION const GLCanvas3D::Selection& get_selection() const; GLCanvas3D::Selection& get_selection(); int get_selected_object_idx() const; -#else - void select_object(optional obj_idx); - void select_object_from_cpp(); - optional selected_object() const; -#endif // ENABLE_EXTENDED_SELECTION void selection_changed(); void object_list_changed(); -#if !ENABLE_EXTENDED_SELECTION - void select_view(); -#endif // !ENABLE_EXTENDED_SELECTION void remove(size_t obj_idx); void reset(); -#if !ENABLE_EXTENDED_SELECTION - void rotate(); -#endif // !ENABLE_EXTENDED_SELECTION void mirror(Axis axis); -#if !ENABLE_EXTENDED_SELECTION - void scale(); -#endif // !ENABLE_EXTENDED_SELECTION void arrange(); void split_object(); void split_volume(); @@ -896,25 +863,12 @@ struct Plater::priv void on_action_split_objects(SimpleEvent&); void on_action_split_volumes(SimpleEvent&); void on_action_cut(SimpleEvent&); -#if !ENABLE_EXTENDED_SELECTION - void on_action_settings(SimpleEvent&); -#endif // !ENABLE_EXTENDED_SELECTION void on_action_layersediting(SimpleEvent&); -#if !ENABLE_EXTENDED_SELECTION - void on_action_selectbyparts(SimpleEvent&); -#endif // !ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION void on_object_select(SimpleEvent&); -#else - void on_object_select(ObjectSelectEvent&); -#endif // ENABLE_EXTENDED_SELECTION void on_viewport_changed(SimpleEvent&); void on_right_click(Vec2dEvent&); void on_model_update(SimpleEvent&); -#if !ENABLE_EXTENDED_SELECTION - void on_scale_uniformly(SimpleEvent&); -#endif // !ENABLE_EXTENDED_SELECTION void on_wipetower_moved(Vec3dEvent&); void on_enable_action_buttons(Event&); void on_update_geometry(Vec3dsEvent<2>&); @@ -922,7 +876,6 @@ struct Plater::priv private: bool init_object_menu(); -#if ENABLE_EXTENDED_SELECTION bool can_delete_object() const; bool can_increase_instances() const; bool can_decrease_instances() const; @@ -933,7 +886,6 @@ private: bool can_delete_all() const; bool can_arrange() const; bool can_mirror() const; -#endif // ENABLE_EXTENDED_SELECTION }; const std::regex Plater::priv::pattern_bundle(".*[.](amf|amf[.]xml|zip[.]amf|3mf|prusa)", std::regex::icase); @@ -976,10 +928,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) : _3DScene::enable_picking(canvas3D, true); _3DScene::enable_moving(canvas3D, true); // XXX: more config from 3D.pm -#if !ENABLE_EXTENDED_SELECTION - _3DScene::set_select_by(canvas3D, "object"); - _3DScene::set_drag_by(canvas3D, "instance"); -#endif // !ENABLE_EXTENDED_SELECTION _3DScene::set_model(canvas3D, &model); _3DScene::set_print(canvas3D, &print); _3DScene::set_config(canvas3D, config); @@ -1017,17 +965,10 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) : canvas3D->Bind(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, &priv::on_schedule_background_process, this); canvas3D->Bind(EVT_GLCANVAS_OBJECT_SELECT, &priv::on_object_select, this); canvas3D->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this); -#if !ENABLE_EXTENDED_SELECTION - canvas3D->Bind(EVT_GLCANVAS_DOUBLE_CLICK, [](SimpleEvent&) {}); // XXX: remove? -#endif // !ENABLE_EXTENDED_SELECTION canvas3D->Bind(EVT_GLCANVAS_RIGHT_CLICK, &priv::on_right_click, this); canvas3D->Bind(EVT_GLCANVAS_MODEL_UPDATE, &priv::on_model_update, this); canvas3D->Bind(EVT_GLCANVAS_REMOVE_OBJECT, [q](SimpleEvent&) { q->remove_selected(); }); canvas3D->Bind(EVT_GLCANVAS_ARRANGE, [this](SimpleEvent&) { arrange(); }); -#if !ENABLE_EXTENDED_SELECTION - canvas3D->Bind(EVT_GLCANVAS_ROTATE_OBJECT, [this](Event &evt) { /*TODO: call rotate */ }); - canvas3D->Bind(EVT_GLCANVAS_SCALE_UNIFORMLY, [this](SimpleEvent&) { this->scale(); }); -#endif // !ENABLE_EXTENDED_SELECTION canvas3D->Bind(EVT_GLCANVAS_INCREASE_INSTANCES, [q](Event &evt) { evt.data == 1 ? q->increase_instances() : q->decrease_instances(); }); canvas3D->Bind(EVT_GLCANVAS_INSTANCE_MOVED, [this](SimpleEvent&) { update(); }); canvas3D->Bind(EVT_GLCANVAS_WIPETOWER_MOVED, &priv::on_wipetower_moved, this); @@ -1043,13 +984,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) : canvas3D->Bind(EVT_GLTOOLBAR_SPLIT_OBJECTS, &priv::on_action_split_objects, this); canvas3D->Bind(EVT_GLTOOLBAR_SPLIT_VOLUMES, &priv::on_action_split_volumes, this); canvas3D->Bind(EVT_GLTOOLBAR_CUT, &priv::on_action_cut, this); -#if !ENABLE_EXTENDED_SELECTION - canvas3D->Bind(EVT_GLTOOLBAR_SETTINGS, &priv::on_action_settings, this); -#endif // !ENABLE_EXTENDED_SELECTION canvas3D->Bind(EVT_GLTOOLBAR_LAYERSEDITING, &priv::on_action_layersediting, this); -#if !ENABLE_EXTENDED_SELECTION - canvas3D->Bind(EVT_GLTOOLBAR_SELECTBYPARTS, &priv::on_action_selectbyparts, this); -#endif // !ENABLE_EXTENDED_SELECTION // Preview events: preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_VIEWPORT_CHANGED, &priv::on_viewport_changed, this); @@ -1064,17 +999,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) : q->Layout(); } -#if !ENABLE_EXTENDED_SELECTION -std::vector Plater::priv::collect_selections() -{ - std::vector res; - for (const auto &obj : objects) { - res.push_back(obj.selected); - } - return res; -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::update(bool force_autocenter) { wxWindowUpdateLocker freeze_guard(q); @@ -1086,10 +1010,6 @@ void Plater::priv::update(bool force_autocenter) model.center_instances_around_point(bed_center); } -#if !ENABLE_EXTENDED_SELECTION - const auto selections = collect_selections(); - _3DScene::set_objects_selections(canvas3D, selections); -#endif // !ENABLE_EXTENDED_SELECTION _3DScene::reload_scene(canvas3D, false); preview->reset_gcode_preview_data(); preview->reload_print(); @@ -1261,19 +1181,12 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs &mode bool need_arrange = false; bool scaled_down = false; std::vector obj_idxs; -#if ENABLE_EXTENDED_SELECTION unsigned int obj_count = model.objects.size(); -#endif // ENABLE_EXTENDED_SELECTION for (ModelObject *model_object : model_objects) { auto *object = model.add_object(*model_object); std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name; -#if ENABLE_EXTENDED_SELECTION obj_idxs.push_back(obj_count++); -#else - objects.emplace_back(std::move(object_name)); - obj_idxs.push_back(objects.size() - 1); -#endif // ENABLE_EXTENDED_SELECTION if (model_object->instances.empty()) { // if object has no defined position(s) we need to rearrange everything after loading @@ -1385,7 +1298,6 @@ std::unique_ptr Plater::priv::get_export_file(GUI::FileType return dlg; } -#if ENABLE_EXTENDED_SELECTION const GLCanvas3D::Selection& Plater::priv::get_selection() const { return _3DScene::get_canvas(canvas3D)->get_selection(); @@ -1401,43 +1313,9 @@ int Plater::priv::get_selected_object_idx() const int idx = get_selection().get_object_idx(); return ((0 <= idx) && (idx < 1000)) ? idx : -1; } -#else -void Plater::priv::select_object(optional obj_idx) -{ - for (auto &obj : objects) { - obj.selected = false; - } - - if (obj_idx) { - objects[*obj_idx].selected = true; - } - - selection_changed(); -} - -void Plater::priv::select_object_from_cpp() -{ - // TODO -} - -optional Plater::priv::selected_object() const -{ - for (size_t i = 0; i < objects.size(); i++) { - if (objects[i].selected) { return i; } - } - - return boost::none; -} -#endif // ENABLE_EXTENDED_SELECTION void Plater::priv::selection_changed() { -#if !ENABLE_EXTENDED_SELECTION - const auto obj_idx = selected_object(); - const bool have_sel = !!obj_idx; -#endif // !ENABLE_EXTENDED_SELECTION - -#if ENABLE_EXTENDED_SELECTION _3DScene::enable_toolbar_item(canvas3D, "delete", can_delete_object()); _3DScene::enable_toolbar_item(canvas3D, "more", can_increase_instances()); _3DScene::enable_toolbar_item(canvas3D, "fewer", can_decrease_instances()); @@ -1447,45 +1325,13 @@ void Plater::priv::selection_changed() _3DScene::enable_toolbar_item(canvas3D, "layersediting", layers_height_allowed()); // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) _3DScene::render(canvas3D); -#else - _3DScene::enable_toolbar_item(canvas3D, "fewer", have_sel); - _3DScene::enable_toolbar_item(canvas3D, "splitobjects", have_sel); - _3DScene::enable_toolbar_item(canvas3D, "splitvolumes", have_sel); - _3DScene::enable_toolbar_item(canvas3D, "cut", have_sel); - _3DScene::enable_toolbar_item(canvas3D, "settings", have_sel); - _3DScene::enable_toolbar_item(canvas3D, "layersediting", have_sel && config->opt_bool("variable_layer_height") && _3DScene::is_layers_editing_allowed(canvas3D)); -#endif // ENABLE_EXTENDED_SELECTION -#if ENABLE_EXTENDED_SELECTION int obj_idx = get_selected_object_idx(); bool have_sel = (obj_idx != -1); -#else - bool can_select_by_parts = false; - - if (have_sel) { - const auto *model_object = model.objects[*obj_idx]; - // XXX: ? - can_select_by_parts = *obj_idx < 1000 && model_object->volumes.size() > 1; - _3DScene::enable_toolbar_item(canvas3D, "fewer", model_object->instances.size() > 1); - } - - if (can_select_by_parts) { - // first disable to let the item in the toolbar to switch to the unpressed state // XXX: ? - _3DScene::enable_toolbar_item(canvas3D, "selectbyparts", false); - _3DScene::enable_toolbar_item(canvas3D, "selectbyparts", true); - } else { - _3DScene::enable_toolbar_item(canvas3D, "selectbyparts", false); - _3DScene::set_select_by(canvas3D, "object"); - } -#endif // ENABLE_EXTENDED_SELECTION wxWindowUpdateLocker freeze_guard(sidebar); if (have_sel) { -#if ENABLE_EXTENDED_SELECTION const ModelObject* model_object = model.objects[obj_idx]; -#else - const auto *model_object = model.objects[*obj_idx]; -#endif // ENABLE_EXTENDED_SELECTION // FIXME print_info runs model fixing in two rounds, it is very slow, it should not be performed here! // # $model_object->print_info; @@ -1531,33 +1377,16 @@ void Plater::priv::selection_changed() void Plater::priv::object_list_changed() { // Enable/disable buttons depending on whether there are any objects on the platter. -#if ENABLE_EXTENDED_SELECTION _3DScene::enable_toolbar_item(canvas3D, "deleteall", can_delete_all()); _3DScene::enable_toolbar_item(canvas3D, "arrange", can_arrange()); -#else - const bool have_objects = !objects.empty(); - _3DScene::enable_toolbar_item(canvas3D, "deleteall", have_objects); - _3DScene::enable_toolbar_item(canvas3D, "arrange", have_objects); -#endif // ENABLE_EXTENDED_SELECTION const bool export_in_progress = this->background_process.is_export_scheduled(); // || ! send_gcode_file.empty()); // XXX: is this right? const bool model_fits = _3DScene::check_volumes_outside_state(canvas3D, config) == ModelInstance::PVS_Inside; -#if ENABLE_EXTENDED_SELECTION sidebar->enable_buttons(!model.objects.empty() && !export_in_progress && model_fits); -#else - sidebar->enable_buttons(have_objects && !export_in_progress && model_fits); -#endif // ENABLE_EXTENDED_SELECTION } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::select_view() -{ - // TODO -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::remove(size_t obj_idx) { // Prevent toolpaths preview from rendering while we modify the Print object @@ -1566,19 +1395,12 @@ void Plater::priv::remove(size_t obj_idx) if (_3DScene::is_layers_editing_enabled(canvas3D)) _3DScene::enable_layers_editing(canvas3D, false); -#if !ENABLE_EXTENDED_SELECTION - objects.erase(objects.begin() + obj_idx); -#endif // !ENABLE_EXTENDED_SELECTION model.delete_object(obj_idx); // print.delete_object(obj_idx); // Delete object from Sidebar list sidebar->obj_list()->delete_object_from_list(obj_idx); object_list_changed(); - -#if !ENABLE_EXTENDED_SELECTION - select_object(boost::none); -#endif // !ENABLE_EXTENDED_SELECTION update(); } @@ -1590,43 +1412,20 @@ void Plater::priv::reset() if (_3DScene::is_layers_editing_enabled(canvas3D)) _3DScene::enable_layers_editing(canvas3D, false); -#if !ENABLE_EXTENDED_SELECTION - objects.clear(); -#endif // !ENABLE_EXTENDED_SELECTION model.clear_objects(); // print.clear_objects(); // Delete all objects from list on c++ side sidebar->obj_list()->delete_all_objects_from_list(); object_list_changed(); - -#if !ENABLE_EXTENDED_SELECTION - select_object(boost::none); -#endif // !ENABLE_EXTENDED_SELECTION update(); } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::rotate() -{ - // TODO -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::mirror(Axis axis) { -#if ENABLE_EXTENDED_SELECTION _3DScene::mirror_selection(canvas3D, axis); -#endif // ENABLE_EXTENDED_SELECTION } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::scale() -{ - // TODO -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::arrange() { main_frame->app_controller()->arrange_model(); @@ -1639,7 +1438,6 @@ void Plater::priv::arrange() void Plater::priv::split_object() { -#if ENABLE_EXTENDED_SELECTION int obj_idx = get_selected_object_idx(); if (obj_idx == -1) return; @@ -1683,7 +1481,6 @@ void Plater::priv::split_object() get_selection().add_object((unsigned int)idx, false); } } -#endif // ENABLE_EXTENDED_SELECTION } void Plater::priv::split_volume() @@ -1723,11 +1520,9 @@ void Plater::priv::async_apply_config() this->preview->reload_print(); // We also need to reload 3D scene because of the wipe tower preview box if (this->config->opt_bool("wipe_tower")) { -#if !ENABLE_EXTENDED_SELECTION - std::vector selections = this->collect_selections(); - Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections); - Slic3r::_3DScene::reload_scene(this->canvas3D, 1); -#endif /* !ENABLE_EXTENDED_SELECTION */ +// std::vector selections = this->collect_selections(); +// Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections); +// Slic3r::_3DScene::reload_scene(this->canvas3D, 1); } } if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->get_config("background_processing") == "1" && @@ -1801,9 +1596,6 @@ void Plater::priv::on_notebook_changed(wxBookCtrlEvent&) const auto current_id = notebook->GetCurrentPage()->GetId(); if (current_id == canvas3D->GetId()) { if (_3DScene::is_reload_delayed(canvas3D)) { -#if !ENABLE_EXTENDED_SELECTION - _3DScene::set_objects_selections(canvas3D, collect_selections()); -#endif // !ENABLE_EXTENDED_SELECTION _3DScene::reload_scene(canvas3D, true); } // sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably) @@ -1865,12 +1657,10 @@ void Plater::priv::on_update_print_preview(wxCommandEvent &) if (this->preview != nullptr) this->preview->reload_print(); // in case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth: -#if !ENABLE_EXTENDED_SELECTION - auto selections = collect_selections(); - _3DScene::set_objects_selections(canvas3D, selections); - if (canvas3D) - _3DScene::reload_scene(canvas3D, true); -#endif // !ENABLE_EXTENDED_SELECTION +// auto selections = collect_selections(); +// _3DScene::set_objects_selections(canvas3D, selections); +// if (canvas3D) +// _3DScene::reload_scene(canvas3D, true); } void Plater::priv::on_process_completed(wxCommandEvent &evt) @@ -1942,13 +1732,6 @@ void Plater::priv::on_action_cut(SimpleEvent&) // TODO } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::on_action_settings(SimpleEvent&) -{ - // TODO -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::on_action_layersediting(SimpleEvent&) { bool enable = !_3DScene::is_layers_editing_enabled(canvas3D); @@ -1957,31 +1740,11 @@ void Plater::priv::on_action_layersediting(SimpleEvent&) _3DScene::enable_toolbar_item(canvas3D, "layersediting", false); } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::on_action_selectbyparts(SimpleEvent&) -{ - // TODO -} -#endif // !ENABLE_EXTENDED_SELECTION - -#if ENABLE_EXTENDED_SELECTION void Plater::priv::on_object_select(SimpleEvent& evt) { selection_changed(); wxGetApp().obj_list()->update_selections(); } -#else -void Plater::priv::on_object_select(ObjectSelectEvent &evt) -{ - const auto obj_idx = evt.object_id(); - const auto vol_idx = evt.volume_id(); - - if (obj_idx >= 0 && obj_idx < 1000 && vol_idx == -1) { - // Ignore the special objects (the wipe tower proxy and such). - select_object(obj_idx); -} -} -#endif // ENABLE_EXTENDED_SELECTION void Plater::priv::on_viewport_changed(SimpleEvent& evt) { @@ -1994,16 +1757,12 @@ void Plater::priv::on_viewport_changed(SimpleEvent& evt) void Plater::priv::on_right_click(Vec2dEvent& evt) { -#if ENABLE_EXTENDED_SELECTION int obj_idx = get_selected_object_idx(); if (obj_idx == -1) return; if (q != nullptr) q->PopupMenu(&object_menu, (int)evt.data.x(), (int)evt.data.y()); -#else - // TODO -#endif // ENABLE_EXTENDED_SELECTION } void Plater::priv::on_model_update(SimpleEvent&) @@ -2011,42 +1770,6 @@ void Plater::priv::on_model_update(SimpleEvent&) // TODO } -#if !ENABLE_EXTENDED_SELECTION -void Plater::priv::on_scale_uniformly(SimpleEvent&) -{ -// my ($scale) = @_; - -// my ($obj_idx, $object) = $self->selected_object; - const auto obj_idx = selected_object(); - if (! obj_idx) { return; } -// return if !defined $obj_idx; - -// my $model_object = $self->{model}->objects->[$obj_idx]; -// my $model_instance = $model_object->instances->[0]; - -// my $variation = $scale / $model_instance->scaling_factor; -// #FIXME Scale the layer height profile? -// foreach my $range (@{ $model_object->layer_height_ranges }) { -// $range->[0] *= $variation; -// $range->[1] *= $variation; -// } -// $_->set_scaling_factor($scale) for @{ $model_object->instances }; - -// # Set object scale on c++ side -// # Slic3r::GUI::set_object_scale($obj_idx, $model_object->instances->[0]->scaling_factor * 100); - -// # $object->transform_thumbnail($self->{model}, $obj_idx); - -// #update print and start background processing -// $self->{print}->add_model_object($model_object, $obj_idx); - -// $self->selection_changed(1); # refresh info (size, volume etc.) -// $self->update; - - this->schedule_background_process(); -} -#endif // !ENABLE_EXTENDED_SELECTION - void Plater::priv::on_wipetower_moved(Vec3dEvent &evt) { DynamicPrintConfig cfg; @@ -2102,7 +1825,6 @@ bool Plater::priv::init_object_menu() wxMenuItem* item_split = append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "shape_ungroup.png"); -#if ENABLE_EXTENDED_SELECTION // ui updates needs to be binded to the parent panel if (q != nullptr) { @@ -2115,12 +1837,10 @@ bool Plater::priv::init_object_menu() q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split_objects->GetId()); q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split_volumes->GetId()); } -#endif // ENABLE_EXTENDED_SELECTION return true; } -#if ENABLE_EXTENDED_SELECTION bool Plater::priv::can_delete_object() const { int obj_idx = get_selected_object_idx(); @@ -2177,7 +1897,6 @@ bool Plater::priv::can_mirror() const { return get_selection().is_from_single_instance(); } -#endif // ENABLE_EXTENDED_SELECTION // Plater / Public @@ -2218,51 +1937,28 @@ void Plater::remove(size_t obj_idx) { p->remove(obj_idx); } void Plater::remove_selected() { -#if ENABLE_EXTENDED_SELECTION int obj_idx = p->get_selected_object_idx(); if (obj_idx != -1) remove((size_t)obj_idx); -#else - const auto selected = p->selected_object(); - if (selected) { - remove(*selected); - } -#endif // ENABLE_EXTENDED_SELECTION } void Plater::increase_instances(size_t num) { -#if ENABLE_EXTENDED_SELECTION int obj_idx = p->get_selected_object_idx(); if (obj_idx == -1) return; ModelObject* model_object = p->model.objects[obj_idx]; ModelInstance* model_instance = model_object->instances.back(); -#else - const auto obj_idx = p->selected_object(); - if (! obj_idx) { return; } - - auto *model_object = p->model.objects[*obj_idx]; - auto *model_instance = model_object->instances[model_object->instances.size() - 1]; -#endif // ENABLE_EXTENDED_SELECTION float offset = 10.0; for (size_t i = 0; i < num; i++, offset += 10.0) { Vec3d offset_vec = model_instance->get_offset() + Vec3d(offset, offset, 0.0); model_object->add_instance(offset_vec, model_instance->get_scaling_factor(), model_instance->get_rotation()); -#if ENABLE_EXTENDED_SELECTION // p->print.get_object(obj_idx)->add_copy(Slic3r::to_2d(offset_vec)); -#else -// p->print.get_object(*obj_idx)->add_copy(Slic3r::to_2d(offset_vec)); -#endif // ENABLE_EXTENDED_SELECTION } -#if ENABLE_EXTENDED_SELECTION sidebar().obj_list()->increase_object_instances(obj_idx, num); -#else - sidebar().obj_list()->increase_object_instances(*obj_idx, num); -#endif // ENABLE_EXTENDED_SELECTION if (p->get_config("autocenter") == "1") { p->arrange(); @@ -2270,9 +1966,7 @@ void Plater::increase_instances(size_t num) p->update(); } -#if ENABLE_EXTENDED_SELECTION p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1); -#endif // ENABLE_EXTENDED_SELECTION p->selection_changed(); @@ -2281,47 +1975,26 @@ void Plater::increase_instances(size_t num) void Plater::decrease_instances(size_t num) { -#if ENABLE_EXTENDED_SELECTION int obj_idx = p->get_selected_object_idx(); if (obj_idx == -1) return; ModelObject* model_object = p->model.objects[obj_idx]; -#else - const auto obj_idx = p->selected_object(); - if (! obj_idx) { return; } - - auto *model_object = p->model.objects[*obj_idx]; -#endif // ENABLE_EXTENDED_SELECTION if (model_object->instances.size() > num) { for (size_t i = 0; i < num; i++) { model_object->delete_last_instance(); -#if ENABLE_EXTENDED_SELECTION // p->print.get_object(obj_idx)->delete_last_copy(); -#else -// p->print.get_object(*obj_idx)->delete_last_copy(); -#endif // ENABLE_EXTENDED_SELECTION } -#if ENABLE_EXTENDED_SELECTION sidebar().obj_list()->decrease_object_instances(obj_idx, num); -#else - sidebar().obj_list()->decrease_object_instances(*obj_idx, num); -#endif // ENABLE_EXTENDED_SELECTION } else { -#if ENABLE_EXTENDED_SELECTION remove(obj_idx); -#else - remove(*obj_idx); -#endif // ENABLE_EXTENDED_SELECTION } p->update(); -#if ENABLE_EXTENDED_SELECTION if (!model_object->instances.empty()) p->get_selection().add_instance(obj_idx, (int)model_object->instances.size() - 1); -#endif // ENABLE_EXTENDED_SELECTION p->selection_changed(); this->p->schedule_background_process(); @@ -2329,18 +2002,11 @@ void Plater::decrease_instances(size_t num) void Plater::set_number_of_copies(/*size_t num*/) { -#if ENABLE_EXTENDED_SELECTION int obj_idx = p->get_selected_object_idx(); if (obj_idx == -1) return; ModelObject* model_object = p->model.objects[obj_idx]; -#else - const auto obj_idx = p->selected_object(); - if (! obj_idx) { return; } - - auto *model_object = p->model.objects[*obj_idx]; -#endif // ENABLE_EXTENDED_SELECTION const auto num = wxGetNumberFromUser( " ", _("Enter the number of copies:"), _("Copies of the selected object"), model_object->instances.size(), 0, 1000, this ); @@ -2356,13 +2022,8 @@ void Plater::set_number_of_copies(/*size_t num*/) void Plater::export_gcode(fs::path output_path) { -#if ENABLE_EXTENDED_SELECTION if (p->model.objects.empty()) return; -#else - if (p->objects.empty()) - return; -#endif // ENABLE_EXTENDED_SELECTION if (this->p->background_process.is_export_scheduled()) { GUI::show_error(this, _(L("Another export job is currently running."))); @@ -2414,11 +2075,7 @@ void Plater::export_gcode(fs::path output_path) void Plater::export_stl() { -#if ENABLE_EXTENDED_SELECTION if (p->model.objects.empty()) { return; } -#else - if (p->objects.empty()) { return; } -#endif // ENABLE_EXTENDED_SELECTION auto dialog = p->get_export_file(FT_STL); if (! dialog) { return; } @@ -2433,11 +2090,7 @@ void Plater::export_stl() void Plater::export_amf() { -#if ENABLE_EXTENDED_SELECTION if (p->model.objects.empty()) { return; } -#else - if (p->objects.empty()) { return; } -#endif // ENABLE_EXTENDED_SELECTION auto dialog = p->get_export_file(FT_AMF); if (! dialog) { return; } @@ -2456,11 +2109,7 @@ void Plater::export_amf() void Plater::export_3mf() { -#if ENABLE_EXTENDED_SELECTION if (p->model.objects.empty()) { return; } -#else - if (p->objects.empty()) { return; } -#endif // ENABLE_EXTENDED_SELECTION auto dialog = p->get_export_file(FT_3MF); if (! dialog) { return; } @@ -2600,11 +2249,6 @@ void Plater::changed_object(int obj_idx) // update print if (list->is_parts_changed() || list->is_part_settings_changed()) { this->p->schedule_background_process(); -#if !ENABLE_EXTENDED_SELECTION - if (p->canvas3D) _3DScene::reload_scene(p->canvas3D, true); - auto selections = p->collect_selections(); - _3DScene::set_objects_selections(p->canvas3D, selections); -#endif // !ENABLE_EXTENDED_SELECTION #if !ENABLE_MODIFIED_CAMERA_TARGET _3DScene::zoom_to_volumes(p->canvas3D); #endif // !ENABLE_MODIFIED_CAMERA_TARGET