Hollowing gizmo can now trigger the backend calculation

This commit is contained in:
Lukas Matena 2020-01-23 11:22:06 +01:00
parent d58ee47e4d
commit 1c0aedbbe5
5 changed files with 25 additions and 4 deletions

View file

@ -1119,6 +1119,10 @@ TriangleMesh SLAPrintObject::get_mesh(SLAPrintObjectStep step) const
return this->support_mesh();
case slaposPad:
return this->pad_mesh();
case slaposHollowing:
if (m_hollowing_data)
return m_hollowing_data->hollow_mesh_with_holes;
[[fallthrough]];
default:
return TriangleMesh();
}

View file

@ -608,10 +608,14 @@ void GLGizmoHollow::update_mesh_raycaster(std::unique_ptr<MeshRaycaster> &&rc)
m_c->m_volume_with_cavity.reset();
}
void GLGizmoHollow::hollow_mesh()
void GLGizmoHollow::hollow_mesh(bool postpone_error_messages)
{
// Trigger a UI job to hollow the mesh.
wxGetApp().plater()->hollow();
// wxGetApp().plater()->hollow();
wxGetApp().CallAfter([this, postpone_error_messages]() {
wxGetApp().plater()->reslice_SLA_hollowing(*m_c->m_model_object, postpone_error_messages);
});
}

View file

@ -55,7 +55,7 @@ private:
void render_hollowed_mesh() const;
bool is_mesh_update_necessary() const;
void update_mesh();
void hollow_mesh();
void hollow_mesh(bool postpone_error_messages = false);
bool unsaved_changes() const;
bool m_show_supports = true;

View file

@ -5099,6 +5099,16 @@ void Plater::reslice()
}
void Plater::reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages)
{
reslice_SLA_until_step(slaposPad, object, postpone_error_messages);
}
void Plater::reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages)
{
reslice_SLA_until_step(slaposHollowing, object, postpone_error_messages);
}
void Plater::reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &object, bool postpone_error_messages)
{
//FIXME Don't reslice if export of G-code or sending to OctoPrint is running.
// bitmask of UpdateBackgroundProcessReturnState
@ -5117,7 +5127,7 @@ void Plater::reslice_SLA_supports(const ModelObject &object, bool postpone_error
// Otherwise calculate everything, but start with the provided object.
if (!this->p->background_processing_enabled()) {
task.single_model_instance_only = true;
task.to_object_step = slaposPad;
task.to_object_step = step;
}
this->p->background_process.set_task(task);
// and let the background processing start.

View file

@ -26,6 +26,7 @@ class Model;
class ModelObject;
class Print;
class SLAPrint;
enum SLAPrintObjectStep : unsigned int;
namespace UndoRedo {
class Stack;
@ -197,6 +198,8 @@ public:
void hollow();
void reslice();
void reslice_SLA_supports(const ModelObject &object, bool postpone_error_messages = false);
void reslice_SLA_hollowing(const ModelObject &object, bool postpone_error_messages = false);
void reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &object, bool postpone_error_messages = false);
void changed_object(int obj_idx);
void changed_objects(const std::vector<size_t>& object_idxs);
void schedule_background_process(bool schedule = true);