mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Fixed out of printbed detection for non-printable objects leading to inconsistent volumes' color
This commit is contained in:
parent
621b8426d3
commit
316832b23d
2 changed files with 7 additions and 20 deletions
|
@ -707,24 +707,24 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
||||||
print_volume.min(2) = -1e10;
|
print_volume.min(2) = -1e10;
|
||||||
|
|
||||||
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
|
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
|
||||||
bool all_contained = true;
|
|
||||||
|
|
||||||
bool contained_min_one = false;
|
bool contained_min_one = false;
|
||||||
|
|
||||||
for (GLVolume* volume : this->volumes)
|
for (GLVolume* volume : this->volumes)
|
||||||
{
|
{
|
||||||
if ((volume == nullptr) || !volume->printable || volume->is_modifier || (volume->is_wipe_tower && !volume->shader_outside_printer_detection_enabled) || ((volume->composite_id.volume_id < 0) && !volume->shader_outside_printer_detection_enabled))
|
if ((volume == nullptr) || volume->is_modifier || (volume->is_wipe_tower && !volume->shader_outside_printer_detection_enabled) || ((volume->composite_id.volume_id < 0) && !volume->shader_outside_printer_detection_enabled))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const BoundingBoxf3& bb = volume->transformed_convex_hull_bounding_box();
|
const BoundingBoxf3& bb = volume->transformed_convex_hull_bounding_box();
|
||||||
bool contained = print_volume.contains(bb);
|
bool contained = print_volume.contains(bb);
|
||||||
all_contained &= contained;
|
|
||||||
|
volume->is_outside = !contained;
|
||||||
|
if (!volume->printable)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (contained)
|
if (contained)
|
||||||
contained_min_one = true;
|
contained_min_one = true;
|
||||||
|
|
||||||
volume->is_outside = !contained;
|
|
||||||
|
|
||||||
if ((state == ModelInstance::PVS_Inside) && volume->is_outside)
|
if ((state == ModelInstance::PVS_Inside) && volume->is_outside)
|
||||||
state = ModelInstance::PVS_Fully_Outside;
|
state = ModelInstance::PVS_Fully_Outside;
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
||||||
if (out_state != nullptr)
|
if (out_state != nullptr)
|
||||||
*out_state = state;
|
*out_state = state;
|
||||||
|
|
||||||
return /*all_contained*/ contained_min_one; // #ys_FIXME_delete_after_testing
|
return contained_min_one;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVolumeCollection::reset_outside_state()
|
void GLVolumeCollection::reset_outside_state()
|
||||||
|
|
|
@ -2090,20 +2090,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
|
|
||||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
||||||
contained_min_one && !m_model->objects.empty() && state != ModelInstance::PVS_Partly_Outside));
|
contained_min_one && !m_model->objects.empty() && state != ModelInstance::PVS_Partly_Outside));
|
||||||
|
|
||||||
// #ys_FIXME_delete_after_testing
|
|
||||||
// bool contained = m_volumes.check_outside_state(m_config, &state);
|
|
||||||
// if (!contained)
|
|
||||||
// {
|
|
||||||
// _set_warning_texture(WarningTexture::ObjectOutside, true);
|
|
||||||
// post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, state == ModelInstance::PVS_Fully_Outside));
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_volumes.reset_outside_state();
|
|
||||||
// _set_warning_texture(WarningTexture::ObjectOutside, false);
|
|
||||||
// post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, !m_model->objects.empty()));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2887,6 +2873,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
volume_bbox.offset(1.0);
|
volume_bbox.offset(1.0);
|
||||||
if (volume_bbox.contains(m_mouse.scene_position))
|
if (volume_bbox.contains(m_mouse.scene_position))
|
||||||
{
|
{
|
||||||
|
m_volumes.volumes[volume_idx]->hover = GLVolume::HS_None;
|
||||||
// The dragging operation is initiated.
|
// The dragging operation is initiated.
|
||||||
m_mouse.drag.move_volume_idx = volume_idx;
|
m_mouse.drag.move_volume_idx = volume_idx;
|
||||||
m_selection.start_dragging();
|
m_selection.start_dragging();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue