mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 03:46:05 +08:00
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:
parent
fb31bcd0f0
commit
6e92b4fc3b
@ -926,7 +926,7 @@ void ObjectManipulation::update_mirror_buttons_visibility()
|
|||||||
std::array<MirrorButtonState, 3> new_states = {mbHidden, mbHidden, mbHidden};
|
std::array<MirrorButtonState, 3> new_states = {mbHidden, mbHidden, mbHidden};
|
||||||
|
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (!is_world_coordinates()) {
|
if (is_local_coordinates()) {
|
||||||
#else
|
#else
|
||||||
if (!m_world_coordinates) {
|
if (!m_world_coordinates) {
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
|
@ -327,6 +327,10 @@ void GLGizmoRotate::init_data_from_selection(const Selection& selection)
|
|||||||
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
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);
|
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
|
#else
|
||||||
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
||||||
m_orient_matrix = Transform3d::Identity();
|
m_orient_matrix = Transform3d::Identity();
|
||||||
|
@ -779,7 +779,7 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
else if (type == ECoordinatesType::Local) {
|
else if (type == ECoordinatesType::Local) {
|
||||||
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
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);
|
v.set_volume_offset(volume_data.get_volume_position() + local_displacement);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#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 (is_from_fully_selected_instance(i)) {
|
||||||
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
#if ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
||||||
if (type == ECoordinatesType::Local) {
|
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
|
#else
|
||||||
if (local) {
|
if (local) {
|
||||||
#endif // ENABLE_INSTANCE_COORDINATES_FOR_VOLUMES
|
|
||||||
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
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;
|
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);
|
v.set_instance_offset(volume_data.get_instance_position() + world_displacement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user