ENH: CLI: add the cache logic of brim data

1. cache the first layer group cache data for brim
2. fix some crash under debug mode when app exits

Change-Id: I81d716564af414353e9dfeed42e5f4eef08b2d6f
(cherry picked from commit a6ecdaed6f63f1c5c41fd343f72165fe27fda9d3)
This commit is contained in:
lane.wei 2023-04-03 21:37:03 +08:00 committed by Lane.Wei
parent f3aa76e4c2
commit b30644c84d
3 changed files with 294 additions and 194 deletions

View file

@ -137,14 +137,12 @@ BedType PartPlate::get_bed_type(bool load_from_project) const
{
std::string bed_type_key = "curr_bed_type";
// should be called in GUI context
assert(m_plater != nullptr);
if (m_config.has(bed_type_key)) {
BedType bed_type = m_config.opt_enum<BedType>(bed_type_key);
return bed_type;
}
if (!load_from_project || !wxGetApp().preset_bundle)
if (!load_from_project || !m_plater || !wxGetApp().preset_bundle)
return btDefault;
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
@ -226,9 +224,6 @@ PrintSequence PartPlate::get_print_seq() const
{
std::string print_seq_key = "print_sequence";
// should be called in GUI context
assert(m_plater != nullptr);
if (m_config.has(print_seq_key)) {
PrintSequence print_seq = m_config.opt_enum<PrintSequence>(print_seq_key);
return print_seq;