Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_world_coordinates
This commit is contained in:
commit
7af8f92f84
88 changed files with 8209 additions and 7498 deletions
|
@ -1494,22 +1494,18 @@ bool Sidebar::is_multifilament()
|
|||
return p->combos_filament.size() > 1;
|
||||
}
|
||||
|
||||
static std::vector<Search::InputInfo> get_search_inputs(ConfigOptionMode mode)
|
||||
void Sidebar::check_and_update_searcher(bool respect_mode /*= false*/)
|
||||
{
|
||||
std::vector<Search::InputInfo> ret {};
|
||||
std::vector<Search::InputInfo> search_inputs{};
|
||||
|
||||
auto& tabs_list = wxGetApp().tabs_list;
|
||||
auto print_tech = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology();
|
||||
for (auto tab : tabs_list)
|
||||
if (tab->supports_printer_technology(print_tech))
|
||||
ret.emplace_back(Search::InputInfo {tab->get_config(), tab->type(), mode});
|
||||
search_inputs.emplace_back(Search::InputInfo{ tab->get_config(), tab->type() });
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Sidebar::update_searcher()
|
||||
{
|
||||
p->searcher.init(get_search_inputs(m_mode));
|
||||
p->searcher.check_and_update(wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(),
|
||||
respect_mode ? m_mode : comExpert, search_inputs);
|
||||
}
|
||||
|
||||
void Sidebar::update_mode()
|
||||
|
@ -1518,7 +1514,6 @@ void Sidebar::update_mode()
|
|||
|
||||
update_reslice_btn_tooltip();
|
||||
update_mode_sizer();
|
||||
update_searcher();
|
||||
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
|
||||
|
@ -1581,6 +1576,8 @@ Search::OptionsSearcher& Sidebar::get_searcher()
|
|||
|
||||
std::string& Sidebar::get_search_line()
|
||||
{
|
||||
// update searcher before show imGui search dialog on the plater, if printer technology or mode was changed
|
||||
check_and_update_searcher(true);
|
||||
return p->searcher.search_string();
|
||||
}
|
||||
|
||||
|
@ -1724,8 +1721,11 @@ struct Plater::priv
|
|||
res = (act == "1") ? wxID_YES : wxID_NO;
|
||||
|
||||
if (res == wxID_YES)
|
||||
if (!mainframe->save_project_as(project_name))
|
||||
res = wxID_CANCEL;
|
||||
if (!mainframe->save_project_as(project_name)) {
|
||||
// Return Cancel only, when we don't remember a choice for closing the application.
|
||||
// Elsewhere it can causes an impossibility to close the application at all.
|
||||
res = act.empty() ? wxID_CANCEL : wxID_NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
@ -2407,7 +2407,11 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
}
|
||||
|
||||
const auto loading = _L("Loading") + dots;
|
||||
wxProgressDialog progress_dlg(loading, "", 100, find_toplevel_parent(q), wxPD_AUTO_HIDE);
|
||||
|
||||
// Create wxProgressDialog on heap, see the linux ifdef below.
|
||||
auto progress_dlg = new wxProgressDialog(loading, "", 100, find_toplevel_parent(q), wxPD_AUTO_HIDE);
|
||||
Slic3r::ScopeGuard([&progress_dlg](){ if (progress_dlg) progress_dlg->Destroy(); progress_dlg = nullptr; });
|
||||
|
||||
wxBusyCursor busy;
|
||||
|
||||
auto *new_model = (!load_model || one_by_one) ? nullptr : new Slic3r::Model();
|
||||
|
@ -2427,8 +2431,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
const auto &path = input_files[i];
|
||||
#endif // _WIN32
|
||||
const auto filename = path.filename();
|
||||
progress_dlg.Update(static_cast<int>(100.0f * static_cast<float>(i) / static_cast<float>(input_files.size())), _L("Loading file") + ": " + from_path(filename));
|
||||
progress_dlg.Fit();
|
||||
if (progress_dlg) {
|
||||
progress_dlg->Update(static_cast<int>(100.0f * static_cast<float>(i) / static_cast<float>(input_files.size())), _L("Loading file") + ": " + from_path(filename));
|
||||
progress_dlg->Fit();
|
||||
}
|
||||
|
||||
const bool type_3mf = std::regex_match(path.string(), pattern_3mf);
|
||||
const bool type_zip_amf = !type_3mf && std::regex_match(path.string(), pattern_zip_amf);
|
||||
|
@ -2446,8 +2452,10 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
// then related SLA Print and Materials Settings or FFF Print and Filaments Settings will be unparent from the wxNoteBook
|
||||
// and that is why they will never be enabled after destruction of the ProgressDialog.
|
||||
// So, distroy progress_gialog if we are loading project file
|
||||
if (input_files_size == 1)
|
||||
progress_dlg.Destroy();
|
||||
if (input_files_size == 1 && progress_dlg) {
|
||||
progress_dlg->Destroy();
|
||||
progress_dlg = nullptr;
|
||||
}
|
||||
#endif
|
||||
DynamicPrintConfig config;
|
||||
PrinterTechnology loaded_printer_technology {ptFFF};
|
||||
|
@ -5422,7 +5430,7 @@ void Plater::load_gcode(const wxString& filename)
|
|||
if (p->preview->get_canvas3d()->get_gcode_layers_zs().empty()) {
|
||||
//wxMessageDialog(this, _L("The selected file") + ":\n" + filename + "\n" + _L("does not contain valid gcode."),
|
||||
MessageDialog(this, _L("The selected file") + ":\n" + filename + "\n" + _L("does not contain valid gcode."),
|
||||
wxString(GCODEVIEWER_APP_NAME) + " - " + _L("Error while loading .gcode file"), wxCLOSE | wxICON_WARNING | wxCENTRE).ShowModal();
|
||||
wxString(GCODEVIEWER_APP_NAME) + " - " + _L("Error while loading .gcode file"), wxOK | wxICON_WARNING | wxCENTRE).ShowModal();
|
||||
set_project_filename(wxEmptyString);
|
||||
}
|
||||
else
|
||||
|
@ -5834,6 +5842,10 @@ void Plater::convert_unit(ConversionType conv_type)
|
|||
if (obj_idxs.empty() && volume_idxs.empty())
|
||||
return;
|
||||
|
||||
// We will remove object indexes after convertion
|
||||
// So, resort object indexes descending to avoid the crash after remove
|
||||
std::sort(obj_idxs.begin(), obj_idxs.end(), std::greater<int>());
|
||||
|
||||
TakeSnapshot snapshot(this, conv_type == ConversionType::CONV_FROM_INCH ? _L("Convert from imperial units") :
|
||||
conv_type == ConversionType::CONV_TO_INCH ? _L("Revert conversion from imperial units") :
|
||||
conv_type == ConversionType::CONV_FROM_METER ? _L("Convert from meters") : _L("Revert conversion from meters"));
|
||||
|
@ -6509,8 +6521,6 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||
if (opt_key == "printer_technology") {
|
||||
this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key));
|
||||
// print technology is changed, so we should to update a search list
|
||||
p->sidebar->update_searcher();
|
||||
p->sidebar->show_sliced_info_sizer(false);
|
||||
p->reset_gcode_toolpaths();
|
||||
p->view3D->get_canvas3d()->reset_sequential_print_clearance();
|
||||
|
@ -6759,8 +6769,6 @@ bool Plater::set_printer_technology(PrinterTechnology printer_technology)
|
|||
|
||||
p->update_main_toolbar_tooltips();
|
||||
|
||||
p->sidebar->get_searcher().set_printer_technology(printer_technology);
|
||||
|
||||
p->notification_manager->set_fff(printer_technology == ptFFF);
|
||||
p->notification_manager->set_slicing_progress_hidden();
|
||||
|
||||
|
@ -6924,8 +6932,10 @@ void Plater::search(bool plater_is_active)
|
|||
evt.SetControlDown(true);
|
||||
canvas3D()->on_char(evt);
|
||||
}
|
||||
else
|
||||
else {
|
||||
p->sidebar->check_and_update_searcher(true);
|
||||
p->sidebar->get_searcher().show_dialog();
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::msw_rescale()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue