Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2016-09-08 13:49:42 +0300
committerJaime van Kessel <nallath@gmail.com>2016-09-08 13:49:42 +0300
commit09f7d9b999d787b002af967511c194701a61b867 (patch)
tree3e8c7a9c99d1871faf5ee49b7bc636d40511a17f /cura/PlatformPhysics.py
parenta11e2a56a6cbe490bdf1eab7ec5cda5bf1c6d622 (diff)
We shuffle the list of nodes so that the push free won't endlessly repeat the same 2 steps
Diffstat (limited to 'cura/PlatformPhysics.py')
-rw-r--r--cura/PlatformPhysics.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py
index b1dd1c4c8e..2a5bd4091c 100644
--- a/cura/PlatformPhysics.py
+++ b/cura/PlatformPhysics.py
@@ -15,6 +15,9 @@ from cura.ConvexHullDecorator import ConvexHullDecorator
from . import PlatformPhysicsOperation
from . import ZOffsetDecorator
+import random # used for list shuffling
+
+
class PlatformPhysics:
def __init__(self, controller, volume):
super().__init__()
@@ -49,8 +52,11 @@ class PlatformPhysics:
transformed_nodes = []
group_nodes = []
-
- for node in BreadthFirstIterator(root):
+ # We try to shuffle all the nodes to prevent "locked" situations, where iteration B inverts iteration A.
+ # By shuffling the order of the nodes, this might happen a few times, but at some point it will resolve.
+ nodes = list(BreadthFirstIterator(root))
+ random.shuffle(nodes)
+ for node in nodes:
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
continue