mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 19:55:58 +08:00
fix of crash on empty config -> add template filament
fixed checking if template profile needs to be installed fixed checking path before loading profile header from cache / vendor
This commit is contained in:
parent
bf6988fb5f
commit
050c03b291
@ -2535,21 +2535,25 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// template_profile_selected check
|
// todo: just workaround so template_profile_selected wont get to false after this function is called for SLA
|
||||||
template_profile_selected = false;
|
// this will work unltil there are no SLA template filaments
|
||||||
for (const auto& bp : bundles) {
|
if (technology == ptFFF) {
|
||||||
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
// template_profile_selected check
|
||||||
for (const auto& preset : appconfig_presets) {
|
template_profile_selected = false;
|
||||||
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
for (const auto& bp : bundles) {
|
||||||
const Preset* template_material = template_materials.find_preset(preset.first, false);
|
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
||||||
if (template_material){
|
for (const auto& preset : appconfig_presets) {
|
||||||
template_profile_selected = true;
|
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
||||||
|
const Preset* template_material = template_materials.find_preset(preset.first, false);
|
||||||
|
if (template_material){
|
||||||
|
template_profile_selected = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (template_profile_selected) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (template_profile_selected) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id);
|
assert(printer_models_without_material.empty() || only_for_model_id.empty() || only_for_model_id == (*printer_models_without_material.begin())->id);
|
||||||
@ -2715,11 +2719,12 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto vendor = enabled_vendors.find(pair.first);
|
const auto vendor = enabled_vendors.find(pair.first);
|
||||||
if (vendor == enabled_vendors.end() && ((pair.second.vendor_profile && !pair.second.vendor_profile->templates_profile) || !pair.second.vendor_profile) ) { continue; }
|
if (vendor == enabled_vendors.end()) {
|
||||||
|
// vendor not found
|
||||||
if (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile && vendor == enabled_vendors.end()) {
|
// if templates vendor and needs to be installed, add it
|
||||||
// Templates vendor needs to be installed
|
// then continue
|
||||||
install_bundles.emplace_back(pair.first);
|
if (template_profile_selected && pair.second.vendor_profile && pair.second.vendor_profile->templates_profile)
|
||||||
|
install_bundles.emplace_back(pair.first);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,6 +786,7 @@ void GUI_App::post_init()
|
|||||||
// Configuration is not compatible and reconfigure was refused by the user. Application is closing.
|
// Configuration is not compatible and reconfigure was refused by the user. Application is closing.
|
||||||
return;
|
return;
|
||||||
CallAfter([this] {
|
CallAfter([this] {
|
||||||
|
// preset_updater->sync downloads profile updates on background so it must begin after config wizard finished.
|
||||||
bool cw_showed = this->config_wizard_startup();
|
bool cw_showed = this->config_wizard_startup();
|
||||||
this->preset_updater->sync(preset_bundle);
|
this->preset_updater->sync(preset_bundle);
|
||||||
this->app_version_check(false);
|
this->app_version_check(false);
|
||||||
|
@ -920,22 +920,25 @@ bool PresetUpdater::install_bundles_rsrc(std::vector<std::string> bundles, bool
|
|||||||
auto path_in_cache_vendor = (p->cache_vendor_path / bundle).replace_extension(".ini");
|
auto path_in_cache_vendor = (p->cache_vendor_path / bundle).replace_extension(".ini");
|
||||||
auto path_in_vendors = (p->vendor_path / bundle).replace_extension(".ini");
|
auto path_in_vendors = (p->vendor_path / bundle).replace_extension(".ini");
|
||||||
// find if in cache vendor is newer version than in resources
|
// find if in cache vendor is newer version than in resources
|
||||||
auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false);
|
if (boost::filesystem::exists(path_in_cache_vendor)) {
|
||||||
auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false);
|
auto vp_cache = VendorProfile::from_ini(path_in_cache_vendor, false);
|
||||||
if (vp_cache.config_version > vp_rsrc.config_version) {
|
auto vp_rsrc = VendorProfile::from_ini(path_in_rsrc, false);
|
||||||
// in case we are installing from cache / vendor. we should also copy index to cache
|
if (vp_cache.config_version > vp_rsrc.config_version) {
|
||||||
// This needs to be done now bcs the current one would be missing this version on next start
|
// in case we are installing from cache / vendor. we should also copy index to cache
|
||||||
auto path_idx_cache_vendor(path_in_cache_vendor);
|
// This needs to be done now bcs the current one would be missing this version on next start
|
||||||
path_idx_cache_vendor.replace_extension(".idx");
|
auto path_idx_cache_vendor(path_in_cache_vendor);
|
||||||
auto path_idx_cache = (p->cache_path / bundle).replace_extension(".idx");
|
path_idx_cache_vendor.replace_extension(".idx");
|
||||||
// DK: do this during perform_updates() too?
|
auto path_idx_cache = (p->cache_path / bundle).replace_extension(".idx");
|
||||||
if (fs::exists(path_idx_cache_vendor))
|
// DK: do this during perform_updates() too?
|
||||||
copy_file_fix(path_idx_cache_vendor, path_idx_cache);
|
if (fs::exists(path_idx_cache_vendor))
|
||||||
else // Should we dialog this?
|
copy_file_fix(path_idx_cache_vendor, path_idx_cache);
|
||||||
BOOST_LOG_TRIVIAL(error) << GUI::format(_L("Couldn't locate idx file %1% when performing updates."), path_idx_cache_vendor.string());
|
else // Should we dialog this?
|
||||||
updates.updates.emplace_back(std::move(path_in_cache_vendor), std::move(path_in_vendors), Version(), "", "");
|
BOOST_LOG_TRIVIAL(error) << GUI::format(_L("Couldn't locate idx file %1% when performing updates."), path_idx_cache_vendor.string());
|
||||||
|
updates.updates.emplace_back(std::move(path_in_cache_vendor), std::move(path_in_vendors), Version(), "", "");
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", "");
|
||||||
|
} else
|
||||||
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", "");
|
updates.updates.emplace_back(std::move(path_in_rsrc), std::move(path_in_vendors), Version(), "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user