mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
ObjectList: Fixes
* Fixed update of a warning icon for multi-part object, when some part with errors was deleted
* Fixed a crash when selecting non-Object and non-Volume item (in get_mesh_errors_info() was missed check of the obj_idx)
+ Follow-up 1cc7b4ba97
- some code refactoring:
* fixed RepairedMeshErrors.merge()
* get_mesh_errors_count() renamed to get_repaired_errors_count()
This commit is contained in:
parent
dbad87fb42
commit
7340488aaf
11 changed files with 83 additions and 67 deletions
|
@ -1629,10 +1629,10 @@ TriangleMeshStats ModelObject::get_object_stl_stats() const
|
|||
return full_stats;
|
||||
}
|
||||
|
||||
int ModelObject::get_mesh_errors_count(const int vol_idx /*= -1*/) const
|
||||
int ModelObject::get_repaired_errors_count(const int vol_idx /*= -1*/) const
|
||||
{
|
||||
if (vol_idx >= 0)
|
||||
return this->volumes[vol_idx]->get_mesh_errors_count();
|
||||
return this->volumes[vol_idx]->get_repaired_errors_count();
|
||||
|
||||
const RepairedMeshErrors& stats = get_object_stl_stats().repaired_errors;
|
||||
|
||||
|
@ -1704,7 +1704,7 @@ void ModelVolume::calculate_convex_hull()
|
|||
assert(m_convex_hull.get());
|
||||
}
|
||||
|
||||
int ModelVolume::get_mesh_errors_count() const
|
||||
int ModelVolume::get_repaired_errors_count() const
|
||||
{
|
||||
const RepairedMeshErrors &stats = this->mesh().stats().repaired_errors;
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ public:
|
|||
// Get full stl statistics for all object's meshes
|
||||
TriangleMeshStats get_object_stl_stats() const;
|
||||
// Get count of errors in the mesh( or all object's meshes, if volume index isn't defined)
|
||||
int get_mesh_errors_count(const int vol_idx = -1) const;
|
||||
int get_repaired_errors_count(const int vol_idx = -1) const;
|
||||
|
||||
private:
|
||||
friend class Model;
|
||||
|
@ -682,7 +682,7 @@ public:
|
|||
const TriangleMesh& get_convex_hull() const;
|
||||
std::shared_ptr<const TriangleMesh> get_convex_hull_shared_ptr() const { return m_convex_hull; }
|
||||
// Get count of errors in the mesh
|
||||
int get_mesh_errors_count() const;
|
||||
int get_repaired_errors_count() const;
|
||||
|
||||
// Helpers for loading / storing into AMF / 3MF files.
|
||||
static ModelVolumeType type_from_string(const std::string &s);
|
||||
|
|
|
@ -68,8 +68,7 @@ TriangleMesh::TriangleMesh(const indexed_triangle_set &its) : its(its)
|
|||
|
||||
TriangleMesh::TriangleMesh(indexed_triangle_set &&its, const RepairedMeshErrors& errors/* = RepairedMeshErrors()*/) : its(std::move(its))
|
||||
{
|
||||
if (errors.repaired())
|
||||
m_stats.repaired_errors = errors;
|
||||
m_stats.repaired_errors = errors;
|
||||
fill_initial_stats(this->its, m_stats);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,12 @@ struct RepairedMeshErrors {
|
|||
|
||||
void clear() { *this = RepairedMeshErrors(); }
|
||||
|
||||
RepairedMeshErrors merge(const RepairedMeshErrors& rhs) const {
|
||||
RepairedMeshErrors out;
|
||||
out.edges_fixed = this->edges_fixed + rhs.edges_fixed;
|
||||
out.degenerate_facets = this->degenerate_facets + rhs.degenerate_facets;
|
||||
out.facets_removed = this->facets_removed + rhs.facets_removed;
|
||||
out.facets_reversed = this->facets_reversed + rhs.facets_reversed;
|
||||
out.backwards_edges = this->backwards_edges + rhs.backwards_edges;
|
||||
return out;
|
||||
void merge(const RepairedMeshErrors& rhs) {
|
||||
this->edges_fixed += rhs.edges_fixed;
|
||||
this->degenerate_facets += rhs.degenerate_facets;
|
||||
this->facets_removed += rhs.facets_removed;
|
||||
this->facets_reversed += rhs.facets_reversed;
|
||||
this->backwards_edges += rhs.backwards_edges;
|
||||
}
|
||||
|
||||
bool repaired() const { return degenerate_facets > 0 || edges_fixed > 0 || facets_removed > 0 || facets_reversed > 0 || backwards_edges > 0; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue