OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::ConfigWizard::priv Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/ConfigWizard_private.hpp>

Collaboration diagram for Slic3r::GUI::ConfigWizard::priv:

Public Member Functions

 priv (ConfigWizard *q)
void load_pages ()
void init_dialog_size ()
void load_vendors ()
void add_page (ConfigWizardPage *page)
void enable_next (bool enable)
void set_start_page (ConfigWizard::StartPage start_page)
void create_3rdparty_pages ()
void set_run_reason (RunReason run_reason)
void update_materials (Technology technology)
void on_custom_setup (const bool custom_wanted)
void on_printer_pick (PagePrinters *page, const PrinterPickerEvent &evt)
void select_default_materials_for_printer_model (const VendorProfile::PrinterModel &printer_model, Technology technology)
void select_default_materials_for_printer_models (Technology technology, const std::set< const VendorProfile::PrinterModel * > &printer_models)
void on_3rdparty_install (const VendorProfile *vendor, bool install)
bool on_bnt_finish ()
bool check_and_install_missing_materials (Technology technology, const std::string &only_for_model_id=std::string())
bool apply_config (AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool &apply_keeped_changes)
void update_presets_in_config (const std::string &section, const std::string &alias_key, bool add)
bool check_fff_selected ()
bool check_sla_selected ()
int em () const

Public Attributes

ConfigWizard * q
ConfigWizard::RunReason run_reason = RR_USER
AppConfig appconfig_new
BundleMap bundles
Materials filaments
Materials sla_materials
PresetAliases aliases_fff
PresetAliases aliases_sla
std::unique_ptr< DynamicPrintConfig > custom_config
bool any_fff_selected
bool any_sla_selected
bool custom_printer_selected { false }
bool only_sla_mode { false }
wxScrolledWindow * hscroll = nullptr
wxBoxSizer * hscroll_sizer = nullptr
wxBoxSizer * btnsizer = nullptr
ConfigWizardPage * page_current = nullptr
ConfigWizardIndex * index = nullptr
Button * btn_prev = nullptr
Button * btn_next = nullptr
Button * btn_finish = nullptr
Button * btn_cancel = nullptr
PageMaterials * page_filaments = nullptr
PageMaterials * page_sla_materials = nullptr
PageCustom * page_custom = nullptr
PageFirmware * page_firmware = nullptr
PageBedShape * page_bed = nullptr
PageDiameters * page_diams = nullptr
PageTemperatures * page_temps = nullptr
std::vector< ConfigWizardPage * > all_pages

Detailed Description

Constructor & Destructor Documentation

◆ priv()

Slic3r::GUI::ConfigWizard::priv::priv ( ConfigWizard * q)
inline
593 : q(q)
594 , appconfig_new()
597 {}
@ T_SLA
Definition ConfigWizard_private.hpp:70
@ T_FFF
Definition ConfigWizard_private.hpp:69
ConfigWizard * q
Definition ConfigWizard_private.hpp:542
Materials filaments
Definition ConfigWizard_private.hpp:549
Materials sla_materials
Definition ConfigWizard_private.hpp:550
AppConfig appconfig_new
Definition ConfigWizard_private.hpp:544

References Slic3r::GUI::ConfigWizard::ConfigWizard(), appconfig_new, filaments, q, sla_materials, Slic3r::GUI::T_FFF, and Slic3r::GUI::T_SLA.

Here is the call graph for this function:

Member Function Documentation

◆ add_page()

void Slic3r::GUI::ConfigWizard::priv::add_page ( ConfigWizardPage * page)
1920{
1921 const int proportion = (page->shortname == _L("Filaments")) || (page->shortname == _L("SLA Materials")) ? 1 : 0;
1922 hscroll_sizer->Add(page, proportion, wxEXPAND);
1923 all_pages.push_back(page);
1924}
#define _L(s)
Definition OBJ.cpp:34
wxBoxSizer * hscroll_sizer
Definition ConfigWizard_private.hpp:561
std::vector< ConfigWizardPage * > all_pages
Definition ConfigWizard_private.hpp:590

References _L, all_pages, Slic3r::GUI::ConfigWizard::ConfigWizardPage, hscroll_sizer, and Slic3r::GUI::ConfigWizardPage::shortname.

Referenced by create_3rdparty_pages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ apply_config()

