Small refactoring

This commit is contained in:
enricoturri1966 2023-05-10 11:15:39 +02:00
parent 662c3da65b
commit 663465299b
3 changed files with 11 additions and 10 deletions

View file

@ -2097,6 +2097,14 @@ bool ModelObject::has_solid_mesh() const
return false;
}
bool ModelObject::has_negative_volume_mesh() const
{
for (const ModelVolume* volume : volumes)
if (volume->is_negative_volume())
return true;
return false;
}
void ModelVolume::set_material_id(t_model_material_id material_id)
{
m_material_id = material_id;

View file

@ -503,6 +503,8 @@ public:
// Detect if object has at least one solid mash
bool has_solid_mesh() const;
// Detect if object has at least one negative volume mash
bool has_negative_volume_mesh() const;
bool is_cut() const { return cut_id.id().valid(); }
bool has_connectors() const;

View file

@ -1096,16 +1096,7 @@ static bool composite_id_match(const GLVolume::CompositeID& id1, const GLVolume:
}
static bool object_contains_negative_volumes(const Model& model, int obj_id) {
bool ret = false;
if (0 <= obj_id && obj_id < (int)model.objects.size()) {
for (const ModelVolume* v : model.objects[obj_id]->volumes) {
if (v->is_negative_volume()) {
ret = true;
break;
}
}
}
return ret;
return (0 <= obj_id && obj_id < (int)model.objects.size()) ? model.objects[obj_id]->has_negative_volume_mesh() : false;
}
void GLCanvas3D::SLAView::detect_type_from_volumes(const GLVolumePtrs& volumes)