Tech ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES - Mirror transform in local system for volumes and a few fixes in rotation

Fixed conflicts during rebase with master
This commit is contained in:
enricoturri1966 2021-11-15 13:00:12 +01:00
parent fb31bcd0f0
commit 6e92b4fc3b
3 changed files with 9 additions and 3 deletions

View File

@ -926,7 +926,7 @@ void ObjectManipulation::update_mirror_buttons_visibility()
std::array<MirrorButtonState, 3> new_states = {mbHidden, mbHidden, mbHidden};
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
if (!is_world_coordinates()) {
if (is_local_coordinates()) {
#else
if (!m_world_coordinates) {
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES

View File

@ -327,6 +327,10 @@ void GLGizmoRotate::init_data_from_selection(const Selection& selection)
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
m_orient_matrix = v.get_instance_transformation().get_matrix(true, false, true, true) * v.get_volume_transformation().get_matrix(true, false, true, true);
}
else {
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
m_orient_matrix = v.get_instance_transformation().get_matrix(true, false, true, true);
}
#else
if (wxGetApp().obj_manipul()->get_world_coordinates())
m_orient_matrix = Transform3d::Identity();

View File

@ -779,7 +779,7 @@ void Selection::translate(const Vec3d& displacement, bool local)
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
else if (type == ECoordinatesType::Local) {
const VolumeCache& volume_data = m_cache.volumes_data[i];
const Vec3d local_displacement = (volume_data.get_volume_rotation_matrix() * volume_data.get_volume_mirror_matrix()) * displacement;
const Vec3d local_displacement = volume_data.get_volume_rotation_matrix() * displacement;
v.set_volume_offset(volume_data.get_volume_position() + local_displacement);
}
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
@ -799,11 +799,13 @@ void Selection::translate(const Vec3d& displacement, bool local)
if (is_from_fully_selected_instance(i)) {
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
if (type == ECoordinatesType::Local) {
const VolumeCache& volume_data = m_cache.volumes_data[i];
const Vec3d world_displacement = volume_data.get_instance_rotation_matrix() * displacement;
#else
if (local) {
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
const VolumeCache& volume_data = m_cache.volumes_data[i];
const Vec3d world_displacement = (volume_data.get_instance_rotation_matrix() * volume_data.get_instance_mirror_matrix()) * displacement;
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
v.set_instance_offset(volume_data.get_instance_position() + world_displacement);
}
else