bool Slic3r::GUI::ConfigWizard::priv::apply_config ( AppConfig * app_config,
PresetBundle * preset_bundle,
const PresetUpdater * updater,
bool & apply_keeped_changes )
2376{
2377 wxString header, caption = _L("Configuration is edited in ConfigWizard");
2378 const auto enabled_vendors = appconfig_new.vendors();
2379
2380 bool suppress_sla_printer = model_has_multi_part_objects(wxGetApp().model());
2381 PrinterTechnology preferred_pt = ptAny;
2382 auto get_preferred_printer_technology = [enabled_vendors, suppress_sla_printer](const std::string& bundle_name, const Bundle& bundle) {
2383 const auto config = enabled_vendors.find(bundle_name);
2385 if (config != enabled_vendors.end()) {
2386 for (const auto& model : bundle.vendor_profile->models) {
2387 if (const auto model_it = config->second.find(model.id);
2388 model_it != config->second.end() && model_it->second.size() > 0) {
2389 if (pt == ptAny)
2390 pt = model.technology;
2391 // if preferred printer model has SLA printer technology it's important to check the model for multypart state
2392 if (pt == ptSLA && suppress_sla_printer)
2393 continue;
2394 else
2395 return pt;
2396 }
2397 }
2398 }
2399 return pt;
2400 };
2401 // Prusa printers are considered first, then 3rd party.
2402 if (preferred_pt = get_preferred_printer_technology("BBL", bundles.bbl_bundle());
2403 preferred_pt == ptAny || (preferred_pt == ptSLA && suppress_sla_printer)) {
2404 for (const auto& bundle : bundles) {
2405 //BBS: set BBL as default
2406 if (bundle.second.is_bbl_bundle) { continue; }
2407 if (PrinterTechnology pt = get_preferred_printer_technology(bundle.first, bundle.second); pt == ptAny)
2408 continue;
2409 else if (preferred_pt == ptAny)
2410 preferred_pt = pt;
2411 if(!(preferred_pt == ptAny || (preferred_pt == ptSLA && suppress_sla_printer)))
2412 break;
2413 }
2414 }
2415
2416 if (preferred_pt == ptSLA && !wxGetApp().may_switch_to_SLA_preset(caption))
2417 return false;
2418
2419 bool check_unsaved_preset_changes = false;
2420 if (check_unsaved_preset_changes)
2421 header = _L("All user presets will be deleted.");
2422 int act_btns = ActionButtons::KEEP;
2423 if (!check_unsaved_preset_changes)
2424 act_btns |= ActionButtons::SAVE;
2425
2426 // Install bundles from resources if needed:
2427 std::vector<std::string> install_bundles;
2428 for (const auto &pair : bundles) {
2429 if (! pair.second.is_in_resources) { continue; }
2430
2431 //BBS: set BBL as default
2432 if (pair.second.is_bbl_bundle) {
2433 // Always install Prusa bundle, because it has a lot of filaments/materials
2434 // likely to be referenced by other profiles.
2435 install_bundles.emplace_back(pair.first);
2436 continue;
2437 }
2438
2439 const auto vendor = enabled_vendors.find(pair.first);
2440 if (vendor == enabled_vendors.end()) { continue; }
2441
2442 size_t size_sum = 0;
2443 for (const auto &model : vendor->second) { size_sum += model.second.size(); }
2444
2445 if (size_sum > 0) {
2446 // This vendor needs to be installed
2447 install_bundles.emplace_back(pair.first);
2448 }
2449 }
2450 if (!check_unsaved_preset_changes)
2451 if ((check_unsaved_preset_changes = install_bundles.size() > 0))
2452 header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of their printers will be activated", install_bundles.size());
2453
2454 // Decide whether to create snapshot based on run_reason and the reset profile checkbox
2455 bool snapshot = true;
2457 switch (run_reason) {
2459 snapshot = false;
2460 break;
2462 snapshot = true;
2463 break;
2465 // In this case snapshot has already been taken by
2466 // PresetUpdater with the appropriate reason
2467 snapshot = false;
2468 break;
2470 snapshot = false;
2471 snapshot_reason = Snapshot::SNAPSHOT_USER;
2472 break;
2473 }
2474
2475 //BBS: remove snapshot logic
2476 /*if (snapshot && ! take_config_snapshot_cancel_on_error(*app_config, snapshot_reason, "", _u8L("Do you want to continue changing the configuration?")))
2477 return false;*/
2478
2479 if (check_unsaved_preset_changes &&
2480 !wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2481 return false;
2482
2483 if (install_bundles.size() > 0) {
2484 // Install bundles from resources.
2485 // Don't create snapshot - we've already done that above if applicable.
2486 if (! updater->install_bundles_rsrc(std::move(install_bundles), false))
2487 return false;
2488 } else {
2489 BOOST_LOG_TRIVIAL(info) << "No bundles need to be installed from resources";
2490 }
2491
2492 std::string preferred_model;
2493 std::string preferred_variant;
2494 const auto enabled_vendors_old = app_config->vendors();
2495 auto get_preferred_printer_model = [enabled_vendors, enabled_vendors_old, preferred_pt](const std::string& bundle_name, const Bundle& bundle, std::string& variant) {
2496 const auto config = enabled_vendors.find(bundle_name);
2497 if (config == enabled_vendors.end())
2498 return std::string();
2499 for (const auto& model : bundle.vendor_profile->models) {
2500 if (const auto model_it = config->second.find(model.id);
2501 model_it != config->second.end() && model_it->second.size() > 0 &&
2502 preferred_pt == model.technology) {
2503 variant = *model_it->second.begin();
2504 const auto config_old = enabled_vendors_old.find(bundle_name);
2505 if (config_old == enabled_vendors_old.end())
2506 return model.id;
2507 const auto model_it_old = config_old->second.find(model.id);
2508 if (model_it_old == config_old->second.end())
2509 return model.id;
2510 else if (model_it_old->second != model_it->second) {
2511 for (const auto& var : model_it->second)
2512 if (model_it_old->second.find(var) == model_it_old->second.end()) {
2513 variant = var;
2514 return model.id;
2515 }
2516 }
2517 }
2518 }
2519 if (!variant.empty())
2520 variant.clear();
2521 return std::string();
2522 };
2523 // Prusa printers are considered first, then 3rd party.
2524 if (preferred_model = get_preferred_printer_model("BBL", bundles.bbl_bundle(), preferred_variant);
2525 preferred_model.empty()) {
2526 for (const auto& bundle : bundles) {
2527 if (bundle.second.is_bbl_bundle) { continue; }
2528 if (preferred_model = get_preferred_printer_model(bundle.first, bundle.second, preferred_variant);
2529 !preferred_model.empty())
2530 break;
2531 }
2532 }
2533
2534 // if unsaved changes was not cheched till this moment
2535 if (!check_unsaved_preset_changes) {
2536 if ((check_unsaved_preset_changes = !preferred_model.empty())) {
2537 header = _L("A new Printer was installed and it will be activated.");
2538 if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2539 return false;
2540 }
2541 else if ((check_unsaved_preset_changes = enabled_vendors_old != enabled_vendors)) {
2542 header = _L("Some Printers were uninstalled.");
2543 if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2544 return false;
2545 }
2546 }
2547
2548 std::string first_added_filament, first_added_sla_material;
2549 auto get_first_added_material_preset = [this, app_config](const std::string& section_name, std::string& first_added_preset) {
2550 if (appconfig_new.has_section(section_name)) {
2551 // get first of new added preset names
2552 const std::map<std::string, std::string>& old_presets = app_config->has_section(section_name) ? app_config->get_section(section_name) : std::map<std::string, std::string>();
2553 first_added_preset = get_first_added_preset(old_presets, appconfig_new.get_section(section_name));
2554 }
2555 };
2556 get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament);
2557
2558 //BBS skip sla get_first_added_material_preset(AppConfig::SECTION_MATERIALS, first_added_sla_material);
2559
2560 // if unsaved changes was not cheched till this moment
2561 if (!check_unsaved_preset_changes) {
2562 if ((check_unsaved_preset_changes = !first_added_filament.empty() || !first_added_sla_material.empty())) {
2563 header = !first_added_filament.empty() ?
2564 _L("A new filament was installed and it will be activated.") :
2565 _L("A new SLA material was installed and it will be activated.");
2566 if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2567 return false;
2568 }
2569 else {
2570 //BBS
2571 bool is_filaments_changed = app_config->get_section(AppConfig::SECTION_FILAMENTS) != appconfig_new.get_section(AppConfig::SECTION_FILAMENTS);
2572 if ((check_unsaved_preset_changes = is_filaments_changed)) {
2573 header = _L("Some filaments were uninstalled.");
2574 if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2575 return false;
2576 }
2577
2578 /*bool is_filaments_changed = app_config->get_section(AppConfig::SECTION_FILAMENTS) != appconfig_new.get_section(AppConfig::SECTION_FILAMENTS);
2579 bool is_sla_materials_changed = app_config->get_section(AppConfig::SECTION_MATERIALS) != appconfig_new.get_section(AppConfig::SECTION_MATERIALS);
2580 if ((check_unsaved_preset_changes = is_filaments_changed || is_sla_materials_changed)) {
2581 header = is_filaments_changed ? _L("Some filaments were uninstalled.") : _L("Some SLA materials were uninstalled.");
2582 if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
2583 return false;
2584 }*/
2585 }
2586 }
2587
2588 // apply materials in app_config
2589 //BBS skip sla
2590 for (const std::string& section_name : {AppConfig::SECTION_FILAMENTS})
2591 app_config->set_section(section_name, appconfig_new.get_section(section_name));
2592
2593 app_config->set_vendors(appconfig_new);
2594
2595 if (check_unsaved_preset_changes)
2596 preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::EnableSilentDisableSystem,
2597 {preferred_model, preferred_variant, first_added_filament, first_added_sla_material});
2598
2599 if (!only_sla_mode && page_custom->custom_wanted()) {
2600 // if unsaved changes was not cheched till this moment
2601 if (!check_unsaved_preset_changes &&
2602 !wxGetApp().check_and_keep_current_preset_changes(caption, _L("Custom printer was installed and it will be activated."), act_btns, &apply_keeped_changes))
2603 return false;
2604
2605 page_firmware->apply_custom_config(*custom_config);
2606 page_bed->apply_custom_config(*custom_config);
2607 page_diams->apply_custom_config(*custom_config);
2608 //page_temps->apply_custom_config(*custom_config);
2609
2610#if ENABLE_COPY_CUSTOM_BED_MODEL_AND_TEXTURE
2611 copy_bed_model_and_texture_if_needed(*custom_config);
2612#endif // ENABLE_COPY_CUSTOM_BED_MODEL_AND_TEXTURE
2613
2614 custom_config->set_key_value("filament_colour", wxGetApp().preset_bundle->project_config.option("filament_colour"));
2615 const std::string profile_name = page_custom->profile_name();
2616 Semver semver(SLIC3R_VERSION);
2617 preset_bundle->load_config_from_wizard(profile_name, *custom_config, semver);
2618
2619 wxGetApp().plater()->sidebar().update_presets(Slic3r::Preset::Type::TYPE_PRINTER);
2620 wxGetApp().plater()->sidebar().update_presets(Slic3r::Preset::Type::TYPE_FILAMENT);
2621 wxGetApp().plater()->sidebar().update_presets(Slic3r::Preset::Type::TYPE_PRINT);
2622 }
2623
2624 // Update the selections from the compatibilty.
2625 preset_bundle->export_selections(*app_config);
2626
2627 // Update Preset Combobox
2628 //auto evt = new SimpleEvent(EVT_UPDATE_PRESET_CB);
2629 //wxQueueEvent(wxGetApp().mainframe, evt);
2630
2631 return true;
2632}
static const std::string SECTION_FILAMENTS
Definition AppConfig.hpp:408
@ RR_DATA_EMPTY
Definition ConfigWizard.hpp:24
@ RR_DATA_LEGACY
Definition ConfigWizard.hpp:25
@ RR_USER
Definition ConfigWizard.hpp:27
@ RR_DATA_INCOMPAT
Definition ConfigWizard.hpp:26
Reason
Definition Snapshot.hpp:36
@ SNAPSHOT_UPGRADE
Definition Snapshot.hpp:38
@ SNAPSHOT_USER
Definition Snapshot.hpp:41
@ TYPE_PRINTER
Definition Preset.hpp:250
@ TYPE_PRINT
Definition Preset.hpp:246
@ TYPE_FILAMENT
Definition Preset.hpp:248
const char * section_name(ShortcutSection section)
Definition Shortcuts.cpp:248
static std::string get_first_added_preset(const std::map< std::string, std::string > &old_data, const std::map< std::string, std::string > &new_data)
Definition ConfigWizard.cpp:2367
@ KEEP
Definition UnsavedChangesDialog.hpp:252
@ SAVE
Definition UnsavedChangesDialog.hpp:253
std::string var(const std::string &file_name)
Definition utils.cpp:278
@ EnableSilentDisableSystem
Definition Config.hpp:251
PrinterTechnology
Definition Config.hpp:229
@ ptSLA
Definition Config.hpp:233
@ ptAny
Definition Config.hpp:237
bool model_has_multi_part_objects(const Model &model)
Definition Model.cpp:4311
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96
PageFirmware * page_firmware
Definition ConfigWizard_private.hpp:584
bool only_sla_mode
Definition ConfigWizard_private.hpp:558
std::unique_ptr< DynamicPrintConfig > custom_config
Definition ConfigWizard_private.hpp:553
BundleMap bundles
Definition ConfigWizard_private.hpp:545
PageBedShape * page_bed
Definition ConfigWizard_private.hpp:585
PageDiameters * page_diams
Definition ConfigWizard_private.hpp:586
PageCustom * page_custom
Definition ConfigWizard_private.hpp:575
ConfigWizard::RunReason run_reason
Definition ConfigWizard_private.hpp:543

