From ffc92090ccfaa02c99ce8f365f104ac9567ccb68 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Mon, 30 Aug 2021 10:51:04 +0200 Subject: [PATCH] Fix simplify --- src/libslic3r/QuadricEdgeCollapse.hpp | 4 ++++ src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp | 11 ++++++----- src/slic3r/GUI/Gizmos/GLGizmoSimplify.hpp | 4 +++- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 7 ++++--- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/QuadricEdgeCollapse.hpp b/src/libslic3r/QuadricEdgeCollapse.hpp index c7330bfc5..956ad3511 100644 --- a/src/libslic3r/QuadricEdgeCollapse.hpp +++ b/src/libslic3r/QuadricEdgeCollapse.hpp @@ -1,3 +1,6 @@ +#ifndef slic3r_quadric_edge_collapse_hpp_ +#define slic3r_quadric_edge_collapse_hpp_ + // paper: https://people.eecs.berkeley.edu/~jrs/meshpapers/GarlandHeckbert2.pdf // sum up: https://users.csc.calpoly.edu/~zwood/teaching/csc570/final06/jseeba/ // inspiration: https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification @@ -26,3 +29,4 @@ void its_quadric_edge_collapse( std::function statusfn = nullptr); } // namespace Slic3r +#endif // slic3r_quadric_edge_collapse_hpp_ diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp index d4e14c6f4..ef8e708f9 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp @@ -10,11 +10,9 @@ #include "libslic3r/QuadricEdgeCollapse.hpp" namespace Slic3r::GUI { - -GLGizmoSimplify::GLGizmoSimplify(GLCanvas3D & parent, - const std::string &icon_filename, - unsigned int sprite_id) - : GLGizmoBase(parent, icon_filename, -1) + +GLGizmoSimplify::GLGizmoSimplify(GLCanvas3D &parent) + : GLGizmoBase(parent, M_ICON_FILENAME, -1) , m_state(State::settings) , m_is_valid_result(false) , m_exist_preview(false) @@ -383,4 +381,7 @@ void GLGizmoSimplify::request_rerender() { }); } +// any existing icon filename to not influence GUI +const std::string GLGizmoSimplify::M_ICON_FILENAME = "cut.svg"; + } // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.hpp index 0f5bd5991..9754e07c1 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSimplify.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSimplify.hpp @@ -19,7 +19,7 @@ namespace GUI { class GLGizmoSimplify : public GLGizmoBase { public: - GLGizmoSimplify(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); + GLGizmoSimplify(GLCanvas3D& parent); virtual ~GLGizmoSimplify(); protected: virtual bool on_init() override; @@ -99,6 +99,8 @@ private: const std::string tr_preview; const std::string tr_detail_level; const std::string tr_decimate_ratio; + + static const std::string M_ICON_FILENAME; }; } // namespace GUI diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 6d9a03977..556983060 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -104,7 +104,7 @@ bool GLGizmosManager::init() m_gizmos.emplace_back(new GLGizmoFdmSupports(m_parent, "fdm_supports.svg", 7)); m_gizmos.emplace_back(new GLGizmoSeam(m_parent, "seam.svg", 8)); m_gizmos.emplace_back(new GLGizmoMmuSegmentation(m_parent, "mmu_segmentation.svg", 9)); - m_gizmos.emplace_back(new GLGizmoSimplify(m_parent, "cut.svg", 10)); + m_gizmos.emplace_back(new GLGizmoSimplify(m_parent)); m_common_gizmos_data.reset(new CommonGizmosDataPool(&m_parent)); @@ -1133,9 +1133,10 @@ bool GLGizmosManager::generate_icons_texture() const std::vector filenames; for (size_t idx=0; idxget_icon_filename(); + const std::string& icon_filename = gizmo->get_icon_filename(); if (!icon_filename.empty()) filenames.push_back(path + icon_filename); }