mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-06 06:36:05 +08:00
FIX:The plate type in dialog of the plate settings does not match the machine
jira: STUDIO-12181 Change-Id: I1d055e3530f19946073c30647c12fbab2be97d50
This commit is contained in:
parent
9eba9b8a2d
commit
54b6cc3c41
@ -4134,6 +4134,32 @@ void PartPlateList::delete_selected_plate()
|
||||
delete_plate(m_current_plate);
|
||||
}
|
||||
|
||||
bool PartPlateList::check_all_plate_local_bed_type(const std::vector<BedType> &cur_bed_types)
|
||||
{
|
||||
std::string bed_type_key = "curr_bed_type";
|
||||
bool is_ok = true;
|
||||
for (int i = 0; i < m_plate_list.size(); i++) {
|
||||
PartPlate *plate = m_plate_list[i];
|
||||
if (plate->config() && plate->config()->has(bed_type_key)) {
|
||||
BedType bed_type = plate->config()->opt_enum<BedType>(bed_type_key);
|
||||
if (bed_type == BedType::btDefault)
|
||||
continue;
|
||||
bool find = false;
|
||||
for (auto tmp_type : cur_bed_types) {
|
||||
if (bed_type == tmp_type) {
|
||||
find = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
plate->set_bed_type(BedType::btDefault);
|
||||
is_ok = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
//get a plate pointer by index
|
||||
PartPlate* PartPlateList::get_plate(int index)
|
||||
{
|
||||
|
@ -737,6 +737,7 @@ public:
|
||||
//int delete_plate(PartPlate* plate);
|
||||
void delete_selected_plate();
|
||||
|
||||
bool check_all_plate_local_bed_type(const std::vector<BedType>& cur_bed_types);
|
||||
//get a plate pointer by index
|
||||
PartPlate* get_plate(int index);
|
||||
|
||||
|
@ -381,8 +381,25 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title
|
||||
|
||||
// Plate type
|
||||
m_bed_type_choice = new ComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240),-1), 0, NULL, wxCB_READONLY );
|
||||
for (BedType i = btDefault; i < btCount; i = BedType(int(i) + 1)) {
|
||||
m_bed_type_choice->Append(to_bed_type_name(i));
|
||||
auto pm = wxGetApp().plater()->get_curr_printer_model();
|
||||
if (pm) {
|
||||
m_cur_combox_bed_types.clear();
|
||||
m_bed_type_choice->AppendString(_L("Same as Global Plate Type"));
|
||||
const ConfigOptionDef *bed_type_def = print_config_def.get("curr_bed_type");
|
||||
int index = 0;
|
||||
for (auto item : bed_type_def->enum_labels) {
|
||||
index++;
|
||||
bool find = std::find(pm->not_support_bed_types.begin(), pm->not_support_bed_types.end(), item) != pm->not_support_bed_types.end();
|
||||
if (!find) {
|
||||
m_bed_type_choice->AppendString(_L(item));
|
||||
m_cur_combox_bed_types.emplace_back(BedType(index));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (BedType i = btDefault; i < btCount; i = BedType(int(i) + 1)) {
|
||||
m_bed_type_choice->Append(to_bed_type_name(i));
|
||||
}
|
||||
}
|
||||
wxStaticText* m_bed_type_txt = new wxStaticText(this, wxID_ANY, _L("Bed type"));
|
||||
m_bed_type_txt->SetFont(Label::Body_14);
|
||||
@ -527,7 +544,13 @@ PlateSettingsDialog::~PlateSettingsDialog()
|
||||
void PlateSettingsDialog::sync_bed_type(BedType type)
|
||||
{
|
||||
if (m_bed_type_choice != nullptr) {
|
||||
m_bed_type_choice->SetSelection(int(type));
|
||||
for (int i = 0; i < m_cur_combox_bed_types.size(); i++) {
|
||||
if (m_cur_combox_bed_types[i] == type) {
|
||||
m_bed_type_choice->SetSelection(i + 1);//+1 because same as global
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_bed_type_choice->SetSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -614,6 +637,17 @@ void PlateSettingsDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||
m_button_cancel->Rescale();
|
||||
}
|
||||
|
||||
BedType PlateSettingsDialog::get_bed_type_choice()
|
||||
{
|
||||
if (m_bed_type_choice != nullptr) {
|
||||
int choice = m_bed_type_choice->GetSelection();
|
||||
if (choice > 0) {
|
||||
return m_cur_combox_bed_types[choice - 1];//-1 because same as globlal
|
||||
}
|
||||
}
|
||||
return BedType::btDefault;
|
||||
};
|
||||
|
||||
std::vector<int> PlateSettingsDialog::get_first_layer_print_seq()
|
||||
{
|
||||
return m_drag_canvas->get_shape_list_order();
|
||||
|
@ -112,14 +112,9 @@ public:
|
||||
if (m_print_seq_choice != nullptr)
|
||||
choice = m_print_seq_choice->GetSelection();
|
||||
return choice;
|
||||
};
|
||||
}
|
||||
|
||||
int get_bed_type_choice() {
|
||||
int choice = 0;
|
||||
if (m_bed_type_choice != nullptr)
|
||||
choice = m_bed_type_choice->GetSelection();
|
||||
return choice;
|
||||
};
|
||||
BedType get_bed_type_choice();
|
||||
|
||||
int get_first_layer_print_seq_choice() {
|
||||
int choice = 0;
|
||||
@ -164,6 +159,7 @@ protected:
|
||||
|
||||
protected:
|
||||
ComboBox* m_bed_type_choice { nullptr };
|
||||
std::vector<BedType> m_cur_combox_bed_types;
|
||||
ComboBox* m_print_seq_choice { nullptr };
|
||||
ComboBox* m_first_layer_print_seq_choice { nullptr };
|
||||
ComboBox* m_spiral_mode_choice { nullptr };
|
||||
|
@ -1631,7 +1631,7 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->combo_printer_bed = new ComboBox(p->panel_printer_bed, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY | wxALIGN_CENTER_HORIZONTAL);
|
||||
p->combo_printer_bed->SetBorderWidth(0);
|
||||
p->combo_printer_bed->GetDropDown().SetUseContentWidth(true);
|
||||
reset_bed_type_combox_choices();
|
||||
reset_bed_type_combox_choices(true);
|
||||
|
||||
p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) {
|
||||
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
|
||||
@ -2484,18 +2484,13 @@ void Sidebar::set_bed_type_accord_combox(BedType bed_type) {
|
||||
save_bed_type_to_config(bed_type_name);
|
||||
}
|
||||
|
||||
bool Sidebar::reset_bed_type_combox_choices() {
|
||||
bool Sidebar::reset_bed_type_combox_choices(bool is_sidebar_init)
|
||||
{
|
||||
if (!p->combo_printer_bed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto bundle = wxGetApp().preset_bundle;
|
||||
const Preset * curr = &bundle->printers.get_selected_preset();
|
||||
const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr);
|
||||
if (!pm) {
|
||||
auto curr_parent = bundle->printers.get_selected_preset_parent();
|
||||
pm = PresetUtils::system_printer_model(*curr_parent);
|
||||
}
|
||||
auto pm = p->plater->get_curr_printer_model();
|
||||
if (m_last_combo_bedtype_count != 0 && pm) {
|
||||
auto cur_count = (int) BedType::btCount - 1 - pm->not_support_bed_types.size();
|
||||
if (cur_count == m_last_combo_bedtype_count) {//no change
|
||||
@ -2530,6 +2525,9 @@ bool Sidebar::reset_bed_type_combox_choices() {
|
||||
}
|
||||
}
|
||||
m_last_combo_bedtype_count = p->combo_printer_bed->GetCount();
|
||||
if (!is_sidebar_init && &p->plater->get_partplate_list()) {
|
||||
p->plater->get_partplate_list().check_all_plate_local_bed_type(m_cur_combox_bed_types);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4932,6 +4930,18 @@ void Plater::priv::select_view(const std::string& direction)
|
||||
}
|
||||
}
|
||||
|
||||
const VendorProfile::PrinterModel *Plater::get_curr_printer_model()
|
||||
{
|
||||
auto bundle = wxGetApp().preset_bundle;
|
||||
const Preset * curr = &bundle->printers.get_selected_preset();
|
||||
const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr);
|
||||
if (!pm) {
|
||||
auto curr_parent = bundle->printers.get_selected_preset_parent();
|
||||
pm = PresetUtils::system_printer_model(*curr_parent);
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
|
||||
wxColour Plater::get_next_color_for_filament()
|
||||
{
|
||||
static int curr_color_filamenet = 0;
|
||||
@ -16513,7 +16523,7 @@ void Plater::open_platesettings_dialog(wxCommandEvent& evt) {
|
||||
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
|
||||
PartPlate* curr_plate = p->partplate_list.get_curr_plate();
|
||||
BedType old_bed_type = curr_plate->get_bed_type();
|
||||
auto bt_sel = BedType(dlg.get_bed_type_choice());
|
||||
auto bt_sel = dlg.get_bed_type_choice();
|
||||
if (old_bed_type != bt_sel) {
|
||||
curr_plate->set_bed_type(bt_sel);
|
||||
update_project_dirty_from_presets();
|
||||
|
@ -159,7 +159,7 @@ public:
|
||||
BedType get_cur_select_bed_type();
|
||||
std::string get_cur_select_bed_image();
|
||||
void set_bed_type_accord_combox(BedType bed_type);
|
||||
bool reset_bed_type_combox_choices();
|
||||
bool reset_bed_type_combox_choices(bool is_sidebar_init = false);
|
||||
bool use_default_bed_type(bool is_bbl_preset = true);
|
||||
void change_top_border_for_mode_sizer(bool increase_border);
|
||||
void msw_rescale();
|
||||
@ -351,6 +351,8 @@ public:
|
||||
void invalid_all_plate_thumbnails();
|
||||
void force_update_all_plate_thumbnails();
|
||||
|
||||
const VendorProfile::PrinterModel *get_curr_printer_model();
|
||||
|
||||
static wxColour get_next_color_for_filament();
|
||||
static wxString get_slice_warning_string(GCodeProcessorResult::SliceWarning& warning);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user