From 48d1715c2db871af2a10a66fdcb3f2dc2f5aeadc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 21 May 2021 13:45:51 +0200 Subject: [PATCH] Also remove other transformations when getting the center position The other transformations, in particular rotation, were also influencing the merge. The transformations were not removed when calculating the center position, causing the center position of a mesh to be calculating differently. When the meshes were actually transformed/moved, all of the transformations were removed but this gave the model a different center position. The different center position wasn't properly being compensated for using the previously calculated center position. Fixes CURA-7873. --- cura/CuraApplication.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 146da4a47c..c72ad0ae90 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1526,12 +1526,8 @@ class CuraApplication(QtApplication): # Compute the center of the objects object_centers = [] - # Forget about the translation that the original objects have - zero_translation = Matrix(data=numpy.zeros(3)) for mesh, node in zip(meshes, group_node.getChildren()): - transformation = node.getLocalTransformation() - transformation.setTranslation(zero_translation) - transformed_mesh = mesh.getTransformed(transformation) + transformed_mesh = mesh.getTransformed(Matrix()) # Forget about the transformations that the original object had. center = transformed_mesh.getCenterPosition() if center is not None: object_centers.append(center) @@ -1546,7 +1542,7 @@ class CuraApplication(QtApplication): # Move each node to the same position. for mesh, node in zip(meshes, group_node.getChildren()): - node.setTransformation(Matrix()) + node.setTransformation(Matrix()) # Removes any changes in position and rotation. # Align the object around its zero position # and also apply the offset to center it inside the group. node.setPosition(-mesh.getZeroPosition() - offset)