mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-29 22:02:10 +00:00
Add Orca Filament Library
This commit is contained in:
@@ -566,9 +566,10 @@ std::string Preset::label(bool no_alias) const
|
||||
|
||||
bool is_compatible_with_print(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_print, const PresetWithVendorProfile &active_printer)
|
||||
{
|
||||
if (preset.vendor != nullptr && preset.vendor != active_printer.vendor)
|
||||
// The current profile has a vendor assigned and it is different from the active print's vendor.
|
||||
return false;
|
||||
// Orca: we allow cross vendor compatibility
|
||||
// if (preset.vendor != nullptr && preset.vendor != active_printer.vendor)
|
||||
// // The current profile has a vendor assigned and it is different from the active print's vendor.
|
||||
// return false;
|
||||
auto &condition = preset.preset.compatible_prints_condition();
|
||||
auto *compatible_prints = dynamic_cast<const ConfigOptionStrings*>(preset.preset.config.option("compatible_prints"));
|
||||
bool has_compatible_prints = compatible_prints != nullptr && ! compatible_prints->values.empty();
|
||||
@@ -603,9 +604,10 @@ bool is_compatible_with_parent_printer(const PresetWithVendorProfile& preset, co
|
||||
|
||||
bool is_compatible_with_printer(const PresetWithVendorProfile &preset, const PresetWithVendorProfile &active_printer, const DynamicPrintConfig *extra_config)
|
||||
{
|
||||
if (preset.vendor != nullptr && preset.vendor != active_printer.vendor)
|
||||
// The current profile has a vendor assigned and it is different from the active print's vendor.
|
||||
return false;
|
||||
// Orca: we allow cross vendor compatibility
|
||||
// if (preset.vendor != nullptr && preset.vendor != active_printer.vendor)
|
||||
// // The current profile has a vendor assigned and it is different from the active print's vendor.
|
||||
// return false;
|
||||
auto &condition = preset.preset.compatible_printers_condition();
|
||||
auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(preset.preset.config.option("compatible_printers"));
|
||||
bool has_compatible_printers = compatible_printers != nullptr && ! compatible_printers->values.empty();
|
||||
|
||||
@@ -43,11 +43,12 @@ static std::vector<std::string> s_project_options {
|
||||
"flush_multiplier",
|
||||
};
|
||||
|
||||
//BBS: add BBL as default
|
||||
const char *PresetBundle::BBL_BUNDLE = "Custom";
|
||||
const char *PresetBundle::BBL_DEFAULT_PRINTER_MODEL = "MyKlipper 0.4 nozzle";
|
||||
const char *PresetBundle::BBL_DEFAULT_PRINTER_VARIANT = "0.4";
|
||||
const char *PresetBundle::BBL_DEFAULT_FILAMENT = "My Generic PLA";
|
||||
//Orca: add custom as default
|
||||
const char *PresetBundle::ORCA_DEFAULT_BUNDLE = "Custom";
|
||||
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 = "My Generic PLA";
|
||||
const char *PresetBundle::ORCA_FILAMENT_LIBRARY = "OrcaFilamentLibrary";
|
||||
|
||||
PresetBundle::PresetBundle()
|
||||
: prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast<const PrintRegionConfig &>(FullPrintConfig::defaults()))
|
||||
@@ -1094,7 +1095,7 @@ void PresetBundle::remove_users_preset(AppConfig &config, std::map<std::string,
|
||||
}
|
||||
|
||||
if (need_reset_printer_preset) {
|
||||
std::string default_printer_model = BBL_DEFAULT_PRINTER_MODEL;
|
||||
std::string default_printer_model = ORCA_DEFAULT_PRINTER_MODEL;
|
||||
std::string default_printer_name;
|
||||
for (auto it = printers.begin(); it != printers.end(); it++) {
|
||||
if (it->config.has("printer_model")) {
|
||||
@@ -1244,45 +1245,59 @@ std::pair<PresetsConfigSubstitutions, std::string> PresetBundle::load_system_pre
|
||||
PresetsConfigSubstitutions substitutions;
|
||||
std::string errors_cummulative;
|
||||
bool first = true;
|
||||
for (auto &dir_entry : boost::filesystem::directory_iterator(dir))
|
||||
{
|
||||
std::vector<std::string> vendor_names;
|
||||
// store all vendor names in vendor_names
|
||||
for (auto& dir_entry : boost::filesystem::directory_iterator(dir)) {
|
||||
std::string vendor_file = dir_entry.path().string();
|
||||
if (Slic3r::is_json_file(vendor_file)) {
|
||||
std::string vendor_name = dir_entry.path().filename().string();
|
||||
// Remove the .json suffix.
|
||||
vendor_name.erase(vendor_name.size() - 5);
|
||||
if (!Slic3r::is_json_file(vendor_file))
|
||||
continue;
|
||||
|
||||
if (validation_mode && !vendor_to_validate.empty() && vendor_name != vendor_to_validate)
|
||||
continue;
|
||||
std::string vendor_name = dir_entry.path().filename().string();
|
||||
|
||||
try {
|
||||
// Load the config bundle, flatten it.
|
||||
if (first) {
|
||||
// Reset this PresetBundle and load the first vendor config.
|
||||
append(substitutions, this->load_vendor_configs_from_json(dir.string(), vendor_name, PresetBundle::LoadSystem, compatibility_rule).first);
|
||||
first = false;
|
||||
} else {
|
||||
// Load the other vendor configs, merge them with this PresetBundle.
|
||||
// Report duplicate profiles.
|
||||
PresetBundle other;
|
||||
append(substitutions, other.load_vendor_configs_from_json(dir.string(), vendor_name, PresetBundle::LoadSystem, compatibility_rule).first);
|
||||
std::vector<std::string> duplicates = this->merge_presets(std::move(other));
|
||||
if (! duplicates.empty()) {
|
||||
errors_cummulative += "Found duplicated settings in vendor " + vendor_name + "'s json file lists: ";
|
||||
for (size_t i = 0; i < duplicates.size(); ++ i) {
|
||||
if (i > 0)
|
||||
errors_cummulative += ", ";
|
||||
errors_cummulative += duplicates[i];
|
||||
}
|
||||
// Remove the .json suffix.
|
||||
vendor_name.erase(vendor_name.size() - 5);
|
||||
vendor_names.push_back(vendor_name);
|
||||
}
|
||||
// Move ORCA_FILAMENT_LIBRARY to the beginning of the list
|
||||
for (size_t i = 0; i < vendor_names.size(); ++ i) {
|
||||
if (vendor_names[i] == ORCA_FILAMENT_LIBRARY) {
|
||||
std::swap(vendor_names[0], vendor_names[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &vendor_name : vendor_names)
|
||||
{
|
||||
if (validation_mode && !vendor_to_validate.empty() && vendor_name != vendor_to_validate)
|
||||
continue;
|
||||
|
||||
try {
|
||||
// Load the config bundle, flatten it.
|
||||
if (first) {
|
||||
// Reset this PresetBundle and load the first vendor config.
|
||||
append(substitutions, this->load_vendor_configs_from_json(dir.string(), vendor_name, PresetBundle::LoadSystem, compatibility_rule).first);
|
||||
first = false;
|
||||
} else {
|
||||
// Load the other vendor configs, merge them with this PresetBundle.
|
||||
// Report duplicate profiles.
|
||||
PresetBundle other;
|
||||
append(substitutions, other.load_vendor_configs_from_json(dir.string(), vendor_name, PresetBundle::LoadSystem, compatibility_rule).first);
|
||||
std::vector<std::string> duplicates = this->merge_presets(std::move(other));
|
||||
if (! duplicates.empty()) {
|
||||
errors_cummulative += "Found duplicated settings in vendor " + vendor_name + "'s json file lists: ";
|
||||
for (size_t i = 0; i < duplicates.size(); ++ i) {
|
||||
if (i > 0)
|
||||
errors_cummulative += ", ";
|
||||
errors_cummulative += duplicates[i];
|
||||
}
|
||||
}
|
||||
} catch (const std::runtime_error &err) {
|
||||
if (validation_mode)
|
||||
throw err;
|
||||
else {
|
||||
errors_cummulative += err.what();
|
||||
errors_cummulative += "\n";
|
||||
}
|
||||
}
|
||||
} catch (const std::runtime_error &err) {
|
||||
if (validation_mode)
|
||||
throw err;
|
||||
else {
|
||||
errors_cummulative += err.what();
|
||||
errors_cummulative += "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,11 +261,13 @@ public:
|
||||
std::pair<PresetsConfigSubstitutions, std::string> load_system_filaments_json(ForwardCompatibilitySubstitutionRule compatibility_rule);
|
||||
VendorProfile get_custom_vendor_models() const;
|
||||
|
||||
//BBS: add BBL as default
|
||||
static const char *BBL_BUNDLE;
|
||||
static const char *BBL_DEFAULT_PRINTER_MODEL;
|
||||
static const char *BBL_DEFAULT_PRINTER_VARIANT;
|
||||
static const char *BBL_DEFAULT_FILAMENT;
|
||||
//orca: add 'custom' as default
|
||||
static const char *ORCA_DEFAULT_BUNDLE;
|
||||
static const char *ORCA_DEFAULT_PRINTER_MODEL;
|
||||
static const char *ORCA_DEFAULT_PRINTER_VARIANT;
|
||||
static const char *ORCA_DEFAULT_FILAMENT;
|
||||
static const char *ORCA_FILAMENT_LIBRARY;
|
||||
|
||||
|
||||
static std::array<Preset::Type, 3> types_list(PrinterTechnology pt) {
|
||||
if (pt == ptFFF)
|
||||
|
||||
Reference in New Issue
Block a user