ENH: return if the bed_type of a plate is the same as global

Signed-off-by: yifan.wu <yifan.wu@bambulab.com>
Change-Id: I15882d04fa89ebb27bc57434ff9f2c9468725d71
(cherry picked from commit b1606e07f1b9d91f1c01676ebbbe550e69a2ce53)
This commit is contained in:
yifan.wu 2022-11-09 18:36:15 +08:00 committed by Lane.Wei
parent 0320872e4e
commit acf8f7b2a3
3 changed files with 20 additions and 4 deletions

View file

@ -147,11 +147,26 @@ BedType PartPlate::get_bed_type() const
return BedType::btPC;
}
void PartPlate::set_bed_type(BedType bed_type)
void PartPlate::set_bed_type(BedType bed_type, bool& same_as_global)
{
// should be called in GUI context
assert(m_plater != nullptr);
std::string bed_type_key = "curr_bed_type";
m_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(bed_type));
if (m_plater)
if (m_plater) {
m_plater->schedule_background_process();
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
if (proj_cfg.has(bed_type_key)) {
std::string bed_type_key = "curr_bed_type";
BedType global_bed_type = proj_cfg.opt_enum<BedType>(bed_type_key);
same_as_global = bed_type == global_bed_type;
return;
}
}
same_as_global = false;
}
void PartPlate::reset_bed_type()