References _L, _L_PLURAL, appconfig_new, bundles, custom_config, Slic3r::EnableSilentDisableSystem, Slic3r::PresetBundle::export_selections(), Slic3r::GUI::get_first_added_preset(), Slic3r::AppConfig::get_section(), Slic3r::AppConfig::has_section(), Slic3r::PresetUpdater::install_bundles_rsrc(), Slic3r::GUI::KEEP, Slic3r::PresetBundle::load_config_from_wizard(), Slic3r::PresetBundle::load_presets(), Slic3r::model_has_multi_part_objects(), only_sla_mode, Slic3r::ConfigBase::option(), page_bed, page_custom, page_diams, page_firmware, Slic3r::PresetBundle::project_config, Slic3r::ptAny, Slic3r::ptSLA, Slic3r::GUI::ConfigWizard::RR_DATA_EMPTY, Slic3r::GUI::ConfigWizard::RR_DATA_INCOMPAT, Slic3r::GUI::ConfigWizard::RR_DATA_LEGACY, Slic3r::GUI::ConfigWizard::RR_USER, run_reason, Slic3r::GUI::SAVE, Slic3r::AppConfig::SECTION_FILAMENTS, Slic3r::GUI::section_name(), Slic3r::AppConfig::set_section(), Slic3r::AppConfig::set_vendors(), Slic3r::GUI::Snapshot::SNAPSHOT_UPGRADE, Slic3r::GUI::Snapshot::SNAPSHOT_USER, Slic3r::Preset::TYPE_FILAMENT, Slic3r::Preset::TYPE_PRINT, Slic3r::Preset::TYPE_PRINTER, Slic3r::var(), and Slic3r::AppConfig::vendors().

Here is the call graph for this function:

◆ check_and_install_missing_materials()

