FIX: update slice state after changing bed type
Change-Id: Iaea235233ecdc0c486daedda9f0d844cb176906b
This commit is contained in:
parent
f49f1385b5
commit
9c55e42b32
|
@ -95,7 +95,7 @@ void PartPlate::load_render_colors()
|
||||||
|
|
||||||
|
|
||||||
PartPlate::PartPlate()
|
PartPlate::PartPlate()
|
||||||
: ObjectBase(-1), m_plater(nullptr), m_model(nullptr), m_quadric(nullptr)
|
: ObjectBase(-1), m_plater(nullptr), m_model(nullptr), m_quadric(nullptr),last_bed_type(BedType::btCount)
|
||||||
{
|
{
|
||||||
assert(this->id().invalid());
|
assert(this->id().invalid());
|
||||||
init();
|
init();
|
||||||
|
@ -165,11 +165,35 @@ void PartPlate::set_bed_type(BedType bed_type)
|
||||||
// should be called in GUI context
|
// should be called in GUI context
|
||||||
assert(m_plater != nullptr);
|
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{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (last_bed_type != bed_type)
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ 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();
|
||||||
|
|
|
@ -5260,6 +5260,7 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt)
|
||||||
|
|
||||||
if (new_bed_type != btCount) {
|
if (new_bed_type != btCount) {
|
||||||
BedType old_bed_type = proj_config.opt_enum<BedType>("curr_bed_type");
|
BedType old_bed_type = proj_config.opt_enum<BedType>("curr_bed_type");
|
||||||
|
if (old_bed_type != new_bed_type) {
|
||||||
proj_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(new_bed_type));
|
proj_config.set_key_value("curr_bed_type", new ConfigOptionEnum<BedType>(new_bed_type));
|
||||||
|
|
||||||
wxGetApp().plater()->update_project_dirty_from_presets();
|
wxGetApp().plater()->update_project_dirty_from_presets();
|
||||||
|
@ -5271,12 +5272,21 @@ void Plater::priv::on_select_bed_type(wxCommandEvent &evt)
|
||||||
AppConfig* app_config = wxGetApp().app_config;
|
AppConfig* app_config = wxGetApp().app_config;
|
||||||
app_config->set("curr_bed_type", std::to_string(int(new_bed_type)));
|
app_config->set("curr_bed_type", std::to_string(int(new_bed_type)));
|
||||||
|
|
||||||
|
//update slice status
|
||||||
|
auto plate_list = partplate_list.get_plate_list();
|
||||||
|
for (auto plate : plate_list) {
|
||||||
|
if (plate->get_bed_type(false) == btDefault) {
|
||||||
|
plate->update_slice_result_valid_state(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// update render
|
// update render
|
||||||
view3D->get_canvas3d()->render();
|
view3D->get_canvas3d()->render();
|
||||||
preview->msw_rescale();
|
preview->msw_rescale();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
||||||
{
|
{
|
||||||
|
@ -5345,6 +5355,15 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
||||||
#endif
|
#endif
|
||||||
// BBS: log modify of filament selection
|
// BBS: log modify of filament selection
|
||||||
Slic3r::put_other_changes();
|
Slic3r::put_other_changes();
|
||||||
|
|
||||||
|
// update slice state and set bedtype default for 3rd-party printer
|
||||||
|
bool is_bbl_vendor_preset = wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle);
|
||||||
|
auto plate_list = partplate_list.get_plate_list();
|
||||||
|
for (auto plate : plate_list) {
|
||||||
|
plate->update_slice_result_valid_state(false);
|
||||||
|
if (!is_bbl_vendor_preset)
|
||||||
|
plate->set_bed_type(btDefault);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
||||||
|
|
Loading…
Reference in New Issue