Tech ENABLE_WORLD_COORDINATE - Fixed volumes rotation in world coordinate

Added sub-tech ENABLE_WORLD_COORDINATE_VOLUMES_LOCAL_OFFSET which enable showing world coordinates of volumes' offset relative to the instance containing them

Show 'Drop to bed' button in sidebar whenever the selected instance or volume is not laying on the printbed
This commit is contained in:
enricoturri1966 2021-10-18 15:13:47 +02:00
parent 84c0b816cb
commit 5649151444
4 changed files with 37 additions and 8 deletions

View file

@ -827,13 +827,25 @@ void Selection::rotate(const Vec3d& rotation, TransformationType transformation_
if (is_single_full_instance())
rotate_instance(v, i);
else if (is_single_volume() || is_single_modifier()) {
if (transformation_type.independent())
v.set_volume_rotation(v.get_volume_rotation() + rotation);
#if ENABLE_WORLD_COORDINATE
if (transformation_type.local())
v.set_volume_rotation(m_cache.volumes_data[i].get_volume_rotation() + rotation);
else {
const Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
const Vec3d new_rotation = Geometry::extract_euler_angles(m * m_cache.volumes_data[i].get_volume_rotation_matrix());
v.set_volume_rotation(new_rotation);
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
m = m * m_cache.volumes_data[i].get_instance_rotation_matrix();
m = m * m_cache.volumes_data[i].get_volume_rotation_matrix();
m = m_cache.volumes_data[i].get_instance_rotation_matrix().inverse() * m;
v.set_volume_rotation(Geometry::extract_euler_angles(m));
}
#else
if (transformation_type.independent())
v.set_volume_rotation(v.get_volume_rotation() + rotation);
else {
const Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
const Vec3d new_rotation = Geometry::extract_euler_angles(m * m_cache.volumes_data[i].get_volume_rotation_matrix());
v.set_volume_rotation(new_rotation);
}
#endif // ENABLE_WORLD_COORDINATE
}
else {
if (m_mode == Instance)