bool Slic3r::GUI::ConfigWizard::priv::check_and_install_missing_materials ( Technology technology,
const std::string & only_for_model_id = std::string() )
2252{
2253 // Walk over all installed Printer presets and verify whether there is a filament or SLA material profile installed at the same PresetBundle,
2254 // which is compatible with it.
2255 const auto printer_models_missing_materials = [this, only_for_model_id](PrinterTechnology technology, const std::string &section)
2256 {
2257 const std::map<std::string, std::string> &appconfig_presets = appconfig_new.has_section(section) ? appconfig_new.get_section(section) : std::map<std::string, std::string>();
2258 std::set<const VendorProfile::PrinterModel*> printer_models_without_material;
2259 for (const auto &pair : bundles) {
2260 const PresetCollection &materials = pair.second.preset_bundle->materials(technology);
2261 for (const auto &printer : pair.second.preset_bundle->printers) {
2262 if (printer.is_visible && printer.printer_technology() == technology) {
2263 const VendorProfile::PrinterModel *printer_model = PresetUtils::system_printer_model(printer);
2264 assert(printer_model != nullptr);
2265 if ((only_for_model_id.empty() || only_for_model_id == printer_model->id) &&
2266 printer_models_without_material.find(printer_model) == printer_models_without_material.end()) {
2267 bool has_material = false;
2268 for (const auto& preset : appconfig_presets) {
2269 if (preset.second == "1" || preset.second == "true") {
2270 const Preset *material = materials.find_preset(preset.first, false);
2271 if (material != nullptr && is_compatible_with_printer(PresetWithVendorProfile(*material, nullptr), PresetWithVendorProfile(printer, nullptr))) {
2272 has_material = true;
2273 break;
2274 }
2275 }
2276 }
2277 if (! has_material)
2278 printer_models_without_material.insert(printer_model);
2279 }
2280 }
2281 }
2282 }
2283 assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id);
2284 return printer_models_without_material;
2285 };
2286
2287 const auto ask_and_select_default_materials = [this](const wxString &message, const std::set<const VendorProfile::PrinterModel*> &printer_models, Technology technology)
2288 {
2289 //wxMessageDialog msg(q, message, _L("Notice"), wxYES_NO);
2290 MessageDialog msg(q, message, _L("Notice"), wxYES_NO);
2291 if (msg.ShowModal() == wxID_YES)
2292 select_default_materials_for_printer_models(technology, printer_models);
2293 };
2294
2295 const auto printer_model_list = [](const std::set<const VendorProfile::PrinterModel*> &printer_models) -> wxString {
2296 wxString out;
2297 for (const VendorProfile::PrinterModel *printer_model : printer_models) {
2298 wxString name = from_u8(printer_model->name);
2299 out += "\t\t";
2300 out += name;
2301 out += "\n";
2302 }
2303 return out;
2304 };
2305
2306 if (any_fff_selected && (technology & T_FFF)) {
2307 std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptFFF, AppConfig::SECTION_FILAMENTS);
2308 if (! printer_models_without_material.empty()) {
2309 if (only_for_model_id.empty())
2310 ask_and_select_default_materials(
2311 _L("The following FFF printer models have no filament selected:") +
2312 "\n\n\t" +
2313 printer_model_list(printer_models_without_material) +
2314 "\n\n\t" +
2315 _L("Do you want to select default filaments for these FFF printer models?"),
2316 printer_models_without_material,
2317 T_FFF);
2318 else
2319 select_default_materials_for_printer_model(**printer_models_without_material.begin(), T_FFF);
2320 return false;
2321 }
2322 }
2323
2324 /* BBS skip SLA
2325 if (any_sla_selected && (technology & T_SLA)) {
2326 std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptSLA, AppConfig::SECTION_MATERIALS);
2327 if (! printer_models_without_material.empty()) {
2328 if (only_for_model_id.empty())
2329 ask_and_select_default_materials(
2330 _L("The following SLA printer models have no materials selected:") +
2331 "\n\n\t" +
2332 printer_model_list(printer_models_without_material) +
2333 "\n\n\t" +
2334 _L("Do you want to select default SLA materials for these printer models?"),
2335 printer_models_without_material,
2336 T_SLA);
2337 else
2338 select_default_materials_for_printer_model(**printer_models_without_material.begin(), T_SLA);
2339 return false;
2340 }
2341 }
2342 */
2343
2344 return true;
2345}
static const wxString & name(const bool from_menu=false)
Definition ConfigWizard.cpp:2830
Technology
Definition ConfigWizard_private.hpp:67
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
const VendorProfile::PrinterModel * system_printer_model(const Preset &preset)
Definition Preset.cpp:5081
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
Definition Preset.cpp:909
@ ptFFF
Definition Config.hpp:231
@ Preset
Definition calib.hpp:39
void select_default_materials_for_printer_model(const VendorProfile::PrinterModel &printer_model, Technology technology)
Definition ConfigWizard.cpp:2161
bool any_fff_selected
Definition ConfigWizard_private.hpp:554
void select_default_materials_for_printer_models(Technology technology, const std::set< const VendorProfile::PrinterModel * > &printer_models)
Definition ConfigWizard.cpp:2168

