From cce3041a95239e08afc8a61bab8159bd3d5074b1 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Fri, 20 Aug 2021 07:53:33 +0200 Subject: [PATCH] Add warning as tip for simplify big model. --- src/slic3r/GUI/Plater.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e037a0ac8..4af8637e4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2408,6 +2408,28 @@ std::vector Plater::priv::load_files(const std::vector& input_ return obj_idxs; } + // detection of simplification suggestion + const uint32_t triangles_to_suggest_simplify = 1000000; + for (const ModelObject *model_object : model.objects) { + const indexed_triangle_set &its = + model_object->volumes.front()->mesh().its; + uint32_t triangle_count = its.indices.size(); + if (triangle_count > triangles_to_suggest_simplify) { + std::string text = _u8L("Processing models with more than 1M triangles" + " could be slow. It is highly recommend to reduce amount of triangles.") + "\n"; + std::string hypertext = "Simplify mesh."; + std::function action_fn = [&](wxEvtHandler *) { + auto &manager = q->canvas3D()->get_gizmos_manager(); + manager.open_gizmo(GLGizmosManager::EType::Simplify); + return true; + }; + notification_manager->push_notification( + NotificationType::CustomNotification, + NotificationManager::NotificationLevel::WarningNotification, + _u8L("WARNING:") + "\n" + text, hypertext, action_fn); + } + } + for (ModelObject* model_object : model.objects) { if (!type_3mf && !type_zip_amf) model_object->center_around_origin(false);