mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00: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:
@@ -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
|
std::optional<FilamentBaseInfo> PresetBundle::get_filament_by_filament_id(const std::string& filament_id) const
|
||||||
{
|
{
|
||||||
if (filament_id.empty())
|
if (filament_id.empty())
|
||||||
return {};
|
return std::nullopt;
|
||||||
|
|
||||||
// basic filament info should be same in the parent preset and child preset
|
// basic filament info should be same in the parent preset and child preset
|
||||||
// so just match the filament id is enough
|
// 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 info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: load project embedded presets
|
//BBS: load project embedded presets
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ struct FilamentBaseInfo
|
|||||||
std::string filament_id;
|
std::string filament_id;
|
||||||
std::string filament_type;
|
std::string filament_type;
|
||||||
std::string vendor;
|
std::string vendor;
|
||||||
int nozzle_temp_range_low;
|
int nozzle_temp_range_low{ 220 };
|
||||||
int nozzle_temp_range_high;
|
int nozzle_temp_range_high{ 220 };
|
||||||
bool is_support;
|
bool is_support{ false };
|
||||||
bool is_system;
|
bool is_system{ true };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bundle of Print + Filament + Printer presets.
|
// 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_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_exist", new ConfigOptionBools{tray.is_exists});
|
||||||
tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
tray_config.set_key_value("filament_multi_colors", new ConfigOptionStrings{});
|
||||||
auto info = wxGetApp().preset_bundle->get_filament_by_filament_id(tray.setting_id);
|
std::optional<FilamentBaseInfo> info;
|
||||||
tray_config.set_key_value("filament_is_support", new ConfigOptionBools{ info ? info->is_support : false });
|
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) {
|
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)));
|
tray_config.opt<ConfigOptionStrings>("filament_multi_colors")->values.push_back(into_u8(wxColour("#" + tray.cols[i]).GetAsString(wxC2S_HTML_SYNTAX)));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user