mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-21 17:39:10 -07:00
Trying to engage support creation when the gizmo gets disabled.
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
#include <igl/unproject_onto_mesh.h>
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <SLA/SLASupportTree.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
|
||||
@@ -1599,6 +1601,29 @@ void GLGizmoSlaSupports::update_mesh()
|
||||
}
|
||||
}
|
||||
|
||||
void GLGizmoSlaSupports::on_deactivate() {
|
||||
if(!m_model_object) return;
|
||||
|
||||
sla::Controller supportctl;
|
||||
std::cout << "Generating supports:" << std::endl;
|
||||
|
||||
// TODO: somehow get the global status indicator
|
||||
supportctl.statuscb = [] (unsigned st, const std::string& msg) {
|
||||
std::cout << st << "% " << msg << std::endl;
|
||||
};
|
||||
|
||||
const Model& model = *m_model_object->get_model();
|
||||
auto emesh = sla::to_eigenmesh(model);
|
||||
sla::PointSet input = sla::support_points(model);
|
||||
sla::SupportConfig cfg;
|
||||
|
||||
sla::SLASupportTree stree(input, emesh, cfg, supportctl);
|
||||
|
||||
TriangleMesh output;
|
||||
stree.merged_mesh(output);
|
||||
m_model_object->add_volume(output);
|
||||
}
|
||||
|
||||
Vec3f GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse_pos)
|
||||
{
|
||||
// if the gizmo doesn't have the V, F structures for igl, calculate them first:
|
||||
|
||||
Reference in New Issue
Block a user