References _L, any_fff_selected, appconfig_new, bundles, Slic3r::PresetCollection::find_preset(), Slic3r::GUI::from_u8(), Slic3r::VendorProfile::PrinterModel::id, Slic3r::is_compatible_with_printer(), Slic3r::GUI::ConfigWizard::name(), Slic3r::ptFFF, q, Slic3r::AppConfig::SECTION_FILAMENTS, select_default_materials_for_printer_model(), select_default_materials_for_printer_models(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::PresetUtils::system_printer_model(), and Slic3r::GUI::T_FFF.

Referenced by on_bnt_finish(), and on_printer_pick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_fff_selected()

bool Slic3r::GUI::ConfigWizard::priv::check_fff_selected ( )
2653{
2654 return false;
2655}

Referenced by on_printer_pick().

Here is the caller graph for this function:

◆ check_sla_selected()

bool Slic3r::GUI::ConfigWizard::priv::check_sla_selected ( )
2658{
2659 return false;
2660}

Referenced by on_printer_pick().

Here is the caller graph for this function:

◆ create_3rdparty_pages()

void Slic3r::GUI::ConfigWizard::priv::create_3rdparty_pages ( )
1955{
1956 for (const auto &pair : bundles) {
1957 const VendorProfile *vendor = pair.second.vendor_profile;
1958 //Orca: add custom as default
1959 if (vendor->id == PresetBundle::ORCA_DEFAULT_BUNDLE) { continue; }
1960
1961 bool is_fff_technology = false;
1962 bool is_sla_technology = false;
1963
1964 for (auto& model: vendor->models)
1965 {
1966 if (!is_fff_technology && model.technology == ptFFF)
1967 is_fff_technology = true;
1968 if (!is_sla_technology && model.technology == ptSLA)
1969 is_sla_technology = true;
1970 }
1971
1972 PagePrinters* pageFFF = nullptr;
1973 PagePrinters* pageSLA = nullptr;
1974
1975 if (is_fff_technology) {
1976 pageFFF = new PagePrinters(q, vendor->name + " " +_L("FFF Technology Printers"), vendor->name+" FFF", *vendor, 1, T_FFF);
1977 add_page(pageFFF);
1978 }
1979
1980 if (is_sla_technology) {
1981 pageSLA = new PagePrinters(q, vendor->name + " " + _L("SLA Technology Printers"), vendor->name+" MSLA", *vendor, 1, T_SLA);
1982 add_page(pageSLA);
1983 }
1984
1985 //pages_3rdparty.insert({vendor->id, {pageFFF, pageSLA}});
1986 }
1987}
static const char * ORCA_DEFAULT_BUNDLE
Definition PresetBundle.hpp:686
void add_page(ConfigWizardPage *page)
Definition ConfigWizard.cpp:1919

References _L, add_page(), bundles, Slic3r::VendorProfile::id, Slic3r::VendorProfile::models, Slic3r::VendorProfile::name, Slic3r::PresetBundle::ORCA_DEFAULT_BUNDLE, Slic3r::ptFFF, Slic3r::ptSLA, q, Slic3r::GUI::T_FFF, and Slic3r::GUI::T_SLA.

Here is the call graph for this function:

◆ em()

int Slic3r::GUI::ConfigWizard::priv::em ( ) const
inline
627{ return 10; }

Referenced by init_dialog_size().

Here is the caller graph for this function:

◆ enable_next()

void Slic3r::GUI::ConfigWizard::priv::enable_next ( bool enable)
1927{
1928 btn_next->Enable(enable);
1929 btn_finish->Enable(enable);
1930}
Button * btn_next
Definition ConfigWizard_private.hpp:567
Button * btn_finish
Definition ConfigWizard_private.hpp:568

References btn_finish, and btn_next.

◆ init_dialog_size()

void Slic3r::GUI::ConfigWizard::priv::init_dialog_size ( )
1838{
1839 // Clamp the Wizard size based on screen dimensions
1840
1841 const auto idx = wxDisplay::GetFromWindow(q);
1842 wxDisplay display(idx != wxNOT_FOUND ? idx : 0u);
1843
1844 const auto disp_rect = display.GetClientArea();
1845 wxRect window_rect(
1846 disp_rect.x + disp_rect.width / 20,
1847 disp_rect.y + disp_rect.height / 20,
1848 9*disp_rect.width / 10,
1849 9*disp_rect.height / 10);
1850
1851 const int width_hint = index->GetSize().GetWidth() + 90 * em()/*std::max(90 * em(), (only_sla_mode ? page_msla->get_width() : page_fff->get_width()) + 30 * em())*/; // XXX: magic constant, I found no better solution
1852 if (width_hint < window_rect.width) {
1853 window_rect.x += (window_rect.width - width_hint) / 2;
1854 window_rect.width = width_hint;
1855 }
1856
1857 q->SetSize(window_rect);
1858}
ConfigWizardIndex * index
Definition ConfigWizard_private.hpp:564
int em() const
Definition ConfigWizard_private.hpp:627

References em(), index, and q.

Here is the call graph for this function:

◆ load_pages()

void Slic3r::GUI::ConfigWizard::priv::load_pages ( )
1804{
1805 wxWindowUpdateLocker freeze_guard(q);
1806 (void)freeze_guard;
1807
1808 const ConfigWizardPage *former_active = index->active_page();
1809
1810 index->clear();
1811
1812 // Printers
1813 if (!only_sla_mode) {
1814 index->add_page(page_custom);
1815 if (page_custom->custom_wanted()) {
1816 index->add_page(page_firmware);
1817 index->add_page(page_bed);
1818 index->add_page(page_diams);
1819 //index->add_page(page_temps);
1820 }
1821
1822 // Filaments & Materials
1823 if (any_fff_selected) { index->add_page(page_filaments); }
1824 }
1825 if (any_sla_selected) { index->add_page(page_sla_materials); }
1826
1827 // there should to be selected at least one printer
1829
1830 index->go_to(former_active); // Will restore the active item/page if possible
1831
1832 q->Layout();
1833// This Refresh() is needed to avoid ugly artifacts after printer selection, when no one vendor was selected from the very beginnig
1834 q->Refresh();
1835}
friend struct ConfigWizardPage
Definition ConfigWizard.hpp:58
PageMaterials * page_sla_materials
Definition ConfigWizard_private.hpp:574
bool any_sla_selected
Definition ConfigWizard_private.hpp:555
PageMaterials * page_filaments
Definition ConfigWizard_private.hpp:573
bool custom_printer_selected
Definition ConfigWizard_private.hpp:556

References any_fff_selected, any_sla_selected, btn_finish, Slic3r::GUI::ConfigWizard::ConfigWizardPage, custom_printer_selected, index, only_sla_mode, page_bed, page_custom, page_diams, page_filaments, page_firmware, page_sla_materials, and q.

Referenced by on_3rdparty_install(), on_custom_setup(), and on_printer_pick().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_vendors()

void Slic3r::GUI::ConfigWizard::priv::load_vendors ( )
1861{
1863
1864 // Load up the set of vendors / models / variants the user has had enabled up till now
1865 AppConfig *app_config = wxGetApp().app_config;
1866 if (! app_config->legacy_datadir()) {
1867 appconfig_new.set_vendors(*app_config);
1868 } else {
1869 // In case of legacy datadir, try to guess the preference based on the printer preset files that are present
1870 //BBS: change directories by design
1871 const auto printer_dir = fs::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR / PRESET_PRINTER_NAME;
1872 for (auto &dir_entry : boost::filesystem::directory_iterator(printer_dir))
1873 if (Slic3r::is_ini_file(dir_entry)) {
1874 auto needle = legacy_preset_map.find(dir_entry.path().filename().string());
1875 if (needle == legacy_preset_map.end()) { continue; }
1876
1877 const auto &model = needle->second.first;
1878 const auto &variant = needle->second.second;
1879 appconfig_new.set_variant("BambuResearch", model, variant, true);
1880 }
1881 }
1882
1883 // Initialize the is_visible flag in printer Presets
1884 for (auto &pair : bundles) {
1885 pair.second.preset_bundle->load_installed_printers(appconfig_new);
1886 }
1887
1888 // Copy installed filaments and SLA material names from app_config to appconfig_new
1889 // while resolving current names of profiles, which were renamed in the meantime.
1890 for (PrinterTechnology technology : { ptFFF, ptSLA }) {
1891 const std::string &section_name = (technology == ptFFF) ? AppConfig::SECTION_FILAMENTS : AppConfig::SECTION_MATERIALS;
1892 std::map<std::string, std::string> section_new;
1893 if (app_config->has_section(section_name)) {
1894 const std::map<std::string, std::string> &section_old = app_config->get_section(section_name);
1895 for (const auto& material_name_and_installed : section_old)
1896 if (material_name_and_installed.second == "true") {
1897 // Material is installed. Resolve it in bundles.
1898 size_t num_found = 0;
1899 const std::string &material_name = material_name_and_installed.first;
1900 for (auto &bundle : bundles) {
1901 const PresetCollection &materials = bundle.second.preset_bundle->materials(technology);
1902 const Preset *preset = materials.find_preset(material_name);
1903 if (preset != nullptr) {
1904 // Materal preset was found, mark it as installed.
1905 section_new[preset->name] = "true";
1906 ++ num_found;
1907 }
1908 }
1909 if (num_found == 0)
1910 BOOST_LOG_TRIVIAL(error) << boost::format("Profile %1% was not found in installed vendor Preset Bundles.") % material_name;
1911 else if (num_found > 1)
1912 BOOST_LOG_TRIVIAL(error) << boost::format("Profile %1% was found in %2% vendor Preset Bundles.") % material_name % num_found;
1913 }
1914 }
1915 appconfig_new.set_section(section_name, section_new);
1916 };
1917}
#define PRESET_SYSTEM_DIR
Definition Preset.hpp:31
#define PRESET_PRINTER_NAME
Definition Preset.hpp:35
static const std::unordered_map< std::string, std::pair< std::string, std::string > > legacy_preset_map
Definition ConfigWizard.cpp:1800
const std::string & data_dir()
Definition utils.cpp:365
bool is_ini_file(const boost::filesystem::directory_entry &dir_entry)
Definition utils.cpp:1197
static BundleMap load()
Definition ConfigWizard.cpp:152

References appconfig_new, bundles, Slic3r::data_dir(), Slic3r::PresetCollection::find_preset(), Slic3r::AppConfig::get_section(), Slic3r::AppConfig::has_section(), Slic3r::is_ini_file(), Slic3r::AppConfig::legacy_datadir(), Slic3r::GUI::legacy_preset_map, Slic3r::GUI::BundleMap::load(), Slic3r::Preset::name, PRESET_PRINTER_NAME, PRESET_SYSTEM_DIR, Slic3r::ptFFF, Slic3r::ptSLA, Slic3r::AppConfig::SECTION_FILAMENTS, Slic3r::AppConfig::SECTION_MATERIALS, and Slic3r::GUI::section_name().

Here is the call graph for this function:

◆ on_3rdparty_install()

void Slic3r::GUI::ConfigWizard::priv::on_3rdparty_install ( const VendorProfile * vendor,
bool install )
2202{
2203 //auto it = pages_3rdparty.find(vendor->id);
2204 //wxCHECK_RET(it != pages_3rdparty.end(), "Internal error: GUI page not found for 3rd party vendor profile");
2205
2206 //for (PagePrinters* page : { it->second.first, it->second.second })
2207 // if (page) {
2208 // if (page->install && !install)
2209 // page->select_all(false);
2210 // page->install = install;
2211 // // if some 3rd vendor is selected, select first printer for them
2212 // if (install)
2213 // page->printer_pickers[0]->select_one(0, true);
2214 // page->Layout();
2215 // }
2216
2217 load_pages();
2218}
void load_pages()
Definition ConfigWizard.cpp:1803

References load_pages().

Here is the call graph for this function:

◆ on_bnt_finish()

bool Slic3r::GUI::ConfigWizard::priv::on_bnt_finish ( )
2221{
2222 wxBusyCursor wait;
2223 /* When Filaments or Sla Materials pages are activated,
2224 * materials for this pages are automaticaly updated and presets are reloaded.
2225 *
2226 * But, if _Finish_ button was clicked without activation of those pages
2227 * (for example, just some printers were added/deleted),
2228 * than last changes wouldn't be updated for filaments/materials.
2229 * SO, do that before close of Wizard
2230 */
2231
2233 if (any_fff_selected)
2234 page_filaments->reload_presets();
2235
2236 // theres no need to check that filament is selected if we have only custom printer
2238 // check, that there is selected at least one filament/material
2240}
@ T_ANY
Definition ConfigWizard_private.hpp:71
void update_materials(Technology technology)
Definition ConfigWizard.cpp:1997
bool check_and_install_missing_materials(Technology technology, const std::string &only_for_model_id=std::string())
Definition ConfigWizard.cpp:2251

References any_fff_selected, any_sla_selected, check_and_install_missing_materials(), custom_printer_selected, page_filaments, Slic3r::GUI::T_ANY, and update_materials().

Here is the call graph for this function:

◆ on_custom_setup()

void Slic3r::GUI::ConfigWizard::priv::on_custom_setup ( const bool custom_wanted)
2125{
2126 custom_printer_selected = custom_wanted;
2127 load_pages();
2128}

References custom_printer_selected, and load_pages().

Referenced by Slic3r::GUI::PageCustom::PageCustom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_printer_pick()

void Slic3r::GUI::ConfigWizard::priv::on_printer_pick ( PagePrinters * page,
const PrinterPickerEvent & evt )
2131{
2136
2137 load_pages();
2138 }
2139
2140 // Update the is_visible flag on relevant printer profiles
2141 for (auto &pair : bundles) {
2142 if (pair.first != evt.vendor_id) { continue; }
2143
2144 for (auto &preset : pair.second.preset_bundle->printers) {
2145 if (preset.config.opt_string("printer_model") == evt.model_id
2146 && preset.config.opt_string("printer_variant") == evt.variant_name) {
2147 preset.is_visible = evt.enable;
2148 }
2149 }
2150
2151 // When a printer model is picked, but there is no material installed compatible with this printer model,
2152 // install default materials for selected printer model silently.
2153 check_and_install_missing_materials(page->technology, evt.model_id);
2154 }
2155
2156 if (page->technology & T_FFF) {
2157 page_filaments->clear();
2158 }
2159}
bool check_fff_selected()
Definition ConfigWizard.cpp:2652
bool check_sla_selected()
Definition ConfigWizard.cpp:2657

