Progress indication for hollowing gizmo.

This commit is contained in:
tamasmeszaros 2019-11-11 16:10:46 +01:00
parent 35ba7a481c
commit 60650d0dfc
3 changed files with 66 additions and 27 deletions

View file

@ -571,30 +571,35 @@ std::pair<const TriangleMesh *, sla::HollowingConfig> GLGizmoHollow::get_hollowi
return std::make_pair(m_mesh, sla::HollowingConfig{double(m_offset), double(m_accuracy), double(m_closing_d)});
}
void GLGizmoHollow::set_hollowing_result(std::unique_ptr<TriangleMesh> mesh)
{
// Called from Plater when the UI job finishes
m_cavity_mesh = std::move(mesh);
m_mesh_raycaster.reset(new MeshRaycaster(*m_cavity_mesh.get()));
m_object_clipper.reset();
m_volume_with_cavity.reset();
if(m_cavity_mesh) {// create a new GLVolume that only has the cavity inside
Geometry::Transformation volume_trafo = m_model_object->volumes.front()->get_transformation();
volume_trafo.set_offset(volume_trafo.get_offset() + Vec3d(0., 0., m_z_shift));
m_volume_with_cavity.reset(new GLVolume(1.f, 0.f, 0.f, 0.5f));
m_volume_with_cavity->indexed_vertex_array.load_mesh(*m_cavity_mesh.get());
m_volume_with_cavity->set_volume_transformation(volume_trafo);
m_volume_with_cavity->set_instance_transformation(m_model_object->instances[size_t(m_active_instance)]->get_transformation());
}
}
void GLGizmoHollow::hollow_mesh()
{
// Trigger a UI job to hollow the mesh.
wxGetApp().plater()->hollow();
}
void GLGizmoHollow::update_hollowed_mesh(std::unique_ptr<TriangleMesh> mesh)
void GLGizmoHollow::update_hollowed_mesh()
{
// Called from Plater when the UI job finishes
m_cavity_mesh = std::move(mesh);
m_mesh_raycaster.reset(new MeshRaycaster(*m_cavity_mesh.get()));
m_object_clipper.reset();
m_volume_with_cavity.reset();
if(m_cavity_mesh) {// create a new GLVolume that only has the cavity inside
Geometry::Transformation volume_trafo = m_model_object->volumes.front()->get_transformation();
volume_trafo.set_offset(volume_trafo.get_offset() + Vec3d(0., 0., m_z_shift));
m_volume_with_cavity.reset(new GLVolume(1.f, 0.f, 0.f, 0.5f));
m_volume_with_cavity->indexed_vertex_array.load_mesh(*m_cavity_mesh.get());
m_volume_with_cavity->finalize_geometry(true);
m_volume_with_cavity->set_volume_transformation(volume_trafo);
m_volume_with_cavity->set_instance_transformation(m_model_object->instances[m_active_instance]->get_transformation());
}
if (m_volume_with_cavity) m_volume_with_cavity->finalize_geometry(true);
m_parent.toggle_model_objects_visibility(! m_cavity_mesh, m_model_object, m_active_instance);
}