Merge remote-tracking branch 'origin/ys_bug_fixing' into ys_msw_dpi

This commit is contained in:
YuSanka 2019-04-18 15:22:10 +02:00
commit de55801e31
44 changed files with 387 additions and 165 deletions

View file

@ -280,7 +280,7 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
cfg.set_key_value("extruder_colour", colors);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->load_config(cfg);
wxGetApp().preset_bundle->update_platter_filament_ui(extruder_idx, this);
wxGetApp().preset_bundle->update_platter_filament_ui(extruder_idx, this, wxGetApp().em_unit());
wxGetApp().plater()->on_config_change(cfg);
}
dialog->Destroy();
@ -813,7 +813,7 @@ void Sidebar::update_all_preset_comboboxes()
// update the dirty flags.
if (print_tech == ptFFF) {
for (size_t i = 0; i < p->combos_filament.size(); ++i)
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i], wxGetApp().em_unit());
}
p->show_preset_comboboxes();
}
@ -837,7 +837,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
}
for (size_t i = 0; i < filament_cnt; i++) {
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
preset_bundle.update_platter_filament_ui(i, p->combos_filament[i], wxGetApp().em_unit());
}
break;
@ -872,7 +872,7 @@ void Sidebar::update_presets(Preset::Type preset_type)
// // update the dirty flags.
// if (print_tech == ptFFF) {
// for (size_t i = 0; i < p->combos_filament.size(); ++ i)
// preset_bundle.update_platter_filament_ui(i, p->combos_filament[i]);
// preset_bundle.update_platter_filament_ui(i, p->combos_filament[i], wxGetApp().em_unit());
// }
// p->show_preset_comboboxes();
update_all_preset_comboboxes();
@ -1703,6 +1703,14 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
break;
}
// is there any advanced config data ?
auto opt_keys = model_object->config.keys();
if (!opt_keys.empty() && !((opt_keys.size() == 1) && (opt_keys[0] == "extruder")))
{
advanced = true;
break;
}
// is there any modifier ?
for (const ModelVolume* model_volume : model_object->volumes)
{
@ -1711,6 +1719,14 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
advanced = true;
break;
}
// is there any advanced config data ?
opt_keys = model_volume->config.keys();
if (!opt_keys.empty() && !((opt_keys.size() == 1) && (opt_keys[0] == "extruder")))
{
advanced = true;
break;
}
}
if (advanced)
@ -2650,7 +2666,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
// TODO: ?
if (preset_type == Preset::TYPE_FILAMENT && sidebar->is_multifilament()) {
// Only update the platter UI for the 2nd and other filaments.
wxGetApp().preset_bundle->update_platter_filament_ui(idx, combo);
wxGetApp().preset_bundle->update_platter_filament_ui(idx, combo, wxGetApp().em_unit());
}
else {
wxWindowUpdateLocker noUpdates(sidebar->presets_panel());
@ -3618,7 +3634,7 @@ void Plater::on_extruders_change(int num_extruders)
choices.push_back(choice);
// initialize selection
wxGetApp().preset_bundle->update_platter_filament_ui(i, choice);
wxGetApp().preset_bundle->update_platter_filament_ui(i, choice, wxGetApp().em_unit());
++i;
}
@ -3768,6 +3784,36 @@ void Plater::changed_object(int obj_idx)
this->p->schedule_background_process();
}
void Plater::changed_objects(const std::vector<size_t>& object_idxs)
{
if (object_idxs.empty())
return;
auto list = wxGetApp().obj_list();
wxASSERT(list != nullptr);
if (list == nullptr)
return;
if (list->is_parts_changed()) {
for (int obj_idx : object_idxs)
{
if (obj_idx < p->model.objects.size())
// recenter and re - align to Z = 0
p->model.objects[obj_idx]->ensure_on_bed();
}
if (this->p->printer_technology == ptSLA) {
// Update the SLAPrint from the current Model, so that the reload_scene()
// pulls the correct data, update the 3D scene.
this->p->update_restart_background_process(true, false);
}
else
p->view3D->reload_scene(false);
}
// update print
this->p->schedule_background_process();
}
void Plater::schedule_background_process()
{
this->p->schedule_background_process();