References any_fff_selected, any_sla_selected, bundles, check_and_install_missing_materials(), check_fff_selected(), check_sla_selected(), Slic3r::GUI::PrinterPickerEvent::enable, load_pages(), Slic3r::GUI::PrinterPickerEvent::model_id, page_filaments, Slic3r::GUI::T_FFF, Slic3r::GUI::PagePrinters::technology, Slic3r::GUI::PrinterPickerEvent::variant_name, and Slic3r::GUI::PrinterPickerEvent::vendor_id.

Referenced by Slic3r::GUI::PagePrinters::PagePrinters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_default_materials_for_printer_model()

void Slic3r::GUI::ConfigWizard::priv::select_default_materials_for_printer_model ( const VendorProfile::PrinterModel & printer_model,
Technology technology )
2162{
2163 PageMaterials* page_materials = technology & T_FFF ? page_filaments : page_sla_materials;
2164 for (const std::string& material : printer_model.default_materials)
2165 appconfig_new.set(page_materials->materials->appconfig_section(), material, "true");
2166}

References appconfig_new, Slic3r::GUI::Materials::appconfig_section(), Slic3r::VendorProfile::PrinterModel::default_materials, Slic3r::GUI::PageMaterials::materials, page_filaments, page_sla_materials, and Slic3r::GUI::T_FFF.

Referenced by check_and_install_missing_materials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ select_default_materials_for_printer_models()

