diff --git a/src/libslic3r/FDMSupportSpots.cpp b/src/libslic3r/FDMSupportSpots.cpp index ebfc1e5e8f..58b0899c64 100644 --- a/src/libslic3r/FDMSupportSpots.cpp +++ b/src/libslic3r/FDMSupportSpots.cpp @@ -119,44 +119,35 @@ void FDMSupportSpots::find_support_areas() { bool visited_neighbour = false; std::queue neighbours { }; - for (const auto &direct_neighbour_index : current.neighbours) { - if (direct_neighbour_index < 0 || !this->m_triangles[direct_neighbour_index].visited) { - continue; - } - neighbours.push(direct_neighbour_index); - const Triangle &direct_neighbour = this->m_triangles[direct_neighbour_index]; - if (neighbourhood_unsupported_area >= direct_neighbour.unsupported_weight) { - neighbourhood_unsupported_area = direct_neighbour.unsupported_weight; - group_id = direct_neighbour.group_id; - } - visited_neighbour = true; - } - + neighbours.push(current_index); std::set explored { }; - while (!neighbours.empty() && !visited_neighbour) { + while (!neighbours.empty() && neighbourhood_unsupported_area > 0) { int neighbour_index = neighbours.front(); neighbours.pop(); - explored.insert(neighbour_index); const Triangle &neighbour = this->m_triangles[neighbour_index]; - if (explored.find(neighbour_index) != explored.end() - || triangle_vertices_shortest_distance(this->m_mesh, current.index, neighbour_index) - > this->m_config.islands_tolerance_distance) { - // not visited, already explored, or too far + if (explored.find(neighbour_index) != explored.end()) { + continue; + } + explored.insert(neighbour_index); + if (triangle_vertices_shortest_distance(this->m_mesh, current.index, neighbour_index) + > this->m_config.islands_tolerance_distance) { continue; } if (neighbour.visited) { visited_neighbour = true; + if (neighbourhood_unsupported_area >= neighbour.unsupported_weight) { + neighbourhood_unsupported_area = neighbour.unsupported_weight; + group_id = neighbour.group_id; + } break; } for (const auto &neighbour_index : neighbour.neighbours) { - if (neighbour_index < 0) { - continue; + if (neighbour_index >= 0) { + neighbours.push(neighbour_index); } - neighbours.push(neighbour_index); } - } current.visited = true; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index 914000462d..2f18ba9903 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -171,38 +171,40 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l "Degree sign to use in the respective slider in FDM supports gizmo," "placed after the number with no whitespace in between."); - std::string mm = std::string("%.f") + I18N::translate_utf8("mm"); + std::string tenth_mm = std::string("%.f") + I18N::translate_utf8(" * 0.1 (mm)"); + std::string hundreth_mm = std::string("%.f") + I18N::translate_utf8(" * 0.01 (mm)"); m_imgui->slider_float("##angle_threshold_deg", &m_smart_support_limit_angle_deg, 0.f, 90.f, format_str.data(), 1.0f, true); - m_imgui->slider_float("##patch_size", &m_smart_support_patch_size, 0.f, 20.f, mm.data(), + m_imgui->slider_float("##patch_size", &m_smart_support_patch_size, 0.f, 100.f, tenth_mm.data(), 1.0f, false); - m_imgui->slider_float("##patch_spacing", &m_smart_support_patch_spacing, 0.f, 20.f, mm.data(), + m_imgui->slider_float("##patch_spacing", &m_smart_support_patch_spacing, 0.f, 100.f, tenth_mm.data(), 1.0f, false); - m_imgui->slider_float("##island_tolerance", &m_smart_support_islands_tolerance, 0.f, 10.f, mm.data(), + m_imgui->slider_float("##island_tolerance", &m_smart_support_islands_tolerance, 0.f, 100.f, hundreth_mm.data(), 1.0f, false); ImGui::NewLine(); ImGui::SameLine(window_width - buttons_width - m_imgui->scaled(0.5f)); if (m_imgui->button(m_desc["enforce_button"], buttons_width, 0.f)) { - compute_smart_support_placement(m_smart_support_limit_angle_deg, m_smart_support_patch_size, - m_smart_support_patch_spacing, m_smart_support_islands_tolerance); + compute_smart_support_placement(m_smart_support_limit_angle_deg, m_smart_support_patch_size * 0.1f, + m_smart_support_patch_spacing * 0.1f, m_smart_support_islands_tolerance * 0.01f); } if (m_imgui->button(m_desc.at("remove_all"))) { - Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"), UndoRedo::SnapshotType::GizmoAction); - ModelObject *mo = m_c->selection_info()->model_object(); - int idx = -1; - for (ModelVolume *mv : mo->volumes) - if (mv->is_model_part()) { - ++idx; - m_triangle_selectors[idx]->reset(); - m_triangle_selectors[idx]->request_update_render_data(); - } + Plater::TakeSnapshot snapshot(wxGetApp().plater(), _L("Reset selection"), + UndoRedo::SnapshotType::GizmoAction); + ModelObject *mo = m_c->selection_info()->model_object(); + int idx = -1; + for (ModelVolume *mv : mo->volumes) + if (mv->is_model_part()) { + ++idx; + m_triangle_selectors[idx]->reset(); + m_triangle_selectors[idx]->request_update_render_data(); + } - update_model_object(); - m_parent.set_as_dirty(); - } + update_model_object(); + m_parent.set_as_dirty(); + } }