Skip to content

Save a user preset without inheriting from a project-embedded preset (#1207) - #1235

Open
alandebortolo wants to merge 1 commit into
Snapmaker:mainfrom
DesignMaster-Solutions:fix/user-preset-from-project-preset
Open

alandebortolo wants to merge 1 commit into
Snapmaker:mainfrom
DesignMaster-Solutions:fix/user-preset-from-project-preset

Conversation

@alandebortolo

Copy link
Copy Markdown

Fixes #1207.

What happens today: "Save as User preset" on a process preset that came from a 3mf writes a user preset whose inherits is the Project-inside preset (for example 0.24mm Standard figet star (converted)(10+STAR+FIDGET+TOY-U1.3mf)), and only the keys that differ from it. That parent exists only while that 3mf is open, so in any other project the saved user preset loses its base and cannot be used, which is what the reporter hit.

Change (PresetCollection::save_current_preset, 19 lines): when the preset is saved to the user folder (save_to_project == false) and its parent is project-embedded, the link is moved up to the first ancestor that is not project-embedded:

  • project preset over a system preset → the user preset inherits from that system preset, and the diff is taken against it;
  • project preset with no parent (the converted case in the issue) → inherits is cleared and the full config is saved, as save(nullptr) already does for detached presets;
  • saving into the project (save_to_project == true), or a parent that is a system/user preset → unchanged.

The edited values are not touched: preset.config already holds the full edited config, only the parent used for the diff changes.

Checked: the same loop in a standalone harness with a name→preset map: converted project preset → "", project over system → system name, a chain of two project presets → system name, system/user parent and save_to_project unchanged, missing parent unchanged, a self-referencing project preset terminates (depth cap 8). Mutants (!is_project_embedded flipped, !save_to_project flipped) fail the harness.

Limits: not run in the GUI; the fork CI build is the compile check. Presets already saved with a project parent are not migrated; for those the reporter has a flatten script in the issue thread.

@alandebortolo

Copy link
Copy Markdown
Author

CI on my fork for a72fcbf (run https://github.com/DesignMaster-Solutions/OrcaSlicer/actions/runs/44896319132): Snapmaker_Orca builds on Linux (ubuntu-24.04) and Windows (windows-2022), and both Flatpak builds pass. The macOS job stopped in Build Deps before reaching our code, on a Homebrew download error ("Failed to download resource zstd" from ghcr.io), so I re-ran it and will post the result here.

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.

Save as User preset does not save full preset file/json

2 participants