Merge remote-tracking branch 'upstream/main' into libvgcode

# Conflicts:
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/GCode/GCodeProcessor.hpp
#	src/slic3r/CMakeLists.txt
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GCodeViewer.hpp
#	src/slic3r/GUI/GLCanvas3D.cpp
#	src/slic3r/GUI/GLCanvas3D.hpp
#	src/slic3r/GUI/GUI_Preview.cpp
This commit is contained in:
Andrew Sun
2025-11-09 18:48:04 -05:00
2978 changed files with 1208720 additions and 66304 deletions

View File

@@ -37,8 +37,7 @@ using namespace nlohmann;
namespace Slic3r {
static const std::string VERSION_CHECK_URL_STABLE = "https://api.github.com/repos/softfever/OrcaSlicer/releases/latest";
static const std::string VERSION_CHECK_URL = "https://api.github.com/repos/softfever/OrcaSlicer/releases";
static const std::string VERSION_CHECK_URL = "https://check-version.orcaslicer.com/latest";
static const std::string PROFILE_UPDATE_URL = "https://api.github.com/repos/OrcaSlicer/orcaslicer-profiles/releases/tags";
static const std::string MODELS_STR = "models";
@@ -187,15 +186,25 @@ void AppConfig::set_defaults()
if (get("reverse_mouse_wheel_zoom").empty())
set_bool("reverse_mouse_wheel_zoom", false);
if (get("enable_append_color_by_sync_ams").empty())
set_bool("enable_append_color_by_sync_ams", true);
if (get("enable_merge_color_by_sync_ams").empty())
set_bool("enable_merge_color_by_sync_ams", false);
if (get("ams_sync_match_full_use_color_dist").empty())
set_bool("ams_sync_match_full_use_color_dist", false);
if (get("camera_orbit_mult").empty())
set("camera_orbit_mult", "1.0");
if (get("export_sources_full_pathnames").empty())
set_bool("export_sources_full_pathnames", false);
if (get("zoom_to_mouse").empty())
set_bool("zoom_to_mouse", false);
//#ifdef SUPPORT_SHOW_HINTS
if (get("show_hints").empty())
set_bool("show_hints", true);
set_bool("show_hints", false);
//#endif
if (get("enable_multi_machine").empty())
set_bool("enable_multi_machine", false);
@@ -208,6 +217,9 @@ void AppConfig::set_defaults()
if (get("show_outline").empty())
set_bool("show_outline", false);
if (get("show_axes").empty())
set_bool("show_axes", true);
#ifdef _WIN32
@@ -260,8 +272,11 @@ void AppConfig::set_defaults()
if (get("stealth_mode").empty()) {
set_bool("stealth_mode", false);
}
if (get("allow_abnormal_storage").empty()) {
set_bool("allow_abnormal_storage", false);
}
if (get("legacy_networking").empty()) {
set_bool("legacy_networking", true);
set_bool("legacy_networking", false);
}
if(get("check_stable_update_only").empty()) {
@@ -292,17 +307,29 @@ void AppConfig::set_defaults()
if (get("show_daily_tips").empty()) {
set_bool("show_daily_tips", true);
}
//true is auto calculate
if (get("auto_calculate").empty()) {
set_bool("auto_calculate", true);
if (get("auto_calculate_flush").empty()){
set("auto_calculate_flush","all");
}
if (get("remember_printer_config").empty()) {
set_bool("remember_printer_config", true);
}
if (get("auto_calculate_when_filament_change").empty()){
set_bool("auto_calculate_when_filament_change", true);
if (get("enable_high_low_temp_mixed_printing").empty()){
set_bool("enable_high_low_temp_mixed_printing", false);
}
if (get("ignore_ext_filament_in_filament_map").empty()){
set_bool("ignore_ext_filament_in_filament_map", false);
}
if (get("pop_up_filament_map_dialog").empty()){
set_bool("pop_up_filament_map_dialog", false);
}
if (get("prefered_filament_map_mode").empty()){
set("prefered_filament_map_mode",ConfigOptionEnum<FilamentMapMode>::get_enum_names()[FilamentMapMode::fmmAutoForFlush]);
}
if (get("show_home_page").empty()) {
@@ -622,6 +649,10 @@ std::string AppConfig::load()
for (auto cali_it = calis_j["presets"].begin(); cali_it != calis_j["presets"].end(); cali_it++) {
CaliPresetInfo preset_info;
preset_info.tray_id = cali_it.value()["tray_id"].get<int>();
if (cali_it.value().contains("extruder_id"))
preset_info.extruder_id = cali_it.value()["extruder_id"].get<int>();
if (cali_it.value().contains("nozzle_volume_type"))
preset_info.nozzle_volume_type = NozzleVolumeType(cali_it.value()["nozzle_volume_type"].get<int>());
preset_info.nozzle_diameter = cali_it.value()["nozzle_diameter"].get<float>();
preset_info.filament_id = cali_it.value()["filament_id"].get<std::string>();
preset_info.setting_id = cali_it.value()["setting_id"].get<std::string>();
@@ -661,12 +692,15 @@ std::string AppConfig::load()
m_filament_presets = iter.value().get<std::vector<std::string>>();
} else if (iter.key() == "filament_colors") {
m_filament_colors = iter.value().get<std::vector<std::string>>();
}
else {
} else if(iter.key() == "filament_multi_colors") {
m_filament_multi_colors = iter.value().get<std::vector<std::string>>();
} else if(iter.key() == "filament_color_types") {
m_filament_color_types = iter.value().get<std::vector<std::string>>();
} else {
if (iter.value().is_string())
m_storage[it.key()][iter.key()] = iter.value().get<std::string>();
else {
BOOST_LOG_TRIVIAL(trace) << "load config warning...";
BOOST_LOG_TRIVIAL(warning) << "load config warning...";
}
}
}
@@ -746,6 +780,13 @@ void AppConfig::save()
for (const auto &filament_color : m_filament_colors) {
j["app"]["filament_colors"].push_back(filament_color);
}
for (const auto &filament_multi_color : m_filament_multi_colors) {
j["app"]["filament_multi_colors"].push_back(filament_multi_color);
}
for (const auto &filament_color_type : m_filament_color_types) {
j["app"]["filament_color_types"].push_back(filament_color_type);
}
for (const auto &cali_info : m_printer_cali_infos) {
json cali_json;
@@ -756,6 +797,8 @@ void AppConfig::save()
for (auto filament_preset : cali_info.selected_presets) {
json preset_json;
preset_json["tray_id"] = filament_preset.tray_id;
preset_json["extruder_id"] = filament_preset.extruder_id;
preset_json["nozzle_volume_type"] = int(filament_preset.nozzle_volume_type);
preset_json["nozzle_diameter"] = filament_preset.nozzle_diameter;
preset_json["filament_id"] = filament_preset.filament_id;
preset_json["setting_id"] = filament_preset.setting_id;
@@ -779,7 +822,7 @@ void AppConfig::save()
} else if (category.first == "presets") {
json j_filament_array;
for(const auto& kvp : category.second) {
if (boost::starts_with(kvp.first, "filament") && kvp.first != "filament_colors") {
if (boost::starts_with(kvp.first, "filament") && kvp.first != "filament_colors" && kvp.first != "filament_multi_colors" && kvp.first != "filament_color_types") {
j_filament_array.push_back(kvp.second);
} else {
j[category.first][kvp.first] = kvp.second;
@@ -1168,7 +1211,8 @@ void AppConfig::set_recent_projects(const std::vector<std::string>& recent_proje
for (unsigned int i = 0; i < (unsigned int)recent_projects.size(); ++i)
{
auto n = std::to_string(i + 1);
if (n.length() == 1) n = "0" + n;
if (n.length() == 1) n = "00" + n;
else if (n.length() == 2) n = "0" + n;
it->second[n] = recent_projects[i];
}
}
@@ -1357,6 +1401,32 @@ std::vector<std::string> AppConfig::get_custom_color_from_config()
return colors;
}
void AppConfig::save_nozzle_volume_types_to_config(const std::string& printer_name, const std::string& nozzle_volume_types)
{
if (!has_section("nozzle_volume_types")) {
std::map<std::string, std::string> data;
data[printer_name] = nozzle_volume_types;
set_section("nozzle_volume_types", data);
} else {
auto data = get_section("nozzle_volume_types");
auto data_modify = const_cast<std::map<std::string, std::string>&>(data);
data_modify[printer_name] = nozzle_volume_types;
set_section("nozzle_volume_types", data_modify);
}
}
std::string AppConfig::get_nozzle_volume_types_from_config(const std::string& printer_name)
{
std::string nozzle_volume_types;
if (has_section("nozzle_volume_types")) {
auto data = get_section("nozzle_volume_types");
if (data.find(printer_name) != data.end())
nozzle_volume_types = data[printer_name];
}
return nozzle_volume_types;
}
void AppConfig::reset_selections()
{
auto it = m_storage.find("presets");
@@ -1386,10 +1456,10 @@ std::string AppConfig::config_path()
return path;
}
std::string AppConfig::version_check_url(bool stable_only/* = false*/) const
std::string AppConfig::version_check_url() const
{
auto from_settings = get("version_check_url");
return from_settings.empty() ? stable_only ? VERSION_CHECK_URL_STABLE : VERSION_CHECK_URL : from_settings;
return from_settings.empty() ? VERSION_CHECK_URL : from_settings;
}
std::string AppConfig::profile_update_url() const