FIX: repair: fix the state not correct issue after repair

Change-Id: Ic4aaeaeeee921294e0a5ab6d82517dc28f8822c8
This commit is contained in:
lane.wei 2022-12-30 23:49:16 +08:00 committed by Lane.Wei
parent 54aae68874
commit f0908f2a63
5 changed files with 29 additions and 19 deletions

View file

@ -2570,6 +2570,7 @@ size_t ModelVolume::split(unsigned int max_extruders)
if (idx == 0) { if (idx == 0) {
this->set_mesh(std::move(mesh)); this->set_mesh(std::move(mesh));
this->calculate_convex_hull(); this->calculate_convex_hull();
this->invalidate_convex_hull_2d();
// Assign a new unique ID, so that a new GLVolume will be generated. // Assign a new unique ID, so that a new GLVolume will be generated.
this->set_new_unique_id(); this->set_new_unique_id();
// reset the source to disable reload from disk // reset the source to disable reload from disk

View file

@ -756,6 +756,10 @@ public:
const std::shared_ptr<const TriangleMesh>& get_convex_hull_shared_ptr() const { return m_convex_hull; } const std::shared_ptr<const TriangleMesh>& get_convex_hull_shared_ptr() const { return m_convex_hull; }
//BBS: add convex_hell_2d related logic //BBS: add convex_hell_2d related logic
const Polygon& get_convex_hull_2d(const Transform3d &trafo_instance) const; const Polygon& get_convex_hull_2d(const Transform3d &trafo_instance) const;
void invalidate_convex_hull_2d()
{
m_convex_hull_2d.clear();
}
// Get count of errors in the mesh // Get count of errors in the mesh
int get_repaired_errors_count() const; int get_repaired_errors_count() const;

View file

@ -4707,10 +4707,13 @@ void ObjectList::fix_through_netfabb()
std::string res; std::string res;
if (!fix_model_by_win10_sdk_gui(*(object(obj_idx)), vol_idx, progress_dlg, msg, res)) if (!fix_model_by_win10_sdk_gui(*(object(obj_idx)), vol_idx, progress_dlg, msg, res))
return false; return false;
wxGetApp().plater()->changed_mesh(obj_idx); //wxGetApp().plater()->changed_mesh(obj_idx);
plater->changed_mesh(obj_idx); plater->changed_mesh(obj_idx);
plater->get_partplate_list().notify_instance_update(obj_idx, 0);
plater->sidebar().obj_list()->update_plate_values_for_items();
if (res.empty()) if (res.empty())
succes_models.push_back(model_name); succes_models.push_back(model_name);
else else

View file

@ -542,6 +542,7 @@ void GLGizmoSimplify::apply_simplify() {
mv->set_mesh(std::move(*m_state.result)); mv->set_mesh(std::move(*m_state.result));
m_state.result.reset(); m_state.result.reset();
mv->calculate_convex_hull(); mv->calculate_convex_hull();
mv->invalidate_convex_hull_2d();
mv->set_new_unique_id(); mv->set_new_unique_id();
mv->get_object()->invalidate_bounding_box(); mv->get_object()->invalidate_bounding_box();
mv->get_object()->ensure_on_bed(); mv->get_object()->ensure_on_bed();

View file

@ -403,6 +403,7 @@ bool fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx, GUI::
for (size_t i = 0; i < volumes.size(); ++ i) { for (size_t i = 0; i < volumes.size(); ++ i) {
volumes[i]->set_mesh(std::move(meshes_repaired[i])); volumes[i]->set_mesh(std::move(meshes_repaired[i]));
volumes[i]->calculate_convex_hull(); volumes[i]->calculate_convex_hull();
volumes[i]->invalidate_convex_hull_2d();
volumes[i]->set_new_unique_id(); volumes[i]->set_new_unique_id();
} }
model_object.invalidate_bounding_box(); model_object.invalidate_bounding_box();