FIX: global arrange setting is wrong

global arrange setting is wrong if a plate's setting is changed from object list

jira: STUDIO-5438
Change-Id: Iaa7f35837edbacff9b97ca17a8ab34c8e6bb023d
(cherry picked from commit fa2f56575b2e4305e35dd59ff55e0881720de025)
This commit is contained in:
Arthur 2023-12-01 22:09:01 +08:00 committed by Lane.Wei
parent da1b9bd747
commit f6ea300aa0
6 changed files with 41 additions and 34 deletions

View File

@ -1090,6 +1090,25 @@ void GLCanvas3D::load_arrange_settings()
m_arrange_settings_fff_seq_print.is_seq_print = true;
}
GLCanvas3D::ArrangeSettings& GLCanvas3D::get_arrange_settings()
{
PrinterTechnology ptech = current_printer_technology();
auto* ptr = &m_arrange_settings_fff;
if (ptech == ptSLA) {
ptr = &m_arrange_settings_sla;
}
else if (ptech == ptFFF) {
if (wxGetApp().global_print_sequence() == PrintSequence::ByObject)
ptr = &m_arrange_settings_fff_seq_print;
else
ptr = &m_arrange_settings_fff;
}
return *ptr;
}
int GLCanvas3D::GetHoverId()
{
if (m_hover_plate_idxs.size() == 0) {
@ -5378,14 +5397,11 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
dist_min = 0.1f;
postfix = "_sla";
} else if (ptech == ptFFF) {
auto co_opt = m_config->option<ConfigOptionEnum<PrintSequence>>("print_sequence");
if (co_opt && (co_opt->value == PrintSequence::ByObject)) {
dist_min = float(min_object_distance(*m_config));
dist_min = settings.distance;
seq_print = &settings == &m_arrange_settings_fff_seq_print;
if (seq_print) {
postfix = "_fff_seq_print";
//BBS:
seq_print = true;
} else {
dist_min = 0.0f;
postfix = "_fff";
}
}

View File

@ -606,25 +606,6 @@ private:
PrinterTechnology current_printer_technology() const;
template<class Self>
static auto & get_arrange_settings(Self *self) {
PrinterTechnology ptech = self->current_printer_technology();
auto *ptr = &self->m_arrange_settings_fff;
if (ptech == ptSLA) {
ptr = &self->m_arrange_settings_sla;
} else if (ptech == ptFFF) {
auto co_opt = self->m_config->template option<ConfigOptionEnum<PrintSequence>>("print_sequence");
if (co_opt && (co_opt->value == PrintSequence::ByObject))
ptr = &self->m_arrange_settings_fff_seq_print;
else
ptr = &self->m_arrange_settings_fff;
}
return *ptr;
}
//BBS:record key botton frequency
@ -650,7 +631,11 @@ public:
}
void load_arrange_settings();
ArrangeSettings& get_arrange_settings() { return get_arrange_settings(this); }
ArrangeSettings& get_arrange_settings();// { return get_arrange_settings(this); }
ArrangeSettings& get_arrange_settings(PrintSequence print_seq) {
return (print_seq == PrintSequence::ByObject) ? m_arrange_settings_fff_seq_print
: m_arrange_settings_fff;
}
class SequentialPrintClearance
{
@ -1025,7 +1010,7 @@ public:
void highlight_gizmo(const std::string& gizmo_name);
ArrangeSettings get_arrange_settings() const {
const ArrangeSettings &settings = get_arrange_settings(this);
const ArrangeSettings &settings = get_arrange_settings();
ArrangeSettings ret = settings;
if (&settings == &m_arrange_settings_fff_seq_print) {
ret.distance = std::max(ret.distance,

View File

@ -6079,6 +6079,15 @@ int GUI_App::filaments_cnt() const
return preset_bundle->filament_presets.size();
}
PrintSequence GUI_App::global_print_sequence() const
{
PrintSequence global_print_seq = PrintSequence::ByDefault;
auto curr_preset_config = preset_bundle->prints.get_edited_preset().config;
if (curr_preset_config.has("print_sequence"))
global_print_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>("print_sequence")->value;
return global_print_seq;
}
wxString GUI_App::current_language_code_safe() const
{
// Translate the language code to a code, for which Prusa Research maintains translations.

View File

@ -574,6 +574,7 @@ public:
// BBS
int filaments_cnt() const;
PrintSequence global_print_sequence() const;
std::vector<Tab *> tabs_list;
std::vector<Tab *> model_tabs_list;

View File

@ -757,8 +757,8 @@ double bed_stride_y(const Plater* plater) {
// call before get selected and unselected
arrangement::ArrangeParams init_arrange_params(Plater *p)
{
arrangement::ArrangeParams params;
const GLCanvas3D::ArrangeSettings &settings = static_cast<const GLCanvas3D *>(p->canvas3D())->get_arrange_settings();
arrangement::ArrangeParams params;
GLCanvas3D::ArrangeSettings &settings = p->canvas3D()->get_arrange_settings();
auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print();
const PrintConfig& print_config = print.config();

View File

@ -245,11 +245,7 @@ PrintSequence PartPlate::get_print_seq() const
PrintSequence PartPlate::get_real_print_seq(bool* plate_same_as_global) const
{
PrintSequence global_print_seq = PrintSequence::ByDefault;
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
if (curr_preset_config.has("print_sequence"))
global_print_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>("print_sequence")->value;
PrintSequence global_print_seq = wxGetApp().global_print_sequence();
PrintSequence curr_plate_seq = get_print_seq();
if (curr_plate_seq == PrintSequence::ByDefault) {
curr_plate_seq = global_print_seq;