mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 14:09:02 +08:00
Use absolute transformation to set location for arrange
Using relative positioning proved to create issues; when spamming of arrange instructions it was possible to end up in the following time line 1: arrange action a is started 2: arrange action b is started 3: arrange action a finished computation, and applies transformations on the models 4: arrange action b finishes computation and applies relative transformations on top of the previous transformations By using absolute positioning this issue is resolved CURA-11279
This commit is contained in:
parent
0353037b31
commit
920809f064
@ -14,7 +14,7 @@ from UM.Math.Quaternion import Quaternion
|
|||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
|
from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation
|
||||||
from UM.Operations.GroupedOperation import GroupedOperation
|
from UM.Operations.GroupedOperation import GroupedOperation
|
||||||
from UM.Operations.RotateOperation import RotateOperation
|
from UM.Operations.SetTransformOperation import SetTransformOperation
|
||||||
from UM.Operations.TranslateOperation import TranslateOperation
|
from UM.Operations.TranslateOperation import TranslateOperation
|
||||||
from cura.Arranging.Arranger import Arranger
|
from cura.Arranging.Arranger import Arranger
|
||||||
|
|
||||||
@ -140,13 +140,17 @@ class Nest2DArrange(Arranger):
|
|||||||
grouped_operation.addOperation(AddSceneNodeOperation(node, scene_root))
|
grouped_operation.addOperation(AddSceneNodeOperation(node, scene_root))
|
||||||
|
|
||||||
if node_item.binId() == 0:
|
if node_item.binId() == 0:
|
||||||
# We found a spot for it
|
|
||||||
rotation_matrix = Matrix()
|
rotation_matrix = Matrix()
|
||||||
rotation_matrix.setByRotationAxis(node_item.rotation(), Vector(0, -1, 0))
|
rotation_matrix.setByRotationAxis(node_item.rotation(), Vector(0, -1, 0))
|
||||||
grouped_operation.addOperation(RotateOperation(node, Quaternion.fromMatrix(rotation_matrix)))
|
|
||||||
|
orientation = node.getWorldOrientation() * Quaternion.fromMatrix(rotation_matrix)
|
||||||
|
translation = node.getWorldPosition().preMultiply(rotation_matrix) + Vector(
|
||||||
|
node_item.translation().x() / self._factor,
|
||||||
|
0,
|
||||||
|
node_item.translation().y() / self._factor
|
||||||
|
)
|
||||||
grouped_operation.addOperation(
|
grouped_operation.addOperation(
|
||||||
TranslateOperation(node, Vector(node_item.translation().x() / self._factor, 0,
|
SetTransformOperation(node, orientation=orientation, translation=translation))
|
||||||
node_item.translation().y() / self._factor)))
|
|
||||||
else:
|
else:
|
||||||
# We didn't find a spot
|
# We didn't find a spot
|
||||||
grouped_operation.addOperation(
|
grouped_operation.addOperation(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user