Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
commit
354458ae73
4 changed files with 26 additions and 3 deletions
|
@ -983,6 +983,16 @@ void ModelObject::mirror(Axis axis)
|
|||
this->invalidate_bounding_box();
|
||||
}
|
||||
|
||||
void ModelObject::scale_mesh(const Vec3d &versor)
|
||||
{
|
||||
for (ModelVolume *v : this->volumes)
|
||||
{
|
||||
v->scale_geometry(versor);
|
||||
v->set_offset(versor.cwiseProduct(v->get_offset()));
|
||||
}
|
||||
this->invalidate_bounding_box();
|
||||
}
|
||||
|
||||
size_t ModelObject::materials_count() const
|
||||
{
|
||||
std::set<t_model_material_id> material_ids;
|
||||
|
@ -1514,6 +1524,12 @@ void ModelVolume::mirror(Axis axis)
|
|||
#endif // ENABLE_MODELVOLUME_TRANSFORM
|
||||
}
|
||||
|
||||
void ModelVolume::scale_geometry(const Vec3d& versor)
|
||||
{
|
||||
mesh.scale(versor);
|
||||
m_convex_hull.scale(versor);
|
||||
}
|
||||
|
||||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||
void ModelInstance::set_rotation(const Vec3d& rotation)
|
||||
{
|
||||
|
|
|
@ -237,6 +237,9 @@ public:
|
|||
void rotate(double angle, Axis axis);
|
||||
void rotate(double angle, const Vec3d& axis);
|
||||
void mirror(Axis axis);
|
||||
|
||||
void scale_mesh(const Vec3d& versor);
|
||||
|
||||
size_t materials_count() const;
|
||||
size_t facets_count() const;
|
||||
bool needed_repair() const;
|
||||
|
@ -331,6 +334,8 @@ public:
|
|||
void rotate(double angle, const Vec3d& axis);
|
||||
void mirror(Axis axis);
|
||||
|
||||
void scale_geometry(const Vec3d& versor);
|
||||
|
||||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
// translates the mesh and the convex hull so that the origin of their vertices is in the center of this volume's bounding box
|
||||
void center_geometry();
|
||||
|
|
|
@ -5200,7 +5200,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging() && !is_layers_editing_enabled())
|
||||
{
|
||||
// deselect and propagate event through callback
|
||||
if (m_picking_enabled && !m_toolbar_action_running && !m_mouse.ignore_up_event)
|
||||
if (!evt.ShiftDown() && m_picking_enabled && !m_toolbar_action_running && !m_mouse.ignore_up_event)
|
||||
{
|
||||
m_selection.clear();
|
||||
m_selection.set_mode(Selection::Instance);
|
||||
|
|
|
@ -1496,7 +1496,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||
#if !ENABLE_MODELVOLUME_TRANSFORM
|
||||
const Vec3d bed_center = Slic3r::to_3d(bed_shape.center().cast<double>(), 0.0);
|
||||
#endif // !ENABLE_MODELVOLUME_TRANSFORM
|
||||
const Vec3d bed_size = Slic3r::to_3d(bed_shape.size().cast<double>(), 1.0);
|
||||
const Vec3d bed_size = Slic3r::to_3d(bed_shape.size().cast<double>(), 1.0) - 2.0 * Vec3d::Ones();
|
||||
|
||||
bool need_arrange = false;
|
||||
bool scaled_down = false;
|
||||
|
@ -1529,7 +1529,9 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||
// the size of the object is too big -> this could lead to overflow when moving to clipper coordinates,
|
||||
// so scale down the mesh
|
||||
double inv = 1. / max_ratio;
|
||||
object->scale(Vec3d(inv, inv, inv));
|
||||
object->scale_mesh(Vec3d(inv, inv, inv));
|
||||
object->origin_translation = Vec3d::Zero();
|
||||
object->center_around_origin();
|
||||
scaled_down = true;
|
||||
} else if (max_ratio > 5) {
|
||||
const Vec3d inverse = ratio.cwiseInverse();
|
||||
|
|
Loading…
Reference in a new issue