Orca filament profile revamp - done (#8287)

* Update Qidi profiles

* restructure orca filament lib folder

* update profiles

* add more global filaments

* check missing instantiation errors

* fix missing instantiation attribute

* delete voron generic filaments

* remove Mellow filaments

* clean profiles

* QoL: select only visible filament when select all filaments
This commit is contained in:
SoftFever 2025-02-03 21:15:17 +08:00 committed by GitHub
parent 0c190860e2
commit dc83549aa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
599 changed files with 9889 additions and 23636 deletions

View file

@ -1163,13 +1163,9 @@ void PresetCollection::load_presets(
if (inherits_config) {
ConfigOptionString * option_str = dynamic_cast<ConfigOptionString *> (inherits_config);
std::string inherits_value = option_str->value;
inherit_preset = this->find_preset(inherits_value, false, true);
// Orca: try to find if the parent preset has been renamed
if (inherit_preset == nullptr) {
auto it = this->find_preset_renamed(inherits_value);
if (it != m_presets.end())
inherit_preset = &(*it);
}
inherit_preset = this->find_preset2(inherits_value);
} else {
;
}
@ -2535,23 +2531,38 @@ const std::string& PresetCollection::get_suffix_modified() {
// Return a preset by its name. If the preset is active, a temporary copy is returned.
// If a preset is not found by its name, null is returned.
Preset* PresetCollection::find_preset(const std::string &name, bool first_visible_if_not_found, bool real)
Preset* PresetCollection::find_preset(const std::string &name, bool first_visible_if_not_found, bool real, bool only_from_library)
{
Preset key(m_type, name, false);
auto it = this->find_preset_internal(name);
auto it = this->find_preset_internal(name, only_from_library);
// Ensure that a temporary copy is returned if the preset found is currently selected.
return (it != m_presets.end() && it->name == key.name) ? &this->preset(it - m_presets.begin(), real) :
first_visible_if_not_found ? &this->first_visible() : nullptr;
}
const Preset* PresetCollection::find_preset2(const std::string& name) const
Preset* PresetCollection::find_preset2(const std::string& name, bool auto_match)
{
auto preset = const_cast<PresetCollection*>(this)->find_preset(name, false, true);
auto preset = find_preset(name,false,true);
if (preset == nullptr) {
auto _name = get_preset_name_renamed(name);
if(_name != nullptr)
preset = const_cast<PresetCollection*>(this)->find_preset(*_name, false, true);
if (_name != nullptr)
preset = find_preset(*_name,false,true);
if (auto_match && preset == nullptr) {
//Orca: one more try, find the most likely preset in OrcaFilamentLibrary
if (name.find("Generic") != std::string::npos) {
// The regex pattern matches an optional prefix ending in '_' then "Generic" followed by the material name.
std::regex re(R"(^(?:.*?\b(?:\w+_)?)(Generic)\b\s+([^@]+?)\s*(?:@.*)?$)");
auto alter_name = std::regex_replace(name, re, "Generic $2 @System");
preset = find_preset2(alter_name, false);
// print preset file name
if (preset != nullptr) {
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << " " << "Failed to find: " << name
<< ". fallback to library preset: " << preset->file;
}
}
}
}
return preset;
}