FIX:z offset is error after copy and paste several objects
jira: STUDIO-6753 STUDIO-7135 Change-Id: I6d9c8eb0c957ff1e3194709704ceb6c3920baa4f (cherry picked from commit 847a7141a6f47e409566b19e73c0ebdeb08f39e2)
This commit is contained in:
parent
90f325792d
commit
a5cc52beb7
|
@ -3008,14 +3008,14 @@ void Selection::paste_objects_from_clipboard()
|
|||
Vec3d displacement;
|
||||
bool in_current = plate->intersects(bbox);
|
||||
auto start_point = in_current ? bbox.center() : plate->get_build_volume().center();
|
||||
auto start_offset = in_current ? src_object->instances.front()->get_offset() : plate->get_build_volume().center();
|
||||
if (shift_all(0) != 0 || shift_all(1) != 0) {
|
||||
// BBS: if multiple objects are selected, move them as a whole after copy
|
||||
if (i == 0) empty_cell_all = wxGetApp().plater()->canvas3D()->get_nearest_empty_cell({start_point(0), start_point(1)}, {bbox.size()(0)+1,bbox.size()(1)+1});
|
||||
auto instance_shift = src_object->instances.front()->get_offset() - src_objects[0]->instances.front()->get_offset();
|
||||
displacement = {shift_all.x() + empty_cell_all.x()+instance_shift.x(), shift_all.y() + empty_cell_all.y()+instance_shift.y(), start_point(2)};
|
||||
displacement = {shift_all.x() + empty_cell_all.x() + instance_shift.x(), shift_all.y() + empty_cell_all.y() + instance_shift.y(), start_offset(2)};
|
||||
} else {
|
||||
// BBS: if only one object is copied, find an empty cell to put it
|
||||
auto start_offset = in_current ? src_object->instances.front()->get_offset() : plate->get_build_volume().center();
|
||||
auto point_offset = start_offset - start_point;
|
||||
auto empty_cell = wxGetApp().plater()->canvas3D()->get_nearest_empty_cell({start_point(0), start_point(1)}, {bbox.size()(0)+1, bbox.size()(1)+1});
|
||||
displacement = {empty_cell.x() + point_offset.x(), empty_cell.y() + point_offset.y(), start_offset(2)};
|
||||
|
|
Loading…
Reference in New Issue