Do not consider modifiers when centering an object after 3mf and amf import
This commit is contained in:
parent
4be6c17fd3
commit
a5fd9a34e8
3 changed files with 13 additions and 1 deletions
|
@ -997,12 +997,16 @@ Polygon ModelObject::convex_hull_2d(const Transform3d &trafo_instance)
|
||||||
return hull;
|
return hull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
|
void ModelObject::center_around_origin(bool include_modifiers)
|
||||||
|
#else
|
||||||
void ModelObject::center_around_origin()
|
void ModelObject::center_around_origin()
|
||||||
|
#endif // ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
{
|
{
|
||||||
// calculate the displacements needed to
|
// calculate the displacements needed to
|
||||||
// center this object around the origin
|
// center this object around the origin
|
||||||
#if ENABLE_VOLUMES_CENTERING_FIXES
|
#if ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
BoundingBoxf3 bb = full_raw_mesh_bounding_box();
|
BoundingBoxf3 bb = include_modifiers ? full_raw_mesh_bounding_box() : raw_mesh_bounding_box();
|
||||||
#else
|
#else
|
||||||
BoundingBoxf3 bb;
|
BoundingBoxf3 bb;
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
|
|
|
@ -236,7 +236,11 @@ public:
|
||||||
// This method is used by the auto arrange function.
|
// This method is used by the auto arrange function.
|
||||||
Polygon convex_hull_2d(const Transform3d &trafo_instance);
|
Polygon convex_hull_2d(const Transform3d &trafo_instance);
|
||||||
|
|
||||||
|
#if ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
|
void center_around_origin(bool include_modifiers = true);
|
||||||
|
#else
|
||||||
void center_around_origin();
|
void center_around_origin();
|
||||||
|
#endif // ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
void ensure_on_bed();
|
void ensure_on_bed();
|
||||||
void translate_instances(const Vec3d& vector);
|
void translate_instances(const Vec3d& vector);
|
||||||
void translate_instance(size_t instance_idx, const Vec3d& vector);
|
void translate_instance(size_t instance_idx, const Vec3d& vector);
|
||||||
|
|
|
@ -1617,7 +1617,11 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||||
if (type_3mf || type_any_amf) {
|
if (type_3mf || type_any_amf) {
|
||||||
#endif // !ENABLE_VOLUMES_CENTERING_FIXES
|
#endif // !ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
for (ModelObject* model_object : model.objects) {
|
for (ModelObject* model_object : model.objects) {
|
||||||
|
#if ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
|
model_object->center_around_origin(false);
|
||||||
|
#else
|
||||||
model_object->center_around_origin();
|
model_object->center_around_origin();
|
||||||
|
#endif // ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
model_object->ensure_on_bed();
|
model_object->ensure_on_bed();
|
||||||
}
|
}
|
||||||
#if !ENABLE_VOLUMES_CENTERING_FIXES
|
#if !ENABLE_VOLUMES_CENTERING_FIXES
|
||||||
|
|
Loading…
Reference in a new issue