mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -06:00
Manifold mesh may contain self-intersections, so we want to always allow fixing the mesh.
This is a fix of a regression wrt. https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-alpha2
This commit is contained in:
parent
9c177cf167
commit
e533d237f9
3 changed files with 17 additions and 7 deletions
|
@ -377,10 +377,7 @@ void ObjectList::get_selection_indexes(std::vector<int>& obj_idxs, std::vector<i
|
||||||
|
|
||||||
int ObjectList::get_mesh_errors_count(const int obj_idx, const int vol_idx /*= -1*/) const
|
int ObjectList::get_mesh_errors_count(const int obj_idx, const int vol_idx /*= -1*/) const
|
||||||
{
|
{
|
||||||
if (obj_idx < 0)
|
return obj_idx >= 0 ? (*m_objects)[obj_idx]->get_mesh_errors_count(vol_idx) : 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
return (*m_objects)[obj_idx]->get_mesh_errors_count(vol_idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string get_warning_icon_name(const TriangleMeshStats& stats)
|
static std::string get_warning_icon_name(const TriangleMeshStats& stats)
|
||||||
|
@ -393,7 +390,7 @@ std::pair<wxString, std::string> ObjectList::get_mesh_errors(const int obj_idx,
|
||||||
const int errors = get_mesh_errors_count(obj_idx, vol_idx);
|
const int errors = get_mesh_errors_count(obj_idx, vol_idx);
|
||||||
|
|
||||||
if (errors == 0)
|
if (errors == 0)
|
||||||
return { "", "" }; // hide tooltip
|
return { {}, {} }; // hide tooltip
|
||||||
|
|
||||||
// Create tooltip string, if there are errors
|
// Create tooltip string, if there are errors
|
||||||
wxString tooltip = format_wxstr(_L_PLURAL("Auto-repaired %1$d error", "Auto-repaired %1$d errors", errors), errors) + ":\n";
|
wxString tooltip = format_wxstr(_L_PLURAL("Auto-repaired %1$d error", "Auto-repaired %1$d errors", errors), errors) + ":\n";
|
||||||
|
@ -4043,17 +4040,21 @@ void ObjectList::fix_through_netfabb()
|
||||||
// clear selections from the non-broken models if any exists
|
// clear selections from the non-broken models if any exists
|
||||||
// and than fill names of models to repairing
|
// and than fill names of models to repairing
|
||||||
if (vol_idxs.empty()) {
|
if (vol_idxs.empty()) {
|
||||||
|
#if !FIX_THROUGH_NETFABB_ALWAYS
|
||||||
for (int i = int(obj_idxs.size())-1; i >= 0; --i)
|
for (int i = int(obj_idxs.size())-1; i >= 0; --i)
|
||||||
if (object(obj_idxs[i])->get_mesh_errors_count() == 0)
|
if (object(obj_idxs[i])->get_mesh_errors_count() == 0)
|
||||||
obj_idxs.erase(obj_idxs.begin()+i);
|
obj_idxs.erase(obj_idxs.begin()+i);
|
||||||
|
#endif // FIX_THROUGH_NETFABB_ALWAYS
|
||||||
for (int obj_idx : obj_idxs)
|
for (int obj_idx : obj_idxs)
|
||||||
model_names.push_back(object(obj_idx)->name);
|
model_names.push_back(object(obj_idx)->name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ModelObject* obj = object(obj_idxs.front());
|
ModelObject* obj = object(obj_idxs.front());
|
||||||
|
#if !FIX_THROUGH_NETFABB_ALWAYS
|
||||||
for (int i = int(vol_idxs.size()) - 1; i >= 0; --i)
|
for (int i = int(vol_idxs.size()) - 1; i >= 0; --i)
|
||||||
if (obj->get_mesh_errors_count(vol_idxs[i]) == 0)
|
if (obj->get_mesh_errors_count(vol_idxs[i]) == 0)
|
||||||
vol_idxs.erase(vol_idxs.begin() + i);
|
vol_idxs.erase(vol_idxs.begin() + i);
|
||||||
|
#endif // FIX_THROUGH_NETFABB_ALWAYS
|
||||||
for (int vol_idx : vol_idxs)
|
for (int vol_idx : vol_idxs)
|
||||||
model_names.push_back(obj->volumes[vol_idx]->name);
|
model_names.push_back(obj->volumes[vol_idx]->name);
|
||||||
}
|
}
|
||||||
|
@ -4106,8 +4107,10 @@ void ObjectList::fix_through_netfabb()
|
||||||
if (vol_idxs.empty()) {
|
if (vol_idxs.empty()) {
|
||||||
int vol_idx{ -1 };
|
int vol_idx{ -1 };
|
||||||
for (int obj_idx : obj_idxs) {
|
for (int obj_idx : obj_idxs) {
|
||||||
|
#if !FIX_THROUGH_NETFABB_ALWAYS
|
||||||
if (object(obj_idx)->get_mesh_errors_count(vol_idx) == 0)
|
if (object(obj_idx)->get_mesh_errors_count(vol_idx) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
#endif // FIX_THROUGH_NETFABB_ALWAYS
|
||||||
if (!fix_and_update_progress(obj_idx, vol_idx, model_idx, progress_dlg, succes_models, failed_models))
|
if (!fix_and_update_progress(obj_idx, vol_idx, model_idx, progress_dlg, succes_models, failed_models))
|
||||||
break;
|
break;
|
||||||
model_idx++;
|
model_idx++;
|
||||||
|
|
|
@ -36,6 +36,9 @@ typedef double coordf_t;
|
||||||
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
typedef std::pair<coordf_t, coordf_t> t_layer_height_range;
|
||||||
typedef std::map<t_layer_height_range, ModelConfig> t_layer_config_ranges;
|
typedef std::map<t_layer_height_range, ModelConfig> t_layer_config_ranges;
|
||||||
|
|
||||||
|
// Manifold mesh may contain self-intersections, so we want to always allow fixing the mesh.
|
||||||
|
#define FIX_THROUGH_NETFABB_ALWAYS 1
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
wxDECLARE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
wxDECLARE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
||||||
|
|
|
@ -4536,6 +4536,11 @@ bool Plater::priv::can_fix_through_netfabb() const
|
||||||
std::vector<int> obj_idxs, vol_idxs;
|
std::vector<int> obj_idxs, vol_idxs;
|
||||||
sidebar->obj_list()->get_selection_indexes(obj_idxs, vol_idxs);
|
sidebar->obj_list()->get_selection_indexes(obj_idxs, vol_idxs);
|
||||||
|
|
||||||
|
#if FIX_THROUGH_NETFABB_ALWAYS
|
||||||
|
// Fixing always.
|
||||||
|
return ! obj_idxs.empty() || ! vol_idxs.empty();
|
||||||
|
#else // FIX_THROUGH_NETFABB_ALWAYS
|
||||||
|
// Fixing only if the model is not manifold.
|
||||||
if (vol_idxs.empty()) {
|
if (vol_idxs.empty()) {
|
||||||
for (auto obj_idx : obj_idxs)
|
for (auto obj_idx : obj_idxs)
|
||||||
if (model.objects[obj_idx]->get_mesh_errors_count() > 0)
|
if (model.objects[obj_idx]->get_mesh_errors_count() > 0)
|
||||||
|
@ -4547,11 +4552,10 @@ bool Plater::priv::can_fix_through_netfabb() const
|
||||||
for (auto vol_idx : vol_idxs)
|
for (auto vol_idx : vol_idxs)
|
||||||
if (model.objects[obj_idx]->get_mesh_errors_count(vol_idx) > 0)
|
if (model.objects[obj_idx]->get_mesh_errors_count(vol_idx) > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
#endif // FIX_THROUGH_NETFABB_ALWAYS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Plater::priv::can_simplify() const
|
bool Plater::priv::can_simplify() const
|
||||||
{
|
{
|
||||||
// is object for simplification selected
|
// is object for simplification selected
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue