Merge remote-tracking branch 'upstream/main' into feature/exclusion-volume-tests

# Conflicts:
#	src/libslic3r/PrintBase.hpp
This commit is contained in:
Harry Loud committed 2026-09-29 17:41:28 +01:00
commit 1841de5f88
7079 files changed
+294575 -294284

No files matched your search

+57 -4
View File
@@ -26,6 +26,7 @@
#include "libslic3r/Geometry/ConvexHull.hpp"
#include "ClipperUtils.hpp"
#include <algorithm>
#include <float.h>
#include <boost/algorithm/string/predicate.hpp>
@@ -1233,6 +1234,7 @@ ModelObject& ModelObject::assign_copy(const ModelObject &rhs)
this->volumes.emplace_back(new ModelVolume(*model_volume));
this->volumes.back()->set_model_object(this);
}
this->clear_instances();
this->instances.reserve(rhs.instances.size());
for (const ModelInstance *model_instance : rhs.instances) {
@@ -1271,6 +1273,7 @@ ModelObject& ModelObject::assign_copy(ModelObject &&rhs)
rhs.volumes.clear();
for (ModelVolume *model_volume : this->volumes)
model_volume->set_model_object(this);
this->clear_instances();
this->instances = std::move(rhs.instances);
rhs.instances.clear();
@@ -1394,7 +1397,9 @@ ModelVolume* ModelObject::add_volume_with_shared_mesh(const ModelVolume &other,
void ModelObject::delete_volume(size_t idx)
{
ModelVolumePtrs::iterator i = this->volumes.begin() + idx;
delete *i;
ModelVolume* volume_to_delete = *i;
delete volume_to_delete;
this->volumes.erase(i);
if (this->volumes.size() == 1)
@@ -1453,6 +1458,20 @@ void ModelObject::sort_volumes(bool full_sort)
// sort volumes inside the object to order "Model Part, Negative Volume, Modifier, Support Blocker and Support Enforcer. "
if (full_sort)
std::stable_sort(volumes.begin(), volumes.end(), [](ModelVolume* vl, ModelVolume* vr) {
// Special handling for Precise Seam modifiers: group-based sorting with user order preservation
if (vl->is_precise_seam() && vr->is_precise_seam()) {
// Strong (center/left/right) always before weak (enforced/blocked/neutral)
bool vl_strong = vl->is_precise_seam_strong();
bool vr_strong = vr->is_precise_seam_strong();
if (vl_strong != vr_strong)
return vl_strong; // strong < weak → strong group appears first
// Within same group (both strong or both weak): preserve current order
// stable_sort will maintain relative positions when comparator returns false
return false;
}
// For non-Precise-Seam or mixed types: use standard enum-based ordering
return vl->type() < vr->type();
});
// sort have to controll "place" of the support blockers/enforcers. But one of the model parts have to be on the first place.
@@ -1460,10 +1479,19 @@ void ModelObject::sort_volumes(bool full_sort)
std::stable_sort(volumes.begin(), volumes.end(), [](ModelVolume* vl, ModelVolume* vr) {
ModelVolumeType vl_type = vl->type() > ModelVolumeType::PARAMETER_MODIFIER ? vl->type() : ModelVolumeType::PARAMETER_MODIFIER;
ModelVolumeType vr_type = vr->type() > ModelVolumeType::PARAMETER_MODIFIER ? vr->type() : ModelVolumeType::PARAMETER_MODIFIER;
// Apply same Precise Seam grouping logic for partial sort
if (vl->is_precise_seam() && vr->is_precise_seam()) {
bool vl_strong = vl->is_precise_seam_strong();
bool vr_strong = vr->is_precise_seam_strong();
if (vl_strong != vr_strong)
return vl_strong;
return false; // preserve order within same group
}
return vl_type < vr_type;
});
}
ModelInstance* ModelObject::add_instance()
{
ModelInstance* i = new ModelInstance(this);
@@ -2619,7 +2647,8 @@ std::vector<int> ModelVolume::get_extruders() const
if (m_type == ModelVolumeType::INVALID
|| m_type == ModelVolumeType::NEGATIVE_VOLUME
|| m_type == ModelVolumeType::SUPPORT_BLOCKER
|| m_type == ModelVolumeType::SUPPORT_ENFORCER)
|| m_type == ModelVolumeType::SUPPORT_ENFORCER
|| this->is_precise_seam()) // Precise Seam is non-printing helper geometry
return std::vector<int>();
if (mmu_segmentation_facets.timestamp() != mmuseg_ts) {
@@ -2823,6 +2852,19 @@ ModelVolumeType ModelVolume::type_from_string(const std::string &s)
return ModelVolumeType::SUPPORT_ENFORCER;
if (s == "support_blocker")
return ModelVolumeType::SUPPORT_BLOCKER;
// Precise Seam types
if (s == "precise_seam_center")
return ModelVolumeType::PRECISE_SEAM_CENTER;
if (s == "precise_seam_left")
return ModelVolumeType::PRECISE_SEAM_LEFT;
if (s == "precise_seam_right")
return ModelVolumeType::PRECISE_SEAM_RIGHT;
if (s == "precise_seam_enforced")
return ModelVolumeType::PRECISE_SEAM_ENFORCED;
if (s == "precise_seam_blocked")
return ModelVolumeType::PRECISE_SEAM_BLOCKED;
if (s == "precise_seam_neutral")
return ModelVolumeType::PRECISE_SEAM_NEUTRAL;
//assert(s == "0");
// Default value if invalud type string received.
return ModelVolumeType::MODEL_PART;
@@ -2837,6 +2879,12 @@ std::string ModelVolume::type_to_string(const ModelVolumeType t)
case ModelVolumeType::PARAMETER_MODIFIER: return "modifier_part";
case ModelVolumeType::SUPPORT_ENFORCER: return "support_enforcer";
case ModelVolumeType::SUPPORT_BLOCKER: return "support_blocker";
case ModelVolumeType::PRECISE_SEAM_CENTER: return "precise_seam_center";
case ModelVolumeType::PRECISE_SEAM_LEFT: return "precise_seam_left";
case ModelVolumeType::PRECISE_SEAM_RIGHT: return "precise_seam_right";
case ModelVolumeType::PRECISE_SEAM_ENFORCED: return "precise_seam_enforced";
case ModelVolumeType::PRECISE_SEAM_BLOCKED: return "precise_seam_blocked";
case ModelVolumeType::PRECISE_SEAM_NEUTRAL: return "precise_seam_neutral";
default:
assert(false);
return "normal_part";
@@ -4020,7 +4068,11 @@ void FacetsAnnotation::set_triangle_from_string(int triangle_id, const std::stri
m_data.bitstream.insert(m_data.bitstream.end(), bool(dec & (1 << i)));
}
m_data.update_used_states(bitstream_start_idx);
if (!m_data.update_used_states(bitstream_start_idx)) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": dropping malformed paint data of triangle " << triangle_id;
m_data.bitstream.resize(bitstream_start_idx);
m_data.triangles_to_split.pop_back();
}
}
bool FacetsAnnotation::equals(const FacetsAnnotation &other) const
@@ -4103,6 +4155,7 @@ bool model_volume_list_changed(const ModelObject &model_object_old, const ModelO
});
}
template< typename TypeFilterFn, typename CompareFn>
bool model_property_changed(const ModelObject &model_object_old, const ModelObject &model_object_new, TypeFilterFn type_filter, CompareFn compare)
{