Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_world_coordinates

This commit is contained in:
enricoturri1966 2021-11-15 13:00:22 +01:00
commit 83efdce4d6
4 changed files with 43 additions and 11 deletions

View File

@ -0,0 +1 @@
Upstream source: https://github.com/memononen/nanosvg/tree/c1f6e209c16b18b46aa9f45d7e619acf42c29726

View File

@ -162,8 +162,8 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
if (config->opt_bool("support_material")) { if (config->opt_bool("support_material")) {
// Ask only once. // Ask only once.
if (!m_support_material_overhangs_queried) { if (!support_material_overhangs_queried) {
m_support_material_overhangs_queried = true; support_material_overhangs_queried = true;
if (!config->opt_bool("overhangs")/* != 1*/) { if (!config->opt_bool("overhangs")/* != 1*/) {
wxString msg_text = _(L("Supports work better, if the following feature is enabled:\n" wxString msg_text = _(L("Supports work better, if the following feature is enabled:\n"
"- Detect bridging perimeters")); "- Detect bridging perimeters"));
@ -182,7 +182,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
} }
} }
else { else {
m_support_material_overhangs_queried = false; support_material_overhangs_queried = false;
} }
if (config->option<ConfigOptionPercent>("fill_density")->value == 100) { if (config->option<ConfigOptionPercent>("fill_density")->value == 100) {

View File

@ -17,11 +17,14 @@ class ModelConfig;
namespace GUI { namespace GUI {
// This variable have to be static because of use its value from Preset configuration
// and from object/parts configuration from the Settings in sidebar
static bool support_material_overhangs_queried {false};
class ConfigManipulation class ConfigManipulation
{ {
bool is_msg_dlg_already_exist{ false }; bool is_msg_dlg_already_exist{ false };
bool m_support_material_overhangs_queried{false};
bool m_is_initialized_support_material_overhangs_queried{ false }; bool m_is_initialized_support_material_overhangs_queried{ false };
// function to loading of changed configuration // function to loading of changed configuration
@ -63,7 +66,7 @@ public:
void initialize_support_material_overhangs_queried(bool queried) void initialize_support_material_overhangs_queried(bool queried)
{ {
m_is_initialized_support_material_overhangs_queried = true; m_is_initialized_support_material_overhangs_queried = true;
m_support_material_overhangs_queried = queried; support_material_overhangs_queried = queried;
} }
}; };

View File

@ -2292,26 +2292,54 @@ void ConfigWizard::priv::select_default_materials_for_printer_models(Technology
{ {
PageMaterials *page_materials = technology & T_FFF ? page_filaments : page_sla_materials; PageMaterials *page_materials = technology & T_FFF ? page_filaments : page_sla_materials;
const std::string &appconfig_section = page_materials->materials->appconfig_section(); const std::string &appconfig_section = page_materials->materials->appconfig_section();
auto select_default_materials_for_printer_page = [this, appconfig_section, printer_models](PagePrinters *page_printers, Technology technology) // Following block was unnecessary. Its enough to iterate printer_models once. Not for every vendor printer page.
// Filament is selected on same page for all printers of same technology.
/*
auto select_default_materials_for_printer_page = [this, appconfig_section, printer_models, technology](PagePrinters *page_printers, Technology technology)
{ {
const std::string vendor_id = page_printers->get_vendor_id(); const std::string vendor_id = page_printers->get_vendor_id();
for (auto& pair : bundles) for (auto& pair : bundles)
if (pair.first == vendor_id) if (pair.first == vendor_id)
for (const VendorProfile::PrinterModel *printer_model : printer_models) for (const VendorProfile::PrinterModel *printer_model : printer_models)
for (const std::string &material : printer_model->default_materials) for (const std::string &material : printer_model->default_materials)
appconfig_new.set(appconfig_section, material, "1"); appconfig_new.set(appconfig_section, material, "1");
}; };
PagePrinters* page_printers = technology & T_FFF ? page_fff : page_msla; PagePrinters* page_printers = technology & T_FFF ? page_fff : page_msla;
select_default_materials_for_printer_page(page_printers, technology); select_default_materials_for_printer_page(page_printers, technology);
for (const auto& printer : pages_3rdparty) for (const auto& printer : pages_3rdparty)
{ {
page_printers = technology & T_FFF ? printer.second.first : printer.second.second; page_printers = technology & T_FFF ? printer.second.first : printer.second.second;
if (page_printers) if (page_printers)
select_default_materials_for_printer_page(page_printers, technology); select_default_materials_for_printer_page(page_printers, technology);
} }
*/
// Iterate printer_models and select default materials. If none available -> msg to user.
std::vector<const VendorProfile::PrinterModel*> models_without_default;
for (const VendorProfile::PrinterModel* printer_model : printer_models) {
if (printer_model->default_materials.empty()) {
models_without_default.emplace_back(printer_model);
} else {
for (const std::string& material : printer_model->default_materials)
appconfig_new.set(appconfig_section, material, "1");
}
}
if (!models_without_default.empty()) {
std::string printer_names = "\n\n";
for (const VendorProfile::PrinterModel* printer_model : models_without_default) {
printer_names += printer_model->name + "\n";
}
printer_names += "\n\n";
std::string message = (technology & T_FFF ?
GUI::format(_L("Following printer profiles has no default filament: %1%Please select one manually."), printer_names) :
GUI::format(_L("Following printer profiles has no default material: %1%Please select one manually."), printer_names));
MessageDialog msg(q, message, _L("Notice"), wxOK);
msg.ShowModal();
}
update_materials(technology); update_materials(technology);
((technology & T_FFF) ? page_filaments : page_sla_materials)->reload_presets(); ((technology & T_FFF) ? page_filaments : page_sla_materials)->reload_presets();