Skip to content

Commit

Permalink
FIX: fix the duplicate model issue after open recent project in some …
Browse files Browse the repository at this point in the history
…corner cases
  • Loading branch information
lanewei120 committed Jan 31, 2023
1 parent cde8e28 commit eacf0d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/libslic3r/Format/bbs_3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5347,6 +5347,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool sub_model = !objects_data.empty();
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
auto & zip_filename = filename;
#else
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/PartPlate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4273,8 +4273,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);
}

BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<boost::format(": plate %1%, gcode_filename=%2%, with_slice_info=%3%, slice_valid %4%")
%i %m_plate_list[i]->m_gcode_result->filename % with_slice_info %m_plate_list[i]->is_slice_result_valid();
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()%plate_data_item->objects_and_instances.size();

if (with_slice_info) {
if (m_plate_list[i]->get_slice_result() && m_plate_list[i]->is_slice_result_valid()) {
Expand Down
13 changes: 13 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7432,6 +7432,7 @@ int Plater::new_project(bool skip_confirm, bool silent)

m_only_gcode = false;
m_exported_file = false;
m_loading_project = false;
get_notification_manager()->bbl_close_plateinfo_notification();
get_notification_manager()->bbl_close_preview_only_notification();

Expand Down Expand Up @@ -7503,6 +7504,16 @@ void Plater::load_project(wxString const& filename2,
//BBS: add only gcode mode
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_exported_file = false;
get_notification_manager()->bbl_close_plateinfo_notification();
Expand Down Expand Up @@ -7567,6 +7578,8 @@ void Plater::load_project(wxString const& filename2,
up_to_date(true, true);

wxGetApp().params_panel()->switch_to_object_if_has_object_configs();

m_loading_project = false;
}

// BBS: save logic
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Plater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ class Plater: public wxPanel
bool m_only_gcode { false };
bool m_exported_file { false };
bool skip_thumbnail_invalid { false };
bool m_loading_project {false };
std::string m_preview_only_filename;
int m_valid_plates_count { 0 };

Expand Down

0 comments on commit eacf0d5

Please sign in to comment.