Fix "Reset all model transformations" for groups

CURA-2291
This commit is contained in:
fieldOfView 2016-09-07 16:06:42 +02:00
parent 15101ec53d
commit cab5f4d823

View File

@ -693,12 +693,12 @@ class CuraApplication(QtApplication):
continue # Node that doesnt have a mesh and is not a group.
if node.getParent() and node.getParent().callDecoration("isGroup"):
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
nodes.append(node)
if nodes:
op = GroupedOperation()
for node in nodes:
# Ensure that the object is above the build platform
node.removeDecorator(ZOffsetDecorator.ZOffsetDecorator)
op.addOperation(SetTransformOperation(node, Vector(0, node.getWorldPosition().y - node.getBoundingBox().bottom, 0)))
op.push()
@ -719,13 +719,15 @@ class CuraApplication(QtApplication):
if nodes:
op = GroupedOperation()
for node in nodes:
# Ensure that the object is above the build platform
node.removeDecorator(ZOffsetDecorator.ZOffsetDecorator)
op.addOperation(SetTransformOperation(node, Vector(0, node.getMeshData().getCenterPosition().y, 0), Quaternion(), Vector(1, 1, 1)))
center_y = 0
if node.callDecoration("isGroup"):
center_y = node.getWorldPosition().y - node.getBoundingBox().bottom
else:
center_y = node.getMeshData().getCenterPosition().y
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0), Quaternion(), Vector(1, 1, 1)))
op.push()
## Reload all mesh data on the screen from file.