Out of print volume detection for extrusion toolpaths only

This commit is contained in:
Enrico Turri 2018-07-27 08:49:58 +02:00
parent b5b7894a6f
commit c2ab8c2ae3
3 changed files with 14 additions and 2 deletions

View file

@ -215,6 +215,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
, hover(false)
, is_modifier(false)
, is_wipe_tower(false)
, is_extrusion_path(false)
, tverts_range(0, size_t(-1))
, qverts_range(0, size_t(-1))
{

View file

@ -299,6 +299,8 @@ public:
bool is_modifier;
// Wheter or not this volume has been generated from the wipe tower
bool is_wipe_tower;
// Wheter or not this volume has been generated from an extrusion path
bool is_extrusion_path;
// Interleaved triangles & normals with indexed triangles & quads.
GLIndexedVertexArray indexed_vertex_array;

View file

@ -1828,7 +1828,6 @@ unsigned int GLCanvas3D::get_volumes_count() const
void GLCanvas3D::reset_volumes()
{
if (!m_volumes.empty())
{
// ensures this canvas is current
@ -1839,6 +1838,9 @@ void GLCanvas3D::reset_volumes()
m_volumes.clear();
m_dirty = true;
}
enable_warning_texture(false);
_reset_warning_texture();
}
void GLCanvas3D::deselect_volumes()
@ -2377,6 +2379,12 @@ void GLCanvas3D::load_preview(const std::vector<std::string>& str_tool_colors)
if (object != nullptr)
_load_print_object_toolpaths(*object, str_tool_colors);
}
for (GLVolume* volume : m_volumes.volumes)
{
volume->is_extrusion_path = true;
}
_update_toolpath_volumes_outside_state();
_show_warning_texture_if_needed();
reset_legend_texture();
@ -4276,6 +4284,7 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat
if (volume != nullptr)
{
filter.volume = volume;
volume->is_extrusion_path = true;
m_volumes.volumes.emplace_back(volume);
}
else
@ -4757,7 +4766,7 @@ void GLCanvas3D::_update_toolpath_volumes_outside_state()
for (GLVolume* volume : m_volumes.volumes)
{
volume->is_outside = (print_volume.radius() > 0.0) ? !print_volume.contains(volume->transformed_bounding_box()) : false;
volume->is_outside = ((print_volume.radius() > 0.0) && volume->is_extrusion_path) ? !print_volume.contains(volume->bounding_box) : false;
}
}