mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
The "Default Filament" may saved in the OrcaSlicer.conf which caused misleading confusions. Ignore it so Orca won't select it on next loading.
This commit is contained in:
@@ -60,6 +60,7 @@ const char *PresetBundle::ORCA_DEFAULT_PRINTER_MODEL = "MyKlipper 0.4 nozzle";
|
||||
const char *PresetBundle::ORCA_DEFAULT_PRINTER_VARIANT = "0.4";
|
||||
const char *PresetBundle::ORCA_DEFAULT_FILAMENT = "Generic PLA @System";
|
||||
const char *PresetBundle::ORCA_FILAMENT_LIBRARY = "OrcaFilamentLibrary";
|
||||
const char *PresetBundle::ORCA_DEFAULT_FILAMENT_PLACEHOLDER = "Default Filament";
|
||||
|
||||
DynamicPrintConfig PresetBundle::construct_full_config(
|
||||
Preset& in_printer_preset,
|
||||
@@ -317,7 +318,7 @@ std::string PresetBundle::find_preset_vendor(const std::string &preset_name, Pre
|
||||
|
||||
PresetBundle::PresetBundle()
|
||||
: prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()))
|
||||
, filaments(Preset::TYPE_FILAMENT, Preset::filament_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), "Default Filament")
|
||||
, filaments(Preset::TYPE_FILAMENT, Preset::filament_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), ORCA_DEFAULT_FILAMENT_PLACEHOLDER)
|
||||
, sla_materials(Preset::TYPE_SLA_MATERIAL, Preset::sla_material_options(), static_cast<const SLAMaterialConfig &>(SLAFullPrintConfig::defaults()))
|
||||
, sla_prints(Preset::TYPE_SLA_PRINT, Preset::sla_print_options(), static_cast<const SLAPrintObjectConfig &>(SLAFullPrintConfig::defaults()))
|
||||
, printers(Preset::TYPE_PRINTER, Preset::printer_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), "Default Printer")
|
||||
@@ -2634,7 +2635,10 @@ void PresetBundle::update_selections(AppConfig &config)
|
||||
|
||||
std::string first_visible_filament_name;
|
||||
for (auto & fp : filament_presets) {
|
||||
if (auto it = filaments.find_preset_internal(fp); it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
// Orca: also match the ORCA_DEFAULT_FILAMENT_PLACEHOLDER placeholder. update_compatible_internal
|
||||
// iterates from m_num_default_presets, so the placeholder's is_compatible flag
|
||||
// stays true and the not-found/visible/compatible predicate alone would miss it.
|
||||
if (auto it = filaments.find_preset_internal(fp); fp == ORCA_DEFAULT_FILAMENT_PLACEHOLDER || it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
if (first_visible_filament_name.empty())
|
||||
first_visible_filament_name = filaments.first_compatible().name;
|
||||
fp = first_visible_filament_name;
|
||||
@@ -2685,13 +2689,13 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
|
||||
initial_print_profile_name = prefered_print_profile;
|
||||
|
||||
const std::vector<std::string>& prefered_filament_profiles = preferred_printer->config.option<ConfigOptionStrings>("default_filament_profile")->values;
|
||||
if ((!initial_filament_profile_name.compare("Default Filament")) && (prefered_filament_profiles.size() > 0)) {
|
||||
if ((!initial_filament_profile_name.compare(ORCA_DEFAULT_FILAMENT_PLACEHOLDER)) && (prefered_filament_profiles.size() > 0)) {
|
||||
// Check if preferred filament is visible
|
||||
const Preset* preferred_preset = this->filaments.find_preset(prefered_filament_profiles[0], false);
|
||||
if (preferred_preset && preferred_preset->is_visible) {
|
||||
initial_filament_profile_name = prefered_filament_profiles[0];
|
||||
}
|
||||
// If not visible, keep the default "Default Filament" which will be resolved later
|
||||
// If not visible, keep the default ORCA_DEFAULT_FILAMENT_PLACEHOLDER which will be resolved later
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2792,7 +2796,8 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
|
||||
|
||||
std::string first_visible_filament_name;
|
||||
for (auto & fp : filament_presets) {
|
||||
if (auto it = filaments.find_preset_internal(fp); it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
// Orca: also match the ORCA_DEFAULT_FILAMENT_PLACEHOLDER placeholder — see update_selections.
|
||||
if (auto it = filaments.find_preset_internal(fp); fp == ORCA_DEFAULT_FILAMENT_PLACEHOLDER || it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
if (first_visible_filament_name.empty())
|
||||
first_visible_filament_name = filaments.first_compatible().name;
|
||||
fp = first_visible_filament_name;
|
||||
|
||||
@@ -465,6 +465,7 @@ public:
|
||||
static const char *ORCA_DEFAULT_PRINTER_VARIANT;
|
||||
static const char *ORCA_DEFAULT_FILAMENT;
|
||||
static const char *ORCA_FILAMENT_LIBRARY;
|
||||
static const char *ORCA_DEFAULT_FILAMENT_PLACEHOLDER;
|
||||
|
||||
|
||||
static std::array<Preset::Type, 3> types_list(PrinterTechnology pt) {
|
||||
|
||||
@@ -531,7 +531,7 @@ void PhysicalPrinterDialog::update_preset_input() {
|
||||
}
|
||||
|
||||
if (m_valid_type == Valid &&
|
||||
(m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer")) {
|
||||
(m_preset_name == "Default Setting" || m_preset_name == PresetBundle::ORCA_DEFAULT_FILAMENT_PLACEHOLDER || m_preset_name == "Default Printer")) {
|
||||
info_line = _L("Name is unavailable.");
|
||||
m_valid_type = NoValid;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void SavePresetDialog::Item::update()
|
||||
}
|
||||
|
||||
if (m_valid_type == Valid &&
|
||||
(m_preset_name == "Default Setting" || m_preset_name == "Default Filament" || m_preset_name == "Default Printer")) {
|
||||
(m_preset_name == "Default Setting" || m_preset_name == PresetBundle::ORCA_DEFAULT_FILAMENT_PLACEHOLDER || m_preset_name == "Default Printer")) {
|
||||
info_line = _L("Name is unavailable.");
|
||||
m_valid_type = NoValid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user