mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Arranger: moved functions, split Arrange into Arrange All and Arrange Selection. CURA-3239
This commit is contained in:
parent
abb5d1e76e
commit
bd874a62ac
1 changed files with 18 additions and 17 deletions
|
@ -988,7 +988,24 @@ class CuraApplication(QtApplication):
|
||||||
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0), Quaternion(), Vector(1, 1, 1)))
|
op.addOperation(SetTransformOperation(node, Vector(0, center_y, 0), Quaternion(), Vector(1, 1, 1)))
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
## Testing: arrange selected objects or all objects
|
## Arrange all objects.
|
||||||
|
@pyqtSlot()
|
||||||
|
def arrangeAll(self):
|
||||||
|
nodes = []
|
||||||
|
fixed_nodes = []
|
||||||
|
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||||
|
if type(node) is not SceneNode:
|
||||||
|
continue
|
||||||
|
if not node.getMeshData() and not node.callDecoration("isGroup"):
|
||||||
|
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)
|
||||||
|
if not node.isSelectable():
|
||||||
|
continue # i.e. node with layer data
|
||||||
|
nodes.append(node)
|
||||||
|
self.arrange(nodes, fixed_nodes)
|
||||||
|
|
||||||
|
## Arrange Selection
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def arrangeSelection(self):
|
def arrangeSelection(self):
|
||||||
nodes = Selection.getAllSelectedObjects()
|
nodes = Selection.getAllSelectedObjects()
|
||||||
|
@ -1007,22 +1024,6 @@ class CuraApplication(QtApplication):
|
||||||
fixed_nodes.append(node)
|
fixed_nodes.append(node)
|
||||||
self.arrange(nodes, fixed_nodes)
|
self.arrange(nodes, fixed_nodes)
|
||||||
|
|
||||||
@pyqtSlot()
|
|
||||||
def arrangeAll(self):
|
|
||||||
nodes = []
|
|
||||||
fixed_nodes = []
|
|
||||||
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
|
|
||||||
if type(node) is not SceneNode:
|
|
||||||
continue
|
|
||||||
if not node.getMeshData() and not node.callDecoration("isGroup"):
|
|
||||||
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)
|
|
||||||
if not node.isSelectable():
|
|
||||||
continue # i.e. node with layer data
|
|
||||||
nodes.append(node)
|
|
||||||
self.arrange(nodes, fixed_nodes)
|
|
||||||
|
|
||||||
## Arrange the nodes, given fixed nodes
|
## Arrange the nodes, given fixed nodes
|
||||||
def arrange(self, nodes, fixed_nodes):
|
def arrange(self, nodes, fixed_nodes):
|
||||||
min_offset = 8
|
min_offset = 8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue