mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-03-13 06:46:11 -06:00
ENH: protect build ams list
jira:NONE Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I4e8665df0bb24f056f79bd5cabab886bb5ff7921 (cherry picked from commit 6d1b8f0324fd07319aa22fcdf25856531d687621)
This commit is contained in:
parent
4365f158d0
commit
55b928694c
3 changed files with 11 additions and 8 deletions
|
|
@ -395,7 +395,7 @@ bool PresetBundle::backup_user_folder() const
|
|||
std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const std::string& filament_id) const
|
||||
{
|
||||
if (filament_id.empty())
|
||||
return {};
|
||||
return std::nullopt;
|
||||
|
||||
// basic filament info should be same in the parent preset and child preset
|
||||
// so just match the filament id is enough
|
||||
|
|
@ -421,7 +421,7 @@ std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const
|
|||
return info;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
//BBS: load project embedded presets
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ struct FilamentBaseInfo
|
|||
std::string filament_id;
|
||||
std::string filament_type;
|
||||
std::string vendor;
|
||||
int nozzle_temp_range_low;
|
||||
int nozzle_temp_range_high;
|
||||
bool is_support;
|
||||
bool is_system;
|
||||
int nozzle_temp_range_low{ 220 };
|
||||
int nozzle_temp_range_high{ 220 };
|
||||
bool is_support{ false };
|
||||
bool is_system{ true };
|
||||
};
|
||||
|
||||
// Bundle of Print + Filament + Printer presets.
|
||||
|
|
|
|||
|
|
@ -2711,8 +2711,11 @@ std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject
|
|||
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{into_u8(wxColour("#" + tray.color).GetAsString(wxC2S_HTML_SYNTAX))});
|
||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{tray.is_exists});
|
||||
tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
||||
auto info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
||||
tray_config.set_key_value("filament_is_support", new ConfigOptionBools{ info ? info->is_support : false });
|
||||
std::optional<FilamentBaseInfo> info;
|
||||
if (wxGetApp().preset_bundle) {
|
||||
info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
||||
}
|
||||
tray_config.set_key_value("filament_is_support", new ConfigOptionBools{ info.has_value() ? info->is_support : false});
|
||||
for (int i = 0; i < tray.cols.size(); ++i) {
|
||||
tray_config.opt<ConfigOptionStrings>("filament_multi_colors")->values.push_back(into_u8(wxColour("#" + tray.cols[i]).GetAsString(wxC2S_HTML_SYNTAX)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue