Arrange job now groups all transformations.

This ensures that we can un & re do the aranging
This commit is contained in:
Jaime van Kessel 2017-04-05 16:59:30 +02:00
parent 03db47afd9
commit 064b823ce3

View File

@ -5,6 +5,7 @@ from UM.Job import Job
from UM.Scene.SceneNode import SceneNode from UM.Scene.SceneNode import SceneNode
from UM.Math.Vector import Vector from UM.Math.Vector import Vector
from UM.Operations.SetTransformOperation import SetTransformOperation from UM.Operations.SetTransformOperation import SetTransformOperation
from UM.Operations.GroupedOperation import GroupedOperation
from UM.Message import Message from UM.Message import Message
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
i18n_catalog = i18nCatalog("cura") i18n_catalog = i18nCatalog("cura")
@ -42,7 +43,7 @@ class ArrangeObjectsJob(Job):
start_priority = 0 start_priority = 0
last_priority = start_priority last_priority = start_priority
last_size = None last_size = None
grouped_operation = GroupedOperation()
for idx, (size, node, offset_shape_arr, hull_shape_arr) in enumerate(nodes_arr): for idx, (size, node, offset_shape_arr, hull_shape_arr) in enumerate(nodes_arr):
# For performance reasons, we assume that when a location does not fit, # For performance reasons, we assume that when a location does not fit,
# it will also not fit for the next object (while what can be untrue). # it will also not fit for the next object (while what can be untrue).
@ -63,10 +64,10 @@ class ArrangeObjectsJob(Job):
center_y = node.getWorldPosition().y - node.getBoundingBox().bottom center_y = node.getWorldPosition().y - node.getBoundingBox().bottom
else: else:
center_y = 0 center_y = 0
grouped_operation.addOperation(SetTransformOperation(node, Vector(x, center_y, y)))
transformation_operation = SetTransformOperation(node, Vector(x, center_y, y))
transformation_operation.push()
status_message.setProgress((idx + 1) / len(nodes_arr) * 100) status_message.setProgress((idx + 1) / len(nodes_arr) * 100)
Job.yieldThread() Job.yieldThread()
grouped_operation.push()
status_message.hide() status_message.hide()