Merge branch 'master' of https://github.com/prusa3d/Slic3r
This commit is contained in:
commit
cc92d5c631
2 changed files with 24 additions and 10 deletions
|
@ -1532,8 +1532,13 @@ void GLCanvas3D::Selection::translate(const Vec3d& displacement)
|
|||
#if ENABLE_MODELVOLUME_TRANSFORM
|
||||
if ((m_mode == Volume) || (*m_volumes)[i]->is_wipe_tower)
|
||||
{
|
||||
Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
|
||||
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement);
|
||||
if (_requires_local_axes())
|
||||
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + displacement);
|
||||
else
|
||||
{
|
||||
Vec3d local_displacement = (m_cache.volumes_data[i].get_instance_rotation_matrix() * m_cache.volumes_data[i].get_instance_scale_matrix() * m_cache.volumes_data[i].get_instance_mirror_matrix()).inverse() * displacement;
|
||||
(*m_volumes)[i]->set_volume_offset(m_cache.volumes_data[i].get_volume_position() + local_displacement);
|
||||
}
|
||||
}
|
||||
else if (m_mode == Instance)
|
||||
(*m_volumes)[i]->set_instance_offset(m_cache.volumes_data[i].get_instance_position() + displacement);
|
||||
|
@ -1582,11 +1587,16 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
|
|||
else if (is_single_volume() || is_single_modifier())
|
||||
#if ENABLE_WORLD_ROTATIONS
|
||||
{
|
||||
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
|
||||
const Transform3d& inst_m = m_cache.volumes_data[i].get_instance_rotation_matrix();
|
||||
Vec3d new_rotation = Geometry::extract_euler_angles(inst_m.inverse() * m * inst_m * m_cache.volumes_data[i].get_volume_rotation_matrix());
|
||||
(*m_volumes)[i]->set_volume_rotation(new_rotation);
|
||||
}
|
||||
if (_requires_local_axes())
|
||||
(*m_volumes)[i]->set_volume_rotation(rotation);
|
||||
else
|
||||
{
|
||||
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
|
||||
const Transform3d& inst_m = m_cache.volumes_data[i].get_instance_rotation_matrix();
|
||||
Vec3d new_rotation = Geometry::extract_euler_angles(inst_m.inverse() * m * inst_m * m_cache.volumes_data[i].get_volume_rotation_matrix());
|
||||
(*m_volumes)[i]->set_volume_rotation(new_rotation);
|
||||
}
|
||||
}
|
||||
#else
|
||||
(*m_volumes)[i]->set_volume_rotation(rotation);
|
||||
#endif // ENABLE_WORLD_ROTATIONS
|
||||
|
@ -2570,6 +2580,11 @@ void GLCanvas3D::Selection::_ensure_on_bed()
|
|||
}
|
||||
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||
|
||||
bool GLCanvas3D::Selection::_requires_local_axes() const
|
||||
{
|
||||
return (m_mode == Volume) && is_from_single_instance();
|
||||
}
|
||||
|
||||
const float GLCanvas3D::Gizmos::OverlayIconsScale = 1.0f;
|
||||
const float GLCanvas3D::Gizmos::OverlayBorder = 5.0f;
|
||||
const float GLCanvas3D::Gizmos::OverlayGapY = 5.0f * OverlayIconsScale;
|
||||
|
@ -6332,9 +6347,7 @@ void GLCanvas3D::_render_camera_target() const
|
|||
::glColor3f(0.0f, 1.0f, 0.0f);
|
||||
::glVertex3d(target(0), target(1) - half_length, target(2));
|
||||
::glVertex3d(target(0), target(1) + half_length, target(2));
|
||||
::glEnd();
|
||||
|
||||
::glBegin(GL_LINES);
|
||||
// draw line for z axis
|
||||
::glColor3f(0.0f, 0.0f, 1.0f);
|
||||
::glVertex3d(target(0), target(1), target(2) - half_length);
|
||||
::glVertex3d(target(0), target(1), target(2) + half_length);
|
||||
|
|
|
@ -597,6 +597,7 @@ public:
|
|||
#if ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||
void _ensure_on_bed();
|
||||
#endif // ENABLE_ENSURE_ON_BED_WHILE_SCALING
|
||||
bool _requires_local_axes() const;
|
||||
};
|
||||
|
||||
class ClippingPlane
|
||||
|
|
Loading…
Add table
Reference in a new issue