mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 03:11:47 +00:00
FIX:The plate type in dialog of the plate settings does not match the machine
jira: STUDIO-12181 Change-Id: I1d055e3530f19946073c30647c12fbab2be97d50 (cherry picked from commit 54b6cc3c41319ddfc0e3d78f41b903508f0f4c15)
This commit is contained in:
@@ -4219,6 +4219,32 @@ void PartPlateList::delete_selected_plate()
|
|||||||
delete_plate(m_current_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
|
//get a plate pointer by index
|
||||||
PartPlate* PartPlateList::get_plate(int index)
|
PartPlate* PartPlateList::get_plate(int index)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -717,6 +717,7 @@ public:
|
|||||||
//int delete_plate(PartPlate* plate);
|
//int delete_plate(PartPlate* plate);
|
||||||
void delete_selected_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
|
//get a plate pointer by index
|
||||||
PartPlate* get_plate(int index);
|
PartPlate* get_plate(int index);
|
||||||
|
|
||||||
|
|||||||
@@ -383,11 +383,27 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, const wxString& title
|
|||||||
top_sizer->Add(plate_name_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5));
|
top_sizer->Add(plate_name_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxTOP | wxBOTTOM, FromDIP(5));
|
||||||
top_sizer->Add(m_ti_plate_name, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5));
|
top_sizer->Add(m_ti_plate_name, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxTOP | wxBOTTOM, FromDIP(5));
|
||||||
|
|
||||||
m_bed_type_choice = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240), -1), 0,
|
m_bed_type_choice = new ComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240),-1), 0, NULL, wxCB_READONLY );
|
||||||
NULL, wxCB_READONLY);
|
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)) {
|
for (BedType i = btDefault; i < btCount; i = BedType(int(i) + 1)) {
|
||||||
m_bed_type_choice->Append(to_bed_type_name(i));
|
m_bed_type_choice->Append(to_bed_type_name(i));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!wxGetApp().preset_bundle->is_bbl_vendor())
|
if (!wxGetApp().preset_bundle->is_bbl_vendor())
|
||||||
m_bed_type_choice->Disable();
|
m_bed_type_choice->Disable();
|
||||||
@@ -510,7 +526,13 @@ PlateSettingsDialog::~PlateSettingsDialog()
|
|||||||
void PlateSettingsDialog::sync_bed_type(BedType type)
|
void PlateSettingsDialog::sync_bed_type(BedType type)
|
||||||
{
|
{
|
||||||
if (m_bed_type_choice != nullptr) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -601,6 +623,17 @@ wxString PlateSettingsDialog::get_plate_name() const {
|
|||||||
|
|
||||||
void PlateSettingsDialog::set_plate_name(const wxString &name) { m_ti_plate_name->GetTextCtrl()->SetValue(name); }
|
void PlateSettingsDialog::set_plate_name(const wxString &name) { m_ti_plate_name->GetTextCtrl()->SetValue(name); }
|
||||||
|
|
||||||
|
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()
|
std::vector<int> PlateSettingsDialog::get_first_layer_print_seq()
|
||||||
{
|
{
|
||||||
return m_drag_canvas->get_shape_list_order();
|
return m_drag_canvas->get_shape_list_order();
|
||||||
|
|||||||
@@ -112,14 +112,9 @@ public:
|
|||||||
if (m_print_seq_choice != nullptr)
|
if (m_print_seq_choice != nullptr)
|
||||||
choice = m_print_seq_choice->GetSelection();
|
choice = m_print_seq_choice->GetSelection();
|
||||||
return choice;
|
return choice;
|
||||||
};
|
}
|
||||||
|
|
||||||
int get_bed_type_choice() {
|
BedType get_bed_type_choice();
|
||||||
int choice = 0;
|
|
||||||
if (m_bed_type_choice != nullptr)
|
|
||||||
choice = m_bed_type_choice->GetSelection();
|
|
||||||
return choice;
|
|
||||||
};
|
|
||||||
|
|
||||||
wxString get_plate_name() const;
|
wxString get_plate_name() const;
|
||||||
void set_plate_name(const wxString& name);
|
void set_plate_name(const wxString& name);
|
||||||
@@ -167,6 +162,7 @@ protected:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ComboBox* m_bed_type_choice { nullptr };
|
ComboBox* m_bed_type_choice { nullptr };
|
||||||
|
std::vector<BedType> m_cur_combox_bed_types;
|
||||||
ComboBox* m_print_seq_choice { nullptr };
|
ComboBox* m_print_seq_choice { nullptr };
|
||||||
ComboBox* m_first_layer_print_seq_choice { nullptr };
|
ComboBox* m_first_layer_print_seq_choice { nullptr };
|
||||||
ComboBox* m_spiral_mode_choice { nullptr };
|
ComboBox* m_spiral_mode_choice { nullptr };
|
||||||
|
|||||||
+20
-10
@@ -1682,7 +1682,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 = 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->SetBorderWidth(0);
|
||||||
p->combo_printer_bed->GetDropDown().SetUseContentWidth(true);
|
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) {
|
p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) {
|
||||||
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
|
bool isDual = static_cast<wxBoxSizer *>(p->panel_printer_preset->GetSizer())->GetOrientation() == wxVERTICAL;
|
||||||
@@ -2472,18 +2472,13 @@ void Sidebar::set_bed_type_accord_combox(BedType bed_type) {
|
|||||||
p->combo_printer_bed->SelectAndNotify(0);
|
p->combo_printer_bed->SelectAndNotify(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sidebar::reset_bed_type_combox_choices() {
|
bool Sidebar::reset_bed_type_combox_choices(bool is_sidebar_init)
|
||||||
|
{
|
||||||
if (!p->combo_printer_bed) {
|
if (!p->combo_printer_bed) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bundle = wxGetApp().preset_bundle;
|
auto pm = p->plater->get_curr_printer_model();
|
||||||
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);
|
|
||||||
}
|
|
||||||
if (m_last_combo_bedtype_count != 0 && pm) {
|
if (m_last_combo_bedtype_count != 0 && pm) {
|
||||||
auto cur_count = (int) BedType::btCount - 1 - pm->not_support_bed_types.size();
|
auto cur_count = (int) BedType::btCount - 1 - pm->not_support_bed_types.size();
|
||||||
if (cur_count == m_last_combo_bedtype_count) {//no change
|
if (cur_count == m_last_combo_bedtype_count) {//no change
|
||||||
@@ -2518,6 +2513,9 @@ bool Sidebar::reset_bed_type_combox_choices() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_last_combo_bedtype_count = p->combo_printer_bed->GetCount();
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4884,6 +4882,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()
|
wxColour Plater::get_next_color_for_filament()
|
||||||
{
|
{
|
||||||
static int curr_color_filamenet = 0;
|
static int curr_color_filamenet = 0;
|
||||||
@@ -16313,7 +16323,7 @@ void Plater::open_platesettings_dialog(wxCommandEvent& evt) {
|
|||||||
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
|
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
|
||||||
PartPlate* curr_plate = p->partplate_list.get_curr_plate();
|
PartPlate* curr_plate = p->partplate_list.get_curr_plate();
|
||||||
BedType old_bed_type = curr_plate->get_bed_type();
|
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) {
|
if (old_bed_type != bt_sel) {
|
||||||
curr_plate->set_bed_type(bt_sel);
|
curr_plate->set_bed_type(bt_sel);
|
||||||
update_project_dirty_from_presets();
|
update_project_dirty_from_presets();
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public:
|
|||||||
BedType get_cur_select_bed_type();
|
BedType get_cur_select_bed_type();
|
||||||
std::string get_cur_select_bed_image();
|
std::string get_cur_select_bed_image();
|
||||||
void set_bed_type_accord_combox(BedType bed_type);
|
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);
|
||||||
void change_top_border_for_mode_sizer(bool increase_border);
|
void change_top_border_for_mode_sizer(bool increase_border);
|
||||||
void msw_rescale();
|
void msw_rescale();
|
||||||
void sys_color_changed();
|
void sys_color_changed();
|
||||||
@@ -355,6 +355,8 @@ public:
|
|||||||
void invalid_all_plate_thumbnails();
|
void invalid_all_plate_thumbnails();
|
||||||
void force_update_all_plate_thumbnails();
|
void force_update_all_plate_thumbnails();
|
||||||
|
|
||||||
|
const VendorProfile::PrinterModel *get_curr_printer_model();
|
||||||
|
|
||||||
static wxColour get_next_color_for_filament();
|
static wxColour get_next_color_for_filament();
|
||||||
static wxString get_slice_warning_string(GCodeProcessorResult::SliceWarning& warning);
|
static wxString get_slice_warning_string(GCodeProcessorResult::SliceWarning& warning);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user