Fix: Preserve project settings when changing printer profile #1472

Open
opened 2026-04-05 17:56:19 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @kemper on 11/29/2025

Note: This was done with a gemini-cli session. I first had it research the codebase. Then I had it load the issue #5332 and propose a fix. On my mac laptop I/gemini didn't get the build working in order to test it but the fix seems reasonable at face value.

Here is the AI summary of the fix:

Fixes #5332

Problem:
When a user has a .3mf project loaded, which contains specific filament and multi-material painting settings, changing the printer profile causes these settings to be discarded. The application incorrectly loads the last-used configuration for the newly selected printer, overwriting the current project's settings.

Root Cause:
This issue stems from the "Remember printer configuration" feature. In src/slic3r/GUI/Tab.cpp, the Tab::select_preset function is called when a printer preset is changed. If remember_printer_config is enabled, it unconditionally calls m_preset_bundle->update_selections(). This function is designed to load the last-used settings for a given printer, which is the action that overwrites the active project's configuration.

Solution:
This PR introduces a crucial condition to the logic in Tab::select_preset. The call to m_preset_bundle->update_selections() is now also conditional on wxGetApp()->plater()->get_project_path().IsEmpty().

-        if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config")) {
+        if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config") && wxGetApp().plater()->get_project_path().IsEmpty()) {
             m_preset_bundle->update_selections(*wxGetApp().app_config);
             wxGetApp().plater()->sidebar().on_filament_count_change(m_preset_bundle->filament_presets.size());
         }

How This Fix Works:
This change makes the "Remember printer configuration" feature context-aware.

  • When a project is open: get_project_path() returns a non-empty string, so the new condition evaluates to false. The update_selections() function is not called, and the project's filament and coloring settings are correctly preserved.
  • When no project is open: get_project_path() returns an empty string. If the user has "Remember printer configuration" enabled, the condition evaluates to true, and the original behavior of loading the last-used profile is maintained.

This ensures the application behaves as expected in both scenarios, fixing the bug without removing the existing feature.

*Originally created by @kemper on 11/29/2025* Note: This was done with a gemini-cli session. I first had it research the codebase. Then I had it load the issue #5332 and propose a fix. On my mac laptop I/gemini didn't get the build working in order to test it but the fix seems reasonable at face value. Here is the AI summary of the fix: Fixes #5332 **Problem:** When a user has a `.3mf` project loaded, which contains specific filament and multi-material painting settings, changing the printer profile causes these settings to be discarded. The application incorrectly loads the last-used configuration for the newly selected printer, overwriting the current project's settings. **Root Cause:** This issue stems from the "Remember printer configuration" feature. In `src/slic3r/GUI/Tab.cpp`, the `Tab::select_preset` function is called when a printer preset is changed. If `remember_printer_config` is enabled, it unconditionally calls `m_preset_bundle->update_selections()`. This function is designed to load the last-used settings for a given printer, which is the action that overwrites the active project's configuration. **Solution:** This PR introduces a crucial condition to the logic in `Tab::select_preset`. The call to `m_preset_bundle->update_selections()` is now also conditional on `wxGetApp()->plater()->get_project_path().IsEmpty()`. ```diff - if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config")) { + if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config") && wxGetApp().plater()->get_project_path().IsEmpty()) { m_preset_bundle->update_selections(*wxGetApp().app_config); wxGetApp().plater()->sidebar().on_filament_count_change(m_preset_bundle->filament_presets.size()); } ``` **How This Fix Works:** This change makes the "Remember printer configuration" feature context-aware. - **When a project is open:** `get_project_path()` returns a non-empty string, so the new condition evaluates to `false`. The `update_selections()` function is **not** called, and the project's filament and coloring settings are correctly preserved. - **When no project is open:** `get_project_path()` returns an empty string. If the user has "Remember printer configuration" enabled, the condition evaluates to `true`, and the original behavior of loading the last-used profile is maintained. This ensures the application behaves as expected in both scenarios, fixing the bug without removing the existing feature.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#1472