FIX: sync with master(update slice state)

Change-Id: Iec749349837d969c0a84b56d16d0fb32ed594c0a
This commit is contained in:
tao.jin 2022-11-25 17:01:53 +08:00 committed by Lane.Wei
parent 8216265725
commit 1e4582f966
2 changed files with 9 additions and 22 deletions

View file

@ -95,7 +95,7 @@ void PartPlate::load_render_colors()
PartPlate::PartPlate()
: ObjectBase(-1), m_plater(nullptr), m_model(nullptr), m_quadric(nullptr),last_bed_type(BedType::btCount)
: ObjectBase(-1), m_plater(nullptr), m_model(nullptr), m_quadric(nullptr)
{
assert(this->id().invalid());
init();
@ -166,34 +166,22 @@ void PartPlate::set_bed_type(BedType bed_type)
assert(m_plater != nullptr);
// update slice state
if (last_bed_type == BedType::btDefault){
if (bed_type != BedType::btDefault) {
// get global bed type
BedType global_bed_type = wxGetApp().preset_bundle->project_config.opt_enum<BedType>("curr_bed_type");
if (global_bed_type != bed_type)
update_slice_result_valid_state(false);
}
}
else{
BedType old_real_bed_type = get_bed_type();
BedType new_real_bed_type = bed_type;
if (bed_type == BedType::btDefault) {
// get global bed type
BedType global_bed_type = wxGetApp().preset_bundle->project_config.opt_enum<BedType>("curr_bed_type");
if (last_bed_type != global_bed_type)
update_slice_result_valid_state(false);
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
if (proj_cfg.has(bed_type_key))
new_real_bed_type = proj_cfg.opt_enum<BedType>(bed_type_key);
}
else {
if (last_bed_type != bed_type)
if (old_real_bed_type != new_real_bed_type) {
update_slice_result_valid_state(false);
}
}
if (bed_type == BedType::btDefault)
m_config.erase(bed_type_key);
else
m_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
last_bed_type = bed_type;
if (m_plater)
m_plater->update_project_dirty_from_presets();
}

View file

@ -213,7 +213,6 @@ public:
//clear alll the instances in plate
void clear(bool clear_sliced_result = true);
BedType last_bed_type;
BedType get_bed_type(bool check_global = true) const;
void set_bed_type(BedType bed_type);
void reset_bed_type();