Skip to content

Commit 48d1715

Browse files
committed
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.
1 parent 6eeb135 commit 48d1715

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cura/CuraApplication.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,12 +1526,8 @@ def mergeSelected(self):
15261526

15271527
# Compute the center of the objects
15281528
object_centers = []
1529-
# Forget about the translation that the original objects have
1530-
zero_translation = Matrix(data=numpy.zeros(3))
15311529
for mesh, node in zip(meshes, group_node.getChildren()):
1532-
transformation = node.getLocalTransformation()
1533-
transformation.setTranslation(zero_translation)
1534-
transformed_mesh = mesh.getTransformed(transformation)
1530+
transformed_mesh = mesh.getTransformed(Matrix()) # Forget about the transformations that the original object had.
15351531
center = transformed_mesh.getCenterPosition()
15361532
if center is not None:
15371533
object_centers.append(center)
@@ -1546,7 +1542,7 @@ def mergeSelected(self):
15461542

15471543
# Move each node to the same position.
15481544
for mesh, node in zip(meshes, group_node.getChildren()):
1549-
node.setTransformation(Matrix())
1545+
node.setTransformation(Matrix()) # Removes any changes in position and rotation.
15501546
# Align the object around its zero position
15511547
# and also apply the offset to center it inside the group.
15521548
node.setPosition(-mesh.getZeroPosition() - offset)

0 commit comments

Comments
 (0)