Show a notification when attempting to slice during SLA support points editing

This should also fix #5736 and a similar crash when deleting an object during manual editing (which was introduced between 2.2.0 and 2.3.0)
This commit is contained in:
Lukas Matena 2021-02-22 13:35:00 +01:00
parent 1904b7b904
commit 3fd36f08e0
4 changed files with 36 additions and 7 deletions

View file

@ -790,6 +790,9 @@ Sidebar::Sidebar(Plater *parent)
p->btn_export_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->export_gcode(false); });
p->btn_reslice->Bind(wxEVT_BUTTON, [this](wxCommandEvent&)
{
if (p->plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
return;
const bool export_gcode_after_slicing = wxGetKeyState(WXK_SHIFT);
if (export_gcode_after_slicing)
p->plater->export_gcode(true);
@ -4214,9 +4217,9 @@ bool Plater::priv::can_fix_through_netfabb() const
bool Plater::priv::can_increase_instances() const
{
if (m_ui_jobs.is_any_running()) {
return false;
}
if (m_ui_jobs.is_any_running()
|| q->canvas3D()->get_gizmos_manager().is_in_editing_mode())
return false;
int obj_idx = get_selected_object_idx();
return (0 <= obj_idx) && (obj_idx < (int)model.objects.size());
@ -4224,9 +4227,9 @@ bool Plater::priv::can_increase_instances() const
bool Plater::priv::can_decrease_instances() const
{
if (m_ui_jobs.is_any_running()) {
return false;
}
if (m_ui_jobs.is_any_running()
|| q->canvas3D()->get_gizmos_manager().is_in_editing_mode())
return false;
int obj_idx = get_selected_object_idx();
return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) && (model.objects[obj_idx]->instances.size() > 1);
@ -5116,6 +5119,10 @@ void Plater::export_gcode(bool prefer_removable)
if (p->model.objects.empty())
return;
if (canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
return;
if (p->process_completed_with_error)
return;
@ -5391,6 +5398,11 @@ void Plater::reslice()
if (p->process_completed_with_error)
return;
// In case SLA gizmo is in editing mode, refuse to continue
// and notify user that he should leave it first.
if (canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
return;
// Stop arrange and (or) optimize rotation tasks.
this->stop_jobs();