Changed logic to avoid saving a project while a gizmo is in editing mode

This commit is contained in:
enricoturri1966 2021-06-01 08:32:58 +02:00
parent 580dc890b8
commit 1d4f7a8870
2 changed files with 12 additions and 4 deletions

View File

@ -207,6 +207,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// declare events
Bind(wxEVT_CLOSE_WINDOW, [this](wxCloseEvent& event) {
#if ENABLE_PROJECT_DIRTY_STATE
if (event.CanVeto() && m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(true)) {
// prevents to open the save dirty project dialog
event.Veto();
return;
}
if (m_plater != nullptr)
m_plater->save_project_if_dirty();
@ -691,12 +697,15 @@ bool MainFrame::can_start_new_project() const
#if ENABLE_PROJECT_DIRTY_STATE
bool MainFrame::can_save() const
{
return (m_plater != nullptr) && !m_plater->model().objects.empty() && !m_plater->get_project_filename().empty() && m_plater->is_project_dirty();
return (m_plater != nullptr) && !m_plater->model().objects.empty() &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false) &&
!m_plater->get_project_filename().empty() && m_plater->is_project_dirty();
}
bool MainFrame::can_save_as() const
{
return (m_plater != nullptr) && !m_plater->model().objects.empty();
return (m_plater != nullptr) && !m_plater->model().objects.empty() &&
!m_plater->canvas3D()->get_gizmos_manager().is_in_editing_mode(false);
}
void MainFrame::save_project()

View File

@ -5371,8 +5371,7 @@ bool Plater::export_3mf(const boost::filesystem::path& output_path)
void Plater::export_3mf(const boost::filesystem::path& output_path)
#endif // ENABLE_PROJECT_DIRTY_STATE
{
if (p->model.objects.empty()
|| canvas3D()->get_gizmos_manager().is_in_editing_mode(true))
if (p->model.objects.empty())
#if ENABLE_PROJECT_DIRTY_STATE
return false;
#else