diff options
author | Lukas Matena <lukasmatena@seznam.cz> | 2018-08-17 16:44:50 +0300 |
---|---|---|
committer | Lukas Matena <lukasmatena@seznam.cz> | 2018-08-17 16:44:50 +0300 |
commit | 72ba5c8ab4d7651b6e3db47fb1773df870412939 (patch) | |
tree | b91e56ab06445bd1061a979bbadf567c6091eb5d /xs/src/slic3r | |
parent | f9efcc36b64d631bfece0a207fbb74388c3bb514 (diff) | |
parent | 048f3a03fe884566b2ec290164e46ca3fce39b28 (diff) |
Merge remote-tracking branch 'origin/convex_hull' into lm_lay_flat_round_merged_facets
Diffstat (limited to 'xs/src/slic3r')
-rw-r--r-- | xs/src/slic3r/GUI/3DScene.cpp | 10 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/3DScene.hpp | 4 | ||||
-rw-r--r-- | xs/src/slic3r/GUI/GLCanvas3D.cpp | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/xs/src/slic3r/GUI/3DScene.cpp b/xs/src/slic3r/GUI/3DScene.cpp index 0709271b8..705347094 100644 --- a/xs/src/slic3r/GUI/3DScene.cpp +++ b/xs/src/slic3r/GUI/3DScene.cpp @@ -204,6 +204,7 @@ GLVolume::GLVolume(float r, float g, float b, float a) , m_scale_factor(1.0f) , m_transformed_bounding_box_dirty(true) , m_transformed_convex_hull_bounding_box_dirty(true) + , m_convex_hull(nullptr) , composite_id(-1) , select_group_id(-1) , drag_group_id(-1) @@ -293,7 +294,7 @@ void GLVolume::set_scale_factor(float scale_factor) void GLVolume::set_convex_hull(const TriangleMesh& convex_hull) { - m_convex_hull = convex_hull; + m_convex_hull = &convex_hull; } std::vector<float> GLVolume::world_matrix() const @@ -322,8 +323,8 @@ BoundingBoxf3 GLVolume::transformed_convex_hull_bounding_box() const { if (m_transformed_convex_hull_bounding_box_dirty) { - if (m_convex_hull.stl.stats.number_of_facets > 0) - m_transformed_convex_hull_bounding_box = m_convex_hull.transformed_bounding_box(world_matrix()); + if ((m_convex_hull != nullptr) && (m_convex_hull->stl.stats.number_of_facets > 0)) + m_transformed_convex_hull_bounding_box = m_convex_hull->transformed_bounding_box(world_matrix()); else m_transformed_convex_hull_bounding_box = bounding_box.transformed(world_matrix()); @@ -747,7 +748,6 @@ int GLVolumeCollection::load_wipe_tower_preview( v.drag_group_id = obj_idx * 1000; v.is_wipe_tower = true; v.shader_outside_printer_detection_enabled = ! size_unknown; - v.set_convex_hull(mesh.convex_hull_3d()); return int(this->volumes.size() - 1); } @@ -833,7 +833,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M for (GLVolume* volume : this->volumes) { - if ((volume != nullptr) && !volume->is_modifier) + if ((volume != nullptr) && !volume->is_modifier && (!volume->is_wipe_tower || (volume->is_wipe_tower && volume->shader_outside_printer_detection_enabled))) { const BoundingBoxf3& bb = volume->transformed_convex_hull_bounding_box(); bool contained = print_volume.contains(bb); diff --git a/xs/src/slic3r/GUI/3DScene.hpp b/xs/src/slic3r/GUI/3DScene.hpp index 1265bc20d..5cd144c68 100644 --- a/xs/src/slic3r/GUI/3DScene.hpp +++ b/xs/src/slic3r/GUI/3DScene.hpp @@ -264,8 +264,8 @@ private: mutable BoundingBoxf3 m_transformed_bounding_box; // Whether or not is needed to recalculate the transformed bounding box. mutable bool m_transformed_bounding_box_dirty; - // Convex hull of the original mesh, if any. - TriangleMesh m_convex_hull; + // Pointer to convex hull of the original mesh, if any. + const TriangleMesh* m_convex_hull; // Bounding box of this volume, in unscaled coordinates. mutable BoundingBoxf3 m_transformed_convex_hull_bounding_box; // Whether or not is needed to recalculate the transformed convex hull bounding box. diff --git a/xs/src/slic3r/GUI/GLCanvas3D.cpp b/xs/src/slic3r/GUI/GLCanvas3D.cpp index 947af6754..01a8b80f9 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.cpp @@ -3061,6 +3061,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } _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]); } else if (!m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging() && !is_layers_editing_enabled()) { |