This commit is contained in:
Filip Sykala - NTB T15p 2023-01-31 14:09:05 +01:00
commit 9bfd03fef3
3 changed files with 2 additions and 14 deletions

View File

@ -62,7 +62,7 @@ void GLGizmoSlaBase::update_volumes()
new_volume->set_instance_transformation(po->model_object()->instances[m_parent.get_selection().get_instance_idx()]->get_transformation());
new_volume->set_sla_shift_z(po->get_current_elevation());
new_volume->mesh_raycaster = std::make_unique<GUI::MeshRaycaster>(backend_mesh);
m_input_enabled = last_completed_step(*m_c->selection_info()->print_object()->print()) >= m_min_sla_print_object_step;
m_input_enabled = po->last_completed_step() >= m_min_sla_print_object_step;
if (m_input_enabled)
new_volume->selected = true; // to set the proper color
else
@ -127,16 +127,6 @@ void GLGizmoSlaBase::unregister_volume_raycasters_for_picking()
m_volume_raycasters.clear();
}
int GLGizmoSlaBase::last_completed_step(const SLAPrint& sla)
{
int step = -1;
for (int i = 0; i < (int)SLAPrintObjectStep::slaposCount; ++i) {
if (sla.is_step_done((SLAPrintObjectStep)i))
++step;
}
return step;
}
// Unprojects the mouse position on the mesh and saves hit point and normal of the facet into pos_and_normal
// Return false if no intersection was found, true otherwise.
bool GLGizmoSlaBase::unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal)

View File

@ -38,8 +38,6 @@ protected:
bool is_input_enabled() const { return m_input_enabled; }
int get_min_sla_print_object_step() const { return m_min_sla_print_object_step; }
static int last_completed_step(const SLAPrint& sla);
bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
const GLVolumeCollection &volumes() const { return m_volumes; }

View File

@ -66,7 +66,7 @@ void GLGizmoSlaSupports::data_changed()
m_c->instances_hider()->set_hide_full_scene(true);
const SLAPrintObject* po = m_c->selection_info()->print_object();
const int required_step = get_min_sla_print_object_step();
if (po != nullptr && last_completed_step(*po->print()) < required_step)
if (po != nullptr && po->last_completed_step() < required_step)
reslice_until_step((SLAPrintObjectStep)required_step, false);
update_volumes();