FIX: fix the duplicate model issue after open recent project in some corner cases

github issue-1185

Change-Id: I3be5be473cfe7328c4781b1533093cd860e64387
This commit is contained in:
lane.wei 2023-01-30 16:37:02 +08:00 committed by Lane.Wei
parent 7102a1e235
commit 64173b3fa3
4 changed files with 18 additions and 2 deletions

View File

@ -5347,6 +5347,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool sub_model = !objects_data.empty(); bool sub_model = !objects_data.empty();
bool write_object = sub_model || !m_split_model; bool write_object = sub_model || !m_split_model;
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", filename %1%, m_split_model %2%, sub_model %3%")%filename % m_split_model % sub_model;
#if WRITE_ZIP_LANGUAGE_ENCODING #if WRITE_ZIP_LANGUAGE_ENCODING
auto & zip_filename = filename; auto & zip_filename = filename;
#else #else

View File

@ -4279,8 +4279,8 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
plate_data_item->objects_and_instances.emplace_back(it->first, it->second); plate_data_item->objects_and_instances.emplace_back(it->first, it->second);
} }
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1%, gcode_filename=%2%, with_slice_info=%3%, slice_valid %4%") BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1%, gcode_filename=%2%, with_slice_info=%3%, slice_valid %4%, object item count %5%.")
%i %m_plate_list[i]->m_gcode_result->filename % with_slice_info %m_plate_list[i]->is_slice_result_valid(); %i %m_plate_list[i]->m_gcode_result->filename % with_slice_info %m_plate_list[i]->is_slice_result_valid()%plate_data_item->objects_and_instances.size();
if (with_slice_info) { if (with_slice_info) {
if (m_plate_list[i]->get_slice_result() && m_plate_list[i]->is_slice_result_valid()) { if (m_plate_list[i]->get_slice_result() && m_plate_list[i]->is_slice_result_valid()) {

View File

@ -7423,6 +7423,7 @@ int Plater::new_project(bool skip_confirm, bool silent)
m_only_gcode = false; m_only_gcode = false;
m_exported_file = false; m_exported_file = false;
m_loading_project = false;
get_notification_manager()->bbl_close_plateinfo_notification(); get_notification_manager()->bbl_close_plateinfo_notification();
get_notification_manager()->bbl_close_preview_only_notification(); get_notification_manager()->bbl_close_preview_only_notification();
@ -7494,6 +7495,16 @@ void Plater::load_project(wxString const& filename2,
//BBS: add only gcode mode //BBS: add only gcode mode
bool previous_gcode = m_only_gcode; bool previous_gcode = m_only_gcode;
// BBS
if (m_loading_project) {
//some error cases happens
//return directly
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": current loading other project, return directly");
return;
}
else
m_loading_project = true;
m_only_gcode = false; m_only_gcode = false;
m_exported_file = false; m_exported_file = false;
get_notification_manager()->bbl_close_plateinfo_notification(); get_notification_manager()->bbl_close_plateinfo_notification();
@ -7558,6 +7569,8 @@ void Plater::load_project(wxString const& filename2,
up_to_date(true, true); up_to_date(true, true);
wxGetApp().params_panel()->switch_to_object_if_has_object_configs(); wxGetApp().params_panel()->switch_to_object_if_has_object_configs();
m_loading_project = false;
} }
// BBS: save logic // BBS: save logic

View File

@ -688,6 +688,7 @@ private:
bool m_only_gcode { false }; bool m_only_gcode { false };
bool m_exported_file { false }; bool m_exported_file { false };
bool skip_thumbnail_invalid { false }; bool skip_thumbnail_invalid { false };
bool m_loading_project {false };
std::string m_preview_only_filename; std::string m_preview_only_filename;
int m_valid_plates_count { 0 }; int m_valid_plates_count { 0 };