Minor improvements

Fix bad function call exception with empty interrupter (OpenVDB)
This commit is contained in:
tamasmeszaros 2023-01-02 13:40:04 +01:00
parent bfb1ec073d
commit 159fc4e28e
3 changed files with 8 additions and 3 deletions

View file

@ -43,6 +43,9 @@ void model_to_csgmesh(const ModelObject &mo,
++out;
its_split(vol->mesh().its, SplitOutputFn{[&out, &vol, &trafo](indexed_triangle_set &&its) {
if (its.empty())
return;
CSGPart part{std::make_unique<indexed_triangle_set>(std::move(its)),
CSGType::Union,
(trafo * vol->get_matrix()).cast<float>()};

View file

@ -81,7 +81,7 @@ struct Interrupter
void start(const char* name = nullptr) { (void)name; }
void end() {}
inline bool wasInterrupted(int percent = -1) { return statusfn(percent); }
inline bool wasInterrupted(int percent = -1) { return statusfn && statusfn(percent); }
};
VoxelGridPtr mesh_to_grid(const indexed_triangle_set &mesh,

View file

@ -196,7 +196,7 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st
auto r = range(po.m_mesh_to_slice);
auto m = indexed_triangle_set{};
if (r.size() == 1 || is_all_positive(r)) {
if (is_all_positive(r)) {
m = csgmesh_merge_positive_parts(r);
} else if (csg::check_csgmesh_booleans(r) == r.end()) {
auto cgalmeshptr = csg::perform_csgmesh_booleans(r);
@ -204,7 +204,9 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st
m = MeshBoolean::cgal::cgal_to_indexed_triangle_set(*cgalmeshptr);
} else {
po.active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL,
L("Can't do proper mesh booleans!"));
L("Can't perform full mesh booleans! "
"Some parts of the print will be previewed with approximated meshes. "
"This does not affect the quality of slices or the physical print in any way."));
m = generate_preview_vdb(po, step);
}