mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Fixed mergeSelected
My previous fix was wrong; It only worked on what I wanted to fix (and broke the normal behavior). The current fix should fix both issues (merging works & merging groups works) CURA-2932
This commit is contained in:
parent
a68d96fb60
commit
042141413a
1 changed files with 2 additions and 2 deletions
|
@ -873,7 +873,7 @@ class CuraApplication(QtApplication):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Compute the center of the objects when their origins are aligned.
|
# Compute the center of the objects when their origins are aligned.
|
||||||
object_centers = [node.getBoundingBox().center for node in group_node.getChildren()]
|
object_centers = [node.getMeshData().getCenterPosition().scale(node.getScale()) for node in group_node.getAllChildren() if node.getMeshData()]
|
||||||
if object_centers and len(object_centers) > 0:
|
if object_centers and len(object_centers) > 0:
|
||||||
middle_x = sum([v.x for v in object_centers]) / len(object_centers)
|
middle_x = sum([v.x for v in object_centers]) / len(object_centers)
|
||||||
middle_y = sum([v.y for v in object_centers]) / len(object_centers)
|
middle_y = sum([v.y for v in object_centers]) / len(object_centers)
|
||||||
|
@ -884,7 +884,7 @@ class CuraApplication(QtApplication):
|
||||||
# Move each node to the same position.
|
# Move each node to the same position.
|
||||||
for center, node in zip(object_centers, group_node.getChildren()):
|
for center, node in zip(object_centers, group_node.getChildren()):
|
||||||
# Align the object and also apply the offset to center it inside the group.
|
# Align the object and also apply the offset to center it inside the group.
|
||||||
node.translate(-1 * (center - offset), SceneNode.TransformSpace.World)
|
node.setPosition(center - offset)
|
||||||
|
|
||||||
# Use the previously found center of the group bounding box as the new location of the group
|
# Use the previously found center of the group bounding box as the new location of the group
|
||||||
group_node.setPosition(group_node.getBoundingBox().center)
|
group_node.setPosition(group_node.getBoundingBox().center)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue