Merge branch 'dev_native' of https://github.com/Prusa3d/Slic3r into dev_native
This commit is contained in:
commit
0555fb4bcc
3 changed files with 16 additions and 13 deletions
|
@ -787,7 +787,7 @@ BoundingBoxf3 ModelObject::raw_bounding_box() const
|
||||||
if (v->is_model_part()) {
|
if (v->is_model_part()) {
|
||||||
if (this->instances.empty())
|
if (this->instances.empty())
|
||||||
throw std::invalid_argument("Can't call raw_bounding_box() with no instances");
|
throw std::invalid_argument("Can't call raw_bounding_box() with no instances");
|
||||||
bb.merge(this->instances.front()->transform_mesh_bounding_box(&v->mesh, true));
|
bb.merge(this->instances.front()->transform_mesh_bounding_box(v->mesh, true));
|
||||||
}
|
}
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
@ -796,9 +796,21 @@ BoundingBoxf3 ModelObject::raw_bounding_box() const
|
||||||
BoundingBoxf3 ModelObject::instance_bounding_box(size_t instance_idx, bool dont_translate) const
|
BoundingBoxf3 ModelObject::instance_bounding_box(size_t instance_idx, bool dont_translate) const
|
||||||
{
|
{
|
||||||
BoundingBoxf3 bb;
|
BoundingBoxf3 bb;
|
||||||
|
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||||
|
for (ModelVolume *v : this->volumes)
|
||||||
|
{
|
||||||
|
if (v->is_model_part())
|
||||||
|
{
|
||||||
|
TriangleMesh mesh(v->mesh);
|
||||||
|
mesh.transform(v->get_matrix());
|
||||||
|
bb.merge(this->instances[instance_idx]->transform_mesh_bounding_box(mesh, dont_translate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
if (v->is_model_part())
|
if (v->is_model_part())
|
||||||
bb.merge(this->instances[instance_idx]->transform_mesh_bounding_box(&v->mesh, dont_translate));
|
bb.merge(this->instances[instance_idx]->transform_mesh_bounding_box(&v->mesh, dont_translate));
|
||||||
|
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1368,10 +1380,10 @@ void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) cons
|
||||||
mesh->transform(get_matrix(dont_translate));
|
mesh->transform(get_matrix(dont_translate));
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mesh, bool dont_translate) const
|
BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh& mesh, bool dont_translate) const
|
||||||
{
|
{
|
||||||
// Rotate around mesh origin.
|
// Rotate around mesh origin.
|
||||||
TriangleMesh copy(*mesh);
|
TriangleMesh copy(mesh);
|
||||||
copy.transform(get_matrix(true, false, true, true));
|
copy.transform(get_matrix(true, false, true, true));
|
||||||
BoundingBoxf3 bbox = copy.bounding_box();
|
BoundingBoxf3 bbox = copy.bounding_box();
|
||||||
|
|
||||||
|
|
|
@ -516,7 +516,7 @@ public:
|
||||||
// To be called on an external mesh
|
// To be called on an external mesh
|
||||||
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;
|
void transform_mesh(TriangleMesh* mesh, bool dont_translate = false) const;
|
||||||
// Calculate a bounding box of a transformed mesh. To be called on an external mesh.
|
// Calculate a bounding box of a transformed mesh. To be called on an external mesh.
|
||||||
BoundingBoxf3 transform_mesh_bounding_box(const TriangleMesh* mesh, bool dont_translate = false) const;
|
BoundingBoxf3 transform_mesh_bounding_box(const TriangleMesh& mesh, bool dont_translate = false) const;
|
||||||
// Transform an external bounding box.
|
// Transform an external bounding box.
|
||||||
BoundingBoxf3 transform_bounding_box(const BoundingBoxf3 &bbox, bool dont_translate = false) const;
|
BoundingBoxf3 transform_bounding_box(const BoundingBoxf3 &bbox, bool dont_translate = false) const;
|
||||||
// Transform an external vector.
|
// Transform an external vector.
|
||||||
|
|
|
@ -1292,11 +1292,6 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
||||||
// print.add_model_object(object);
|
// print.add_model_object(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if user turned autocentering off, automatic arranging would disappoint them
|
|
||||||
if (get_config("autocenter") != "1") {
|
|
||||||
need_arrange = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scaled_down) {
|
if (scaled_down) {
|
||||||
GUI::show_info(q,
|
GUI::show_info(q,
|
||||||
_(L("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")),
|
_(L("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")),
|
||||||
|
@ -1307,10 +1302,6 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
||||||
wxGetApp().obj_list()->add_object_to_list(idx);
|
wxGetApp().obj_list()->add_object_to_list(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_arrange) {
|
|
||||||
// arrange(); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
#if !ENABLE_MODIFIED_CAMERA_TARGET
|
#if !ENABLE_MODIFIED_CAMERA_TARGET
|
||||||
_3DScene::zoom_to_volumes(canvas3D);
|
_3DScene::zoom_to_volumes(canvas3D);
|
||||||
|
|
Loading…
Add table
Reference in a new issue