FIX: do not allow auto arranging or orienting when slicing

do not allow arranging/orienting when slicing

Jira: STUDIO-5489
Change-Id: I7773941e5aca6819e2b65a5103ea917702fefcad
This commit is contained in:
Arthur 2023-12-22 17:05:46 +08:00 committed by Lane.Wei
parent e3f1efbb36
commit 91d135a4de
2 changed files with 44 additions and 32 deletions

View File

@ -1237,11 +1237,15 @@ void MenuFactory::create_plate_menu()
[](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->arrange();
if (!plate->get_objects().empty() && !plater()->is_background_process_slicing())
{
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->arrange();
}
}, "", nullptr,
[]() {
return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty();
return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty() && !plater()->is_background_process_slicing();
},
m_parent);
@ -1250,12 +1254,15 @@ void MenuFactory::create_plate_menu()
[](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
//BBS TODO call auto rotate for current plate
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->orient();
if (!plate->get_objects().empty() && !plater()->is_background_process_slicing())
{
//BBS TODO call auto rotate for current plate
plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->orient();
}
}, "", nullptr,
[]() {
return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty();
return !plater()->get_partplate_list().get_selected_plate()->get_objects().empty() && !plater()->is_background_process_slicing();
}, m_parent);
// delete current plate

View File

@ -8065,7 +8065,7 @@ bool Plater::priv::can_split_to_volumes() const
bool Plater::priv::can_arrange() const
{
return !model.objects.empty() && !m_ui_jobs.is_any_running();
return !model.objects.empty() && !m_ui_jobs.is_any_running() && !q->is_background_process_slicing();
}
bool Plater::priv::layers_height_allowed() const
@ -8790,7 +8790,6 @@ void Plater::load_project(wxString const& filename2,
wxString const& originfile)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "filename is: " << filename2 << "and originfile is: " << originfile;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__;
auto filename = filename2;
auto check = [&filename, this] (bool yes_or_no) {
if (!yes_or_no && !wxGetApp().check_and_save_current_preset_changes(_L("Load project"),
@ -13475,36 +13474,42 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
}
else if ((action == 2)&&(!right_click))
{
//arrange the plate
//take_snapshot("select_orient partplate");
ret = select_plate(plate_index);
if (!ret)
if (!p->partplate_list.get_plate(plate_index)->get_objects().empty() && !is_background_process_slicing())
{
set_prepare_state(Job::PREPARE_STATE_MENU);
orient();
}
else
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
ret = -1;
//arrange the plate
//take_snapshot("select_orient partplate");
ret = select_plate(plate_index);
if (!ret)
{
set_prepare_state(Job::PREPARE_STATE_MENU);
orient();
}
else
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
ret = -1;
}
}
}
else if ((action == 3)&&(!right_click))
{
//arrange the plate
//take_snapshot("select_arrange partplate");
ret = select_plate(plate_index);
if (!ret)
if (!p->partplate_list.get_plate(plate_index)->get_objects().empty() && !is_background_process_slicing())
{
if (last_arrange_job_is_finished()) {
set_prepare_state(Job::PREPARE_STATE_MENU);
arrange();
//arrange the plate
//take_snapshot("select_arrange partplate");
ret = select_plate(plate_index);
if (!ret)
{
if (last_arrange_job_is_finished()) {
set_prepare_state(Job::PREPARE_STATE_MENU);
arrange();
}
}
else
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
ret = -1;
}
}
else
{
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "can not select plate %1%" << plate_index;
ret = -1;
}
}
else if ((action == 4)&&(!right_click))