Skip to content

fix: don't skip user presets when parent preset is not found#10875

Closed
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:upstream/fix-preset-parent-not-found
Closed

fix: don't skip user presets when parent preset is not found#10875
BenJule wants to merge 1 commit into
bambulab:masterfrom
BenJule:upstream/fix-preset-parent-not-found

Conversation

@BenJule

@BenJule BenJule commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #10869

Root Cause

In PresetCollection::load_presets() (src/libslic3r/Preset.cpp), when a user preset has an inherits field that points to a system preset that no longer exists (e.g. because it was renamed or removed in a system update), the preset is silently skipped:

// BEFORE – buggy
if ((inherits_config2 && !inherits_config2->value.empty())) {
    BOOST_LOG_TRIVIAL(error) << "can not find parent ...";
    continue;  // ← preset disappears from the UI entirely
}

From the user's perspective the preset appears to be gone after restarting the application, even though the file is still on disk. This explains why the workaround of recreating the User directory helps — it forces the user to re-create presets under the current system-preset names, so the parent is always found.

The bug can be triggered whenever:

  • A system-preset name changes between releases (version bump, printer variant rename, etc.)
  • The user's inherits reference still points to the old name

Fix

Instead of continue-ing (dropping the preset), fall back to the built-in default config and emit a warning log entry. The user's saved values are applied on top of the default, so their settings are preserved as well as possible. The preset is now visible in the UI and the user can correct any values that used to derive from the missing parent.

// AFTER – fixed
if ((inherits_config2 && !inherits_config2->value.empty())) {
    BOOST_LOG_TRIVIAL(warning) << "Parent preset not found; loading with default config as fallback.";
    // fall through to default config path — do NOT skip
}
preset.config = default_preset.config;
preset.config.apply(std::move(config));
extend_default_config_length(preset.config, {}, true, default_preset.config);

Behaviour change

Scenario Before After
Parent preset found ✅ loaded correctly ✅ unchanged
Parent preset not found ❌ preset silently dropped ✅ preset loaded with default base + user diffs, warning in log

Notes

The fallback may produce subtly different values for settings that were inherited (not explicitly saved) from the missing parent. This is a known trade-off: a preset with potentially imperfect settings is always preferable to a silently deleted preset.

When loading user presets, if the 'inherits' parent preset cannot be
found (e.g. because a system preset was renamed or removed by an app
update), the preset was silently skipped with a 'continue'. From the
user's perspective the preset appeared to vanish after restarting.

Instead, fall back to the built-in default config and emit a warning.
The user's saved values are still applied on top of the default, so
their settings are preserved as well as possible. The preset appears in
the list and the user can correct any values that depended on the now-
missing parent.

Fixes bambulab#10869.
@BenJule BenJule mentioned this pull request May 22, 2026
2 tasks
@BenJule BenJule closed this Jun 7, 2026
@BenJule BenJule deleted the upstream/fix-preset-parent-not-found branch June 7, 2026 10:09
@BenJule BenJule restored the upstream/fix-preset-parent-not-found branch June 7, 2026 11:36
@BenJule BenJule reopened this Jun 7, 2026
@BenJule

BenJule commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Apologies — this PR was closed by mistake on 2026-06-07, and that was an error on my side, not a deliberate decision to withdraw the change.

It happened as an unintended side effect of a branch cleanup in my fork: deleting the head branch automatically closed this PR. The contribution still stands. I have restored the branch and reopened the PR. Sorry for the noise and any confusion this caused.

@tonghao-bbl tonghao-bbl self-requested a review June 18, 2026 00:47
@tonghao-bbl

Copy link
Copy Markdown
Contributor

Hi @BenJule Thanks for your contribution, But we can't accept this PR.

A filament with empty inherits can not be used in Bambu Studio. However, you can create a custom filament without a inherits option. Please note these are two cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print profile is not saved

2 participants