mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-20 14:49:17 +08:00
FIX: Studio UI Freeze when saving user preset
github: #3335 Change-Id: Idaf53f673a3e46408826c06bdde2c592395d358b
This commit is contained in:
parent
11bea7419c
commit
1ceb7ff3b1
@ -1494,7 +1494,7 @@ int PresetCollection::get_user_presets(PresetBundle *preset_bundle, std::vector<
|
|||||||
lock();
|
lock();
|
||||||
for (Preset &preset : m_presets) {
|
for (Preset &preset : m_presets) {
|
||||||
if (!preset.is_user()) continue;
|
if (!preset.is_user()) continue;
|
||||||
if (get_preset_base(preset) != &preset && preset.base_id.empty()) continue;
|
if (preset.base_id.empty() && preset.inherits() != "") continue;
|
||||||
if (!preset.setting_id.empty() && preset.sync_info.empty()) continue;
|
if (!preset.setting_id.empty() && preset.sync_info.empty()) continue;
|
||||||
//if (!preset.is_bbl_vendor_preset(preset_bundle)) continue;
|
//if (!preset.is_bbl_vendor_preset(preset_bundle)) continue;
|
||||||
if (preset.sync_info == "hold") continue;
|
if (preset.sync_info == "hold") continue;
|
||||||
@ -2280,11 +2280,8 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
|||||||
// Clear the link to the parent profile.
|
// Clear the link to the parent profile.
|
||||||
inherits.clear();
|
inherits.clear();
|
||||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": save preset %1% , with detach")%new_name;
|
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": save preset %1% , with detach")%new_name;
|
||||||
} else {
|
} else if (is_base_preset(preset)) {
|
||||||
// Inherited from a user preset. Just maintain the "inherited" flag,
|
inherits = old_name;
|
||||||
// meaning it will inherit from either the system preset, or the inherited user preset.
|
|
||||||
auto base = get_preset_base(curr_preset);
|
|
||||||
inherits = base ? base->name : "";
|
|
||||||
}
|
}
|
||||||
preset.is_default = false;
|
preset.is_default = false;
|
||||||
preset.is_system = false;
|
preset.is_system = false;
|
||||||
@ -2891,7 +2888,7 @@ std::string PresetCollection::path_from_name(const std::string &new_name, bool d
|
|||||||
|
|
||||||
std::string PresetCollection::path_for_preset(const Preset &preset) const
|
std::string PresetCollection::path_for_preset(const Preset &preset) const
|
||||||
{
|
{
|
||||||
return path_from_name(preset.name, get_preset_base(preset) == &preset);
|
return path_from_name(preset.name, is_base_preset(preset));
|
||||||
}
|
}
|
||||||
|
|
||||||
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
|
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
|
||||||
|
@ -676,6 +676,7 @@ public:
|
|||||||
// Without force, the selection is only updated if the index changes.
|
// Without force, the selection is only updated if the index changes.
|
||||||
// With force, the changes are reverted if the new index is the same as the old index.
|
// With force, the changes are reverted if the new index is the same as the old index.
|
||||||
bool select_preset_by_name(const std::string &name, bool force);
|
bool select_preset_by_name(const std::string &name, bool force);
|
||||||
|
bool is_base_preset(const Preset &preset) const { return preset.is_system || (preset.is_user() && preset.inherits().empty()); }
|
||||||
|
|
||||||
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
// Generate a file path from a profile name. Add the ".ini" suffix if it is missing.
|
||||||
std::string path_from_name(const std::string &new_name, bool detach = false) const;
|
std::string path_from_name(const std::string &new_name, bool detach = false) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user