mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-19 21:51:06 +00:00
Merge remote-tracking branch 'upstream/main' into feedback
# Conflicts: # src/libslic3r/GCodeWriter.cpp # src/libslic3r/PrintApply.cpp # src/slic3r/GUI/Tab.cpp # tests/libslic3r/test_config.cpp
This commit is contained in:
commit
ab63789076
2265 files changed
+150528
-163791
No files matched your search
@@ -68,6 +68,7 @@ const char *PresetBundle::ORCA_DEFAULT_PRINTER_MODEL = "MyKlipper 0.4 nozzle";
|
||||
const char *PresetBundle::ORCA_DEFAULT_PRINTER_VARIANT = "0.4";
|
||||
const char *PresetBundle::ORCA_DEFAULT_FILAMENT = "Generic PLA @System";
|
||||
const char *PresetBundle::ORCA_FILAMENT_LIBRARY = "OrcaFilamentLibrary";
|
||||
const char *PresetBundle::ORCA_DEFAULT_FILAMENT_PLACEHOLDER = "Default Filament";
|
||||
|
||||
DynamicPrintConfig PresetBundle::construct_full_config(
|
||||
Preset& in_printer_preset,
|
||||
@@ -325,7 +326,7 @@ std::string PresetBundle::find_preset_vendor(const std::string &preset_name, Pre
|
||||
|
||||
PresetBundle::PresetBundle()
|
||||
: prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()))
|
||||
, filaments(Preset::TYPE_FILAMENT, Preset::filament_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), "Default Filament")
|
||||
, filaments(Preset::TYPE_FILAMENT, Preset::filament_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), ORCA_DEFAULT_FILAMENT_PLACEHOLDER)
|
||||
, sla_materials(Preset::TYPE_SLA_MATERIAL, Preset::sla_material_options(), static_cast<const SLAMaterialConfig &>(SLAFullPrintConfig::defaults()))
|
||||
, sla_prints(Preset::TYPE_SLA_PRINT, Preset::sla_print_options(), static_cast<const SLAPrintObjectConfig &>(SLAFullPrintConfig::defaults()))
|
||||
, printers(Preset::TYPE_PRINTER, Preset::printer_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()), "Default Printer")
|
||||
@@ -2642,7 +2643,10 @@ void PresetBundle::update_selections(AppConfig &config)
|
||||
|
||||
std::string first_visible_filament_name;
|
||||
for (auto & fp : filament_presets) {
|
||||
if (auto it = filaments.find_preset_internal(fp); it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
// Orca: also match the ORCA_DEFAULT_FILAMENT_PLACEHOLDER placeholder. update_compatible_internal
|
||||
// iterates from m_num_default_presets, so the placeholder's is_compatible flag
|
||||
// stays true and the not-found/visible/compatible predicate alone would miss it.
|
||||
if (auto it = filaments.find_preset_internal(fp); fp == ORCA_DEFAULT_FILAMENT_PLACEHOLDER || it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
if (first_visible_filament_name.empty())
|
||||
first_visible_filament_name = filaments.first_compatible().name;
|
||||
fp = first_visible_filament_name;
|
||||
@@ -2693,13 +2697,13 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
|
||||
initial_print_profile_name = prefered_print_profile;
|
||||
|
||||
const std::vector<std::string>& prefered_filament_profiles = preferred_printer->config.option<ConfigOptionStrings>("default_filament_profile")->values;
|
||||
if ((!initial_filament_profile_name.compare("Default Filament")) && (prefered_filament_profiles.size() > 0)) {
|
||||
if ((!initial_filament_profile_name.compare(ORCA_DEFAULT_FILAMENT_PLACEHOLDER)) && (prefered_filament_profiles.size() > 0)) {
|
||||
// Check if preferred filament is visible
|
||||
const Preset* preferred_preset = this->filaments.find_preset(prefered_filament_profiles[0], false);
|
||||
if (preferred_preset && preferred_preset->is_visible) {
|
||||
initial_filament_profile_name = prefered_filament_profiles[0];
|
||||
}
|
||||
// If not visible, keep the default "Default Filament" which will be resolved later
|
||||
// If not visible, keep the default ORCA_DEFAULT_FILAMENT_PLACEHOLDER which will be resolved later
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2800,7 +2804,8 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
|
||||
|
||||
std::string first_visible_filament_name;
|
||||
for (auto & fp : filament_presets) {
|
||||
if (auto it = filaments.find_preset_internal(fp); it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
// Orca: also match the ORCA_DEFAULT_FILAMENT_PLACEHOLDER placeholder — see update_selections.
|
||||
if (auto it = filaments.find_preset_internal(fp); fp == ORCA_DEFAULT_FILAMENT_PLACEHOLDER || it == filaments.end() || !it->is_visible || !it->is_compatible) {
|
||||
if (first_visible_filament_name.empty())
|
||||
first_visible_filament_name = filaments.first_compatible().name;
|
||||
fp = first_visible_filament_name;
|
||||
@@ -4557,6 +4562,7 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
std::string version_str = it.value();
|
||||
auto config_version = Semver::parse(version_str);
|
||||
if (! config_version) {
|
||||
++m_errors;
|
||||
throw ConfigurationError((boost::format("vendor %1%'s config version: %2% invalid\nSuggest cleaning the directory %3% firstly")
|
||||
% vendor_name % version_str % path).str());
|
||||
} else {
|
||||
@@ -5041,19 +5047,22 @@ void PresetBundle::update_multi_material_filament_presets(size_t to_delete_filam
|
||||
if (printers.get_edited_preset().printer_technology() != ptFFF)
|
||||
return;
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
// Orca: when the number of existing filament presets is less than the number of extruders, we will append new filament presets with the
|
||||
// same value as the last existing one.
|
||||
//
|
||||
// Verify and select the filament presets.
|
||||
auto *nozzle_diameter = static_cast<const ConfigOptionFloats*>(printers.get_edited_preset().config.option("nozzle_diameter"));
|
||||
size_t num_extruders = nozzle_diameter->values.size();
|
||||
// Verify validity of the current filament presets.
|
||||
for (size_t i = 0; i < std::min(this->filament_presets.size(), num_extruders); ++ i)
|
||||
this->filament_presets[i] = this->filaments.find_preset(this->filament_presets[i], true)->name;
|
||||
// Append the rest of filament presets.
|
||||
this->filament_presets.resize(num_extruders, this->filament_presets.empty() ? this->filaments.first_visible().name : this->filament_presets.back());
|
||||
#else
|
||||
size_t num_filaments = this->filament_presets.size();
|
||||
#endif
|
||||
|
||||
auto* nozzle_diameter = static_cast<const ConfigOptionFloats*>(printers.get_edited_preset().config.option("nozzle_diameter"));
|
||||
size_t num_extruders = nozzle_diameter->values.size();
|
||||
if (num_extruders > num_filaments) { // Verify validity of the current filament presets.
|
||||
for (size_t i = 0; i < std::min(this->filament_presets.size(), num_extruders); ++i)
|
||||
this->filament_presets[i] = this->filaments.find_preset(this->filament_presets[i], true)->name;
|
||||
// Append the rest of filament presets.
|
||||
this->filament_presets.resize(num_extruders, this->filament_presets.empty() ? this->filaments.first_visible().name :
|
||||
this->filament_presets.back());
|
||||
num_filaments = this->filament_presets.size();
|
||||
}
|
||||
if (to_delete_filament_id == -1)
|
||||
to_delete_filament_id = num_filaments;
|
||||
|
||||
@@ -5088,7 +5097,14 @@ void PresetBundle::update_multi_material_filament_presets(size_t to_delete_filam
|
||||
unsigned int old_i = i >= to_delete_filament_id ? i + 1 : i;
|
||||
unsigned int old_j = j >= to_delete_filament_id ? j + 1 : j;
|
||||
for (size_t nozzle_id = 0; nozzle_id < nozzle_nums; ++nozzle_id) {
|
||||
new_matrix[i * num_filaments + j + new_matrix_size * nozzle_id] = old_matrix[old_i * old_number_of_filaments + old_j + old_matrix_size * nozzle_id];
|
||||
// Orca: only copy from old_matrix when the old layout actually has data
|
||||
// for this nozzle slot; otherwise initialize from the per-filament
|
||||
// flush volumes the same way the (i,j) out-of-range branch does.
|
||||
if (nozzle_id < old_nozzle_nums) {
|
||||
new_matrix[i * num_filaments + j + new_matrix_size * nozzle_id] = old_matrix[old_i * old_number_of_filaments + old_j + old_matrix_size * nozzle_id];
|
||||
} else {
|
||||
new_matrix[i * num_filaments + j + new_matrix_size * nozzle_id] = (i == j ? 0. : filaments[2 * i] + filaments[2 * j + 1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (size_t nozzle_id = 0; nozzle_id < nozzle_nums; ++nozzle_id) {
|
||||
|
||||
Reference in new issue
Block a user