void Slic3r::GUI::ConfigWizard::priv::select_default_materials_for_printer_models ( Technology technology,
const std::set< const VendorProfile::PrinterModel * > & printer_models )
2169{
2170 PageMaterials *page_materials = technology & T_FFF ? page_filaments : page_sla_materials;
2171 const std::string &appconfig_section = page_materials->materials->appconfig_section();
2172
2173 // Iterate printer_models and select default materials. If none available -> msg to user.
2174 std::vector<const VendorProfile::PrinterModel*> models_without_default;
2175 for (const VendorProfile::PrinterModel* printer_model : printer_models) {
2176 if (printer_model->default_materials.empty()) {
2177 models_without_default.emplace_back(printer_model);
2178 } else {
2179 for (const std::string& material : printer_model->default_materials)
2180 appconfig_new.set(appconfig_section, material, "true");
2181 }
2182 }
2183
2184 if (!models_without_default.empty()) {
2185 std::string printer_names = "\n\n";
2186 for (const VendorProfile::PrinterModel* printer_model : models_without_default) {
2187 printer_names += printer_model->name + "\n";
2188 }
2189 printer_names += "\n\n";
2190 std::string message = (technology & T_FFF ?
2191 GUI::format(_L("The following printer profiles have no default filament: %1%Please select one manually."), printer_names) :
2192 GUI::format(_L("The following printer profiles have no default material: %1%Please select one manually."), printer_names));
2193 MessageDialog msg(q, message, _L("Notice"), wxOK);
2194 msg.ShowModal();
2195 }
2196
2197 update_materials(technology);
2198 ((technology & T_FFF) ? page_filaments : page_sla_materials)->reload_presets();
2199}
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36

References _L, appconfig_new, Slic3r::GUI::Materials::appconfig_section(), Slic3r::GUI::format(), Slic3r::GUI::PageMaterials::materials, page_filaments, page_sla_materials, q, Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::T_FFF, and update_materials().

Referenced by check_and_install_missing_materials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_run_reason()

void Slic3r::GUI::ConfigWizard::priv::set_run_reason ( RunReason run_reason)
1990{
1991 this->run_reason = run_reason;
1992 for (auto &page : all_pages) {
1993 page->set_run_reason(run_reason);
1994 }
1995}

References all_pages, and run_reason.

◆ set_start_page()

void Slic3r::GUI::ConfigWizard::priv::set_start_page ( ConfigWizard::StartPage start_page)
1933{
1934 switch (start_page) {
1936 index->go_to(page_custom);
1937 btn_next->SetFocus();
1938 break;
1940 index->go_to(page_filaments);
1941 btn_finish->SetFocus();
1942 break;
1944 index->go_to(page_sla_materials);
1945 btn_finish->SetFocus();
1946 break;
1947 default:
1948 index->go_to(page_custom);
1949 btn_next->SetFocus();
1950 break;
1951 }
1952}
@ SP_CUSTOM
Definition ConfigWizard.hpp:36
@ SP_MATERIALS
Definition ConfigWizard.hpp:35
@ SP_FILAMENTS
Definition ConfigWizard.hpp:34

References btn_finish, btn_next, index, page_custom, page_filaments, page_sla_materials, Slic3r::GUI::ConfigWizard::SP_CUSTOM, Slic3r::GUI::ConfigWizard::SP_FILAMENTS, and Slic3r::GUI::ConfigWizard::SP_MATERIALS.

◆ update_materials()

void Slic3r::GUI::ConfigWizard::priv::update_materials ( Technology technology)
1998{
1999 if (any_fff_selected && (technology & T_FFF)) {
2000 filaments.clear();
2001 aliases_fff.clear();
2002 // Iterate filaments in all bundles
2003 for (const auto &pair : bundles) {
2004 for (const auto &filament : pair.second.preset_bundle->filaments) {
2005 // Check if filament is already added
2006 if (filaments.containts(&filament))
2007 continue;
2008 // Iterate printers in all bundles
2009 for (const auto &printer : pair.second.preset_bundle->printers) {
2010 if (!printer.is_visible || printer.printer_technology() != ptFFF)
2011 continue;
2012 // Filter out inapplicable printers
2013 if (is_compatible_with_printer(PresetWithVendorProfile(filament, filament.vendor), PresetWithVendorProfile(printer, printer.vendor))) {
2014 if (!filaments.containts(&filament)) {
2015 filaments.push(&filament);
2016 if (!filament.alias.empty())
2017 aliases_fff[filament.alias].insert(filament.name);
2018 }
2019 filaments.add_printer(&printer);
2020 }
2021 }
2022
2023 }
2024 }
2025 // count compatible printers
2026 for (const auto& preset : filaments.presets) {
2027
2028 const auto filter = [preset](const std::pair<std::string, size_t> element) {
2029 return preset->alias == element.first;
2030 };
2031 if (std::find_if(filaments.compatibility_counter.begin(), filaments.compatibility_counter.end(), filter) != filaments.compatibility_counter.end()) {
2032 continue;
2033 }
2034 std::vector<size_t> idx_with_same_alias;
2035 for (size_t i = 0; i < filaments.presets.size(); ++i) {
2036 if (preset->alias == filaments.presets[i]->alias)
2037 idx_with_same_alias.push_back(i);
2038 }
2039 size_t counter = 0;
2040 for (const auto& printer : filaments.printers) {
2041 if (!(*printer).is_visible || (*printer).printer_technology() != ptFFF)
2042 continue;
2043 bool compatible = false;
2044 // Test otrher materials with same alias
2045 for (size_t i = 0; i < idx_with_same_alias.size() && !compatible; ++i) {
2046 const Preset& prst = *(filaments.presets[idx_with_same_alias[i]]);
2047 const Preset& prntr = *printer;
2048 if (is_compatible_with_printer(PresetWithVendorProfile(prst, prst.vendor), PresetWithVendorProfile(prntr, prntr.vendor))) {
2049 compatible = true;
2050 break;
2051 }
2052 }
2053 if (compatible)
2054 counter++;
2055 }
2056 filaments.compatibility_counter.emplace_back(preset->alias, counter);
2057 }
2058 }
2059
2060 if (any_sla_selected && (technology & T_SLA)) {
2061 sla_materials.clear();
2062 aliases_sla.clear();
2063
2064 // Iterate SLA materials in all bundles
2065 for (const auto &pair : bundles) {
2066 for (const auto &material : pair.second.preset_bundle->sla_materials) {
2067 // Check if material is already added
2068 if (sla_materials.containts(&material))
2069 continue;
2070 // Iterate printers in all bundles
2071 // For now, we only allow the profiles to be compatible with another profiles inside the same bundle.
2072 for (const auto& printer : pair.second.preset_bundle->printers) {
2073 if(!printer.is_visible || printer.printer_technology() != ptSLA)
2074 continue;
2075 // Filter out inapplicable printers
2076 if (is_compatible_with_printer(PresetWithVendorProfile(material, nullptr), PresetWithVendorProfile(printer, nullptr))) {
2077 // Check if material is already added
2078 if(!sla_materials.containts(&material)) {
2079 sla_materials.push(&material);
2080 if (!material.alias.empty())
2081 aliases_sla[material.alias].insert(material.name);
2082 }
2083 sla_materials.add_printer(&printer);
2084 }
2085 }
2086 }
2087 }
2088 // count compatible printers
2089 for (const auto& preset : sla_materials.presets) {
2090
2091 const auto filter = [preset](const std::pair<std::string, size_t> element) {
2092 return preset->alias == element.first;
2093 };
2094 if (std::find_if(sla_materials.compatibility_counter.begin(), sla_materials.compatibility_counter.end(), filter) != sla_materials.compatibility_counter.end()) {
2095 continue;
2096 }
2097 std::vector<size_t> idx_with_same_alias;
2098 for (size_t i = 0; i < sla_materials.presets.size(); ++i) {
2099 if(preset->alias == sla_materials.presets[i]->alias)
2100 idx_with_same_alias.push_back(i);
2101 }
2102 size_t counter = 0;
2103 for (const auto& printer : sla_materials.printers) {
2104 if (!(*printer).is_visible || (*printer).printer_technology() != ptSLA)
2105 continue;
2106 bool compatible = false;
2107 // Test otrher materials with same alias
2108 for (size_t i = 0; i < idx_with_same_alias.size() && !compatible; ++i) {
2109 const Preset& prst = *(sla_materials.presets[idx_with_same_alias[i]]);
2110 const Preset& prntr = *printer;
2111 if (is_compatible_with_printer(PresetWithVendorProfile(prst, prst.vendor), PresetWithVendorProfile(prntr, prntr.vendor))) {
2112 compatible = true;
2113 break;
2114 }
2115 }
2116 if (compatible)
2117 counter++;
2118 }
2119 sla_materials.compatibility_counter.emplace_back(preset->alias, counter);
2120 }
2121 }
2122}
PresetAliases aliases_sla
Definition ConfigWizard_private.hpp:552
PresetAliases aliases_fff
Definition ConfigWizard_private.hpp:551

