mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-18 02:25:55 +08:00
Tech ENABLE_WORLD_COORDINATE - Fixed translation in local coordinate for single instance selection
This commit is contained in:
parent
8cf66f52f6
commit
90874c1953
@ -76,13 +76,17 @@ void GLGizmoMove3D::on_start_dragging()
|
|||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
const BoundingBoxf3 box = get_selection_box();
|
const BoundingBoxf3 box = get_selection_box();
|
||||||
Vec3d center;
|
Vec3d center;
|
||||||
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
if (wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||||
center = box.center();
|
center = box.center();
|
||||||
|
m_starting_drag_position = center + m_grabbers[m_hover_id].center;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
const Selection& selection = m_parent.get_selection();
|
const Selection& selection = m_parent.get_selection();
|
||||||
center = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix() * box.center();
|
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
|
const Transform3d trafo = Geometry::assemble_transform(Vec3d::Zero(), v.get_instance_rotation());
|
||||||
|
center = v.get_instance_offset() + trafo * box.center();
|
||||||
|
m_starting_drag_position = center + trafo * m_grabbers[m_hover_id].center;
|
||||||
}
|
}
|
||||||
m_starting_drag_position = center + m_grabbers[m_hover_id].center;
|
|
||||||
m_starting_box_center = center;
|
m_starting_box_center = center;
|
||||||
m_starting_box_bottom_center = center;
|
m_starting_box_bottom_center = center;
|
||||||
m_starting_box_bottom_center.z() = box.min.z();
|
m_starting_box_bottom_center.z() = box.min.z();
|
||||||
|
@ -728,7 +728,7 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||||||
if (is_from_fully_selected_instance(i)) {
|
if (is_from_fully_selected_instance(i)) {
|
||||||
if (local) {
|
if (local) {
|
||||||
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_scale_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;
|
||||||
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