mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-26 21:50:41 +00:00
ENH: support mix mapping
jira: [STUDIO-13673] Change-Id: Ic1c89457f5154c108dbab41850ed49561aa34fde (cherry picked from commit 12942e0545424e2528cc3f3c9aa6947b76469b3d)
This commit is contained in:
@@ -71,6 +71,9 @@ public:
|
||||
/*extruder*/
|
||||
static bool get_printer_can_set_nozzle(std::string type_str) { return get_value_from_config<bool>(type_str, "enable_set_nozzle_info"); }// can set nozzle from studio
|
||||
|
||||
/*print job*/
|
||||
static bool support_ams_ext_mix_print(std::string type_str) { return get_value_from_config<bool>(type_str, "print", "support_ams_ext_mix_print"); }
|
||||
|
||||
/*calibration*/
|
||||
static std::vector<std::string> get_unsupport_auto_cali_filaments(std::string type_str) { return get_value_from_config<std::vector<std::string>>(type_str, "auto_cali_not_support_filaments"); }
|
||||
|
||||
@@ -103,6 +106,25 @@ public:
|
||||
return T();
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
static T get_value_from_config(const std::string& type_str, const std::string& item1, const std::string& item2)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto& json_item1 = get_value_from_config<nlohmann::json>(type_str, item1);
|
||||
if (json_item1.contains(item2))
|
||||
{
|
||||
return json_item1[item2].get<T>();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " failed to get " << item1 << ", " << item2;
|
||||
}
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
static nlohmann::json get_json_from_config(const std::string& type_str, const std::string& key1, const std::string& key2 = std::string())
|
||||
{
|
||||
std::string config_file = m_resource_file_path + "/printers/" + type_str + ".json";
|
||||
|
||||
Reference in New Issue
Block a user