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

View File

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