Fix instance Z synchronization (#15465)

This commit is contained in:
Noisyfox
2026-10-13 22:26:53 +08:00
committed by GitHub
parent e821665e4b
commit a338f6ca7d
7 changed files with 57 additions and 84 deletions
+7 -8
View File
@@ -1280,6 +1280,7 @@ ModelObject& ModelObject::assign_copy(const ModelObject &rhs)
this->layer_config_ranges = rhs.layer_config_ranges;
this->layer_height_profile = rhs.layer_height_profile;
this->printable = rhs.printable;
this->auto_drop = rhs.auto_drop;
this->origin_translation = rhs.origin_translation;
this->cut_id.copy(rhs.cut_id);
this->copy_transformation_caches(rhs);
@@ -1320,6 +1321,7 @@ ModelObject& ModelObject::assign_copy(ModelObject &&rhs)
this->layer_config_ranges = std::move(rhs.layer_config_ranges);
this->layer_height_profile = std::move(rhs.layer_height_profile);
this->printable = std::move(rhs.printable);
this->auto_drop = rhs.auto_drop;
this->origin_translation = std::move(rhs.origin_translation);
this->copy_transformation_caches(rhs);
@@ -1889,6 +1891,9 @@ void ModelObject::center_around_origin(bool include_modifiers)
void ModelObject::ensure_on_bed(bool allow_negative_z)
{
if (!auto_drop)
return;
double z_offset = 0.0;
if (allow_negative_z) {
@@ -1907,14 +1912,8 @@ void ModelObject::ensure_on_bed(bool allow_negative_z)
else
z_offset = -this->min_z();
if (z_offset != 0.0) {
for (size_t i = 0; i < instances.size(); ++i) {
if (!instances[i]->auto_drop)
continue;
translate_instance(i, z_offset * Vec3d::UnitZ());
}
}
if (z_offset != 0.0)
translate_instances(z_offset * Vec3d::UnitZ());
}
void ModelObject::translate_instances(const Vec3d& vector)