Merge branch 'master' into et_tm_sla_volumes_6-SPE-1285
This commit is contained in:
commit
76d0e11699
72 changed files with 9347 additions and 4714 deletions
|
@ -146,6 +146,11 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem
|
|||
res.changelog_url = changelog_url->second.data();
|
||||
}
|
||||
|
||||
const auto templates_profile = vendor_section.find("templates_profile");
|
||||
if (templates_profile != vendor_section.not_found()) {
|
||||
res.templates_profile = templates_profile->second.data() == "1";
|
||||
}
|
||||
|
||||
if (! load_all) {
|
||||
return res;
|
||||
}
|
||||
|
@ -200,6 +205,10 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem
|
|||
}
|
||||
model.bed_model = section.second.get<std::string>("bed_model", "");
|
||||
model.bed_texture = section.second.get<std::string>("bed_texture", "");
|
||||
model.thumbnail = section.second.get<std::string>("thumbnail", "");
|
||||
if (model.thumbnail.empty())
|
||||
model.thumbnail = model.id + "_thumbnail.png";
|
||||
|
||||
if (! model.id.empty() && ! model.variants.empty())
|
||||
res.models.push_back(std::move(model));
|
||||
}
|
||||
|
@ -336,7 +345,8 @@ std::string Preset::label() 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)
|
||||
// templates_profile vendor profiles should be decided as same vendor profiles
|
||||
if (preset.vendor != nullptr && preset.vendor != active_printer.vendor && !preset.vendor->templates_profile)
|
||||
// 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();
|
||||
|
@ -358,7 +368,8 @@ bool is_compatible_with_print(const PresetWithVendorProfile &preset, const Prese
|
|||
|
||||
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)
|
||||
// templates_profile vendor profiles should be decided as same vendor profiles
|
||||
if (preset.vendor != nullptr && preset.vendor != active_printer.vendor && !preset.vendor->templates_profile)
|
||||
// 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();
|
||||
|
@ -495,12 +506,14 @@ static std::vector<std::string> s_Preset_sla_print_options {
|
|||
"faded_layers",
|
||||
"supports_enable",
|
||||
"support_tree_type",
|
||||
|
||||
"support_head_front_diameter",
|
||||
"support_head_penetration",
|
||||
"support_head_width",
|
||||
"support_pillar_diameter",
|
||||
"support_small_pillar_diameter_percent",
|
||||
"support_max_bridges_on_pillar",
|
||||
"support_max_weight_on_model",
|
||||
"support_pillar_connection_mode",
|
||||
"support_buildplate_only",
|
||||
"support_enforcers_only",
|
||||
|
@ -512,6 +525,25 @@ static std::vector<std::string> s_Preset_sla_print_options {
|
|||
"support_max_bridge_length",
|
||||
"support_max_pillar_link_distance",
|
||||
"support_object_elevation",
|
||||
|
||||
"branchingsupport_head_front_diameter",
|
||||
"branchingsupport_head_penetration",
|
||||
"branchingsupport_head_width",
|
||||
"branchingsupport_pillar_diameter",
|
||||
"branchingsupport_small_pillar_diameter_percent",
|
||||
"branchingsupport_max_bridges_on_pillar",
|
||||
"branchingsupport_max_weight_on_model",
|
||||
"branchingsupport_pillar_connection_mode",
|
||||
"branchingsupport_buildplate_only",
|
||||
"branchingsupport_pillar_widening_factor",
|
||||
"branchingsupport_base_diameter",
|
||||
"branchingsupport_base_height",
|
||||
"branchingsupport_base_safety_distance",
|
||||
"branchingsupport_critical_angle",
|
||||
"branchingsupport_max_bridge_length",
|
||||
"branchingsupport_max_pillar_link_distance",
|
||||
"branchingsupport_object_elevation",
|
||||
|
||||
"support_points_density_relative",
|
||||
"support_points_minimal_distance",
|
||||
"slice_closing_radius",
|
||||
|
@ -1165,6 +1197,7 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
if (opt)
|
||||
config.set_key_value("num_extruders", new ConfigOptionInt((int)static_cast<const ConfigOptionFloats*>(opt)->values.size()));
|
||||
bool some_compatible = false;
|
||||
std::vector<size_t> indices_of_template_presets;
|
||||
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++ idx_preset) {
|
||||
bool selected = idx_preset == m_idx_selected;
|
||||
Preset &preset_selected = m_presets[idx_preset];
|
||||
|
@ -1181,7 +1214,29 @@ size_t PresetCollection::update_compatible_internal(const PresetWithVendorProfil
|
|||
m_idx_selected = size_t(-1);
|
||||
if (selected)
|
||||
preset_selected.is_compatible = preset_edited.is_compatible;
|
||||
if (preset_edited.vendor && preset_edited.vendor->templates_profile) {
|
||||
indices_of_template_presets.push_back(idx_preset);
|
||||
}
|
||||
}
|
||||
// filter out template profiles where profile with same alias and compability exists
|
||||
if (!indices_of_template_presets.empty()) {
|
||||
for (size_t idx_preset = m_num_default_presets; idx_preset < m_presets.size(); ++idx_preset) {
|
||||
if (m_presets[idx_preset].vendor && !m_presets[idx_preset].vendor->templates_profile && m_presets[idx_preset].is_compatible) {
|
||||
std::string preset_alias = m_presets[idx_preset].alias;
|
||||
for (size_t idx_of_template_in_presets : indices_of_template_presets) {
|
||||
if (m_presets[idx_of_template_in_presets].alias == preset_alias) {
|
||||
// unselect selected template filament if there is non-template alias compatible
|
||||
if (idx_of_template_in_presets == m_idx_selected && (unselect_if_incompatible == PresetSelectCompatibleType::Always || unselect_if_incompatible == PresetSelectCompatibleType::OnlyIfWasCompatible)) {
|
||||
m_idx_selected = size_t(-1);
|
||||
}
|
||||
m_presets[idx_of_template_in_presets].is_compatible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update visibility of the default profiles here if the defaults are suppressed, the current profile is not compatible and we don't want to select another compatible profile.
|
||||
if (m_idx_selected >= m_num_default_presets && m_default_suppressed)
|
||||
for (size_t i = 0; i < m_num_default_presets; ++ i)
|
||||
|
@ -2079,6 +2134,25 @@ namespace PresetUtils {
|
|||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool vendor_profile_has_all_resources(const VendorProfile& vp)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
std::string vendor_folder = Slic3r::data_dir() + "/vendor/" + vp.id + "/";
|
||||
std::string rsrc_folder = Slic3r::resources_dir() + "/profiles/" + vp.id + "/";
|
||||
std::string cache_folder = Slic3r::data_dir() + "/cache/" + vp.id + "/";
|
||||
for (const VendorProfile::PrinterModel& model : vp.models) {
|
||||
for (const std::string& res : { model.bed_texture, model.bed_model, model.thumbnail } ) {
|
||||
if (! res.empty()
|
||||
&& !fs::exists(fs::path(vendor_folder + res))
|
||||
&& !fs::exists(fs::path(rsrc_folder + res))
|
||||
&& !fs::exists(fs::path(cache_folder + res)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace PresetUtils
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue