SPE-1677 - Disable SLA supports and Hollow gizmos when the selected object is non-printable. Do not allow to set to non-printable an object while the SLA supports and Hollow gizmos are active.

This commit is contained in:
enricoturri1966 2023-04-24 13:58:01 +02:00
parent bbea397aa6
commit f9c1abbd50
4 changed files with 30 additions and 5 deletions

View File

@ -743,6 +743,14 @@ wxMenuItem* MenuFactory::append_menu_item_printable(wxMenu* menu)
} }
evt.Check(check); evt.Check(check);
// disable the menu item if SLA supports or Hollow gizmos are active
if (printer_technology() == ptSLA) {
const auto gizmo_type = plater()->canvas3D()->get_gizmos_manager().get_current_type();
const bool enable = gizmo_type != GLGizmosManager::SlaSupports && gizmo_type != GLGizmosManager::Hollow;
evt.Enable(enable);
}
plater()->set_current_canvas_as_dirty(); plater()->set_current_canvas_as_dirty();
}, menu_item_printable->GetId()); }, menu_item_printable->GetId());

View File

@ -820,6 +820,12 @@ bool GLGizmoHollow::on_is_activable() const
if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0) if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0)
return false; return false;
// Check that none of the selected volumes is marked as non-pritable.
for (const auto& idx : list) {
if (!selection.get_volume(idx)->printable)
return false;
}
return true; return true;
} }

View File

@ -65,9 +65,13 @@ void GLGizmoSlaSupports::data_changed(bool is_serializing)
// If we triggered autogeneration before, check backend and fetch results if they are there // If we triggered autogeneration before, check backend and fetch results if they are there
if (mo) { if (mo) {
m_c->instances_hider()->set_hide_full_scene(true); m_c->instances_hider()->set_hide_full_scene(true);
const SLAPrintObject* po = m_c->selection_info()->print_object();
int last_comp_step = slaposCount;
const int required_step = get_min_sla_print_object_step(); const int required_step = get_min_sla_print_object_step();
auto last_comp_step = static_cast<int>(po->last_completed_step()); const SLAPrintObject* po = m_c->selection_info()->print_object();
if (po != nullptr)
last_comp_step = static_cast<int>(po->last_completed_step());
if (last_comp_step == slaposCount) if (last_comp_step == slaposCount)
last_comp_step = -1; last_comp_step = -1;
@ -793,6 +797,12 @@ bool GLGizmoSlaSupports::on_is_activable() const
if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0) if (selection.get_volume(idx)->is_outside && selection.get_volume(idx)->composite_id.volume_id >= 0)
return false; return false;
// Check that none of the selected volumes is marked as non-pritable.
for (const auto& idx : list) {
if (!selection.get_volume(idx)->printable)
return false;
}
return true; return true;
} }

View File

@ -261,11 +261,12 @@ void Raycaster::on_update()
// For sla printers we use the mesh generated by the backend // For sla printers we use the mesh generated by the backend
std::shared_ptr<const indexed_triangle_set> preview_mesh_ptr; std::shared_ptr<const indexed_triangle_set> preview_mesh_ptr;
const SLAPrintObject* po = get_pool()->selection_info()->print_object(); const SLAPrintObject* po = get_pool()->selection_info()->print_object();
if (po) if (po != nullptr)
preview_mesh_ptr = po->get_mesh_to_print(); preview_mesh_ptr = po->get_mesh_to_print();
else
preview_mesh_ptr.reset();
if (preview_mesh_ptr) m_sla_mesh_cache = (preview_mesh_ptr != nullptr) ? TriangleMesh{ *preview_mesh_ptr } : TriangleMesh();
m_sla_mesh_cache = TriangleMesh{*preview_mesh_ptr};
if (!m_sla_mesh_cache.empty()) { if (!m_sla_mesh_cache.empty()) {
m_sla_mesh_cache.transform(po->trafo().inverse()); m_sla_mesh_cache.transform(po->trafo().inverse());