References aliases_fff, aliases_sla, any_fff_selected, any_sla_selected, bundles, filaments, Slic3r::is_compatible_with_printer(), Slic3r::ptFFF, Slic3r::ptSLA, sla_materials, Slic3r::GUI::T_FFF, Slic3r::GUI::T_SLA, and Slic3r::Preset::vendor.

Referenced by Slic3r::GUI::PageMaterials::on_activate(), on_bnt_finish(), and select_default_materials_for_printer_models().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_presets_in_config()

void Slic3r::GUI::ConfigWizard::priv::update_presets_in_config ( const std::string & section,
const std::string & alias_key,
bool add )
2634{
2635 const PresetAliases& aliases = section == AppConfig::SECTION_FILAMENTS ? aliases_fff : aliases_sla;
2636
2637 auto update = [this, add](const std::string& s, const std::string& key) {
2638 assert(! s.empty());
2639 if (add)
2640 appconfig_new.set(s, key, "true");
2641 else
2642 appconfig_new.erase(s, key);
2643 };
2644
2645 // add or delete presets had a same alias
2646 auto it = aliases.find(alias_key);
2647 if (it != aliases.end())
2648 for (const std::string& name : it->second)
2649 update(section, name);
2650}
std::map< std::string, std::set< std::string > > PresetAliases
Definition ConfigWizard_private.hpp:538
SpiralVase::SpiralPoint add(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:26

References aliases_fff, aliases_sla, appconfig_new, Slic3r::GUI::ConfigWizard::name(), and Slic3r::AppConfig::SECTION_FILAMENTS.

Referenced by Slic3r::GUI::PageMaterials::select_material(), and Slic3r::GUI::PageMaterials::update_lists().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ aliases_fff

PresetAliases Slic3r::GUI::ConfigWizard::priv::aliases_fff

◆ aliases_sla

PresetAliases Slic3r::GUI::ConfigWizard::priv::aliases_sla

◆ all_pages

std::vector<ConfigWizardPage*> Slic3r::GUI::ConfigWizard::priv::all_pages

Referenced by add_page(), and set_run_reason().

◆ any_fff_selected

bool Slic3r::GUI::ConfigWizard::priv::any_fff_selected

◆ any_sla_selected

bool Slic3r::GUI::ConfigWizard::priv::any_sla_selected

◆ appconfig_new

◆ btn_cancel

Button* Slic3r::GUI::ConfigWizard::priv::btn_cancel = nullptr

◆ btn_finish

Button* Slic3r::GUI::ConfigWizard::priv::btn_finish = nullptr

◆ btn_next

Button* Slic3r::GUI::ConfigWizard::priv::btn_next = nullptr

Referenced by enable_next(), and set_start_page().

◆ btn_prev

Button* Slic3r::GUI::ConfigWizard::priv::btn_prev = nullptr

◆ btnsizer

wxBoxSizer* Slic3r::GUI::ConfigWizard::priv::btnsizer = nullptr

◆ bundles

◆ custom_config

std::unique_ptr<DynamicPrintConfig> Slic3r::GUI::ConfigWizard::priv::custom_config

Referenced by apply_config().

◆ custom_printer_selected

bool Slic3r::GUI::ConfigWizard::priv::custom_printer_selected { false }
556{ false };

Referenced by load_pages(), on_bnt_finish(), and on_custom_setup().

◆ filaments

Materials Slic3r::GUI::ConfigWizard::priv::filaments

Referenced by priv(), and update_materials().

◆ hscroll

wxScrolledWindow* Slic3r::GUI::ConfigWizard::priv::hscroll = nullptr

◆ hscroll_sizer

wxBoxSizer* Slic3r::GUI::ConfigWizard::priv::hscroll_sizer = nullptr

Referenced by add_page().

◆ index

ConfigWizardIndex* Slic3r::GUI::ConfigWizard::priv::index = nullptr

◆ only_sla_mode

bool Slic3r::GUI::ConfigWizard::priv::only_sla_mode { false }
558{ false };

Referenced by apply_config(), and load_pages().

◆ page_bed

PageBedShape* Slic3r::GUI::ConfigWizard::priv::page_bed = nullptr

Referenced by apply_config(), and load_pages().

◆ page_current

ConfigWizardPage* Slic3r::GUI::ConfigWizard::priv::page_current = nullptr

◆ page_custom

PageCustom* Slic3r::GUI::ConfigWizard::priv::page_custom = nullptr

◆ page_diams

PageDiameters* Slic3r::GUI::ConfigWizard::priv::page_diams = nullptr

Referenced by apply_config(), and load_pages().

◆ page_filaments

◆ page_firmware

PageFirmware* Slic3r::GUI::ConfigWizard::priv::page_firmware = nullptr

Referenced by apply_config(), and load_pages().

◆ page_sla_materials

◆ page_temps

PageTemperatures* Slic3r::GUI::ConfigWizard::priv::page_temps = nullptr

◆ q

◆ run_reason

ConfigWizard::RunReason Slic3r::GUI::ConfigWizard::priv::run_reason = RR_USER

Referenced by apply_config(), and set_run_reason().

◆ sla_materials

Materials Slic3r::GUI::ConfigWizard::priv::sla_materials

Referenced by priv(), and update_materials().


The documentation for this struct was generated from the following files: