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:
authorSimon Edwards <s.edwards@ultimaker.com>2016-06-22 15:48:15 +0300
committerSimon Edwards <s.edwards@ultimaker.com>2016-06-22 15:48:15 +0300
commit9641a25f3136cab0c7ccde85b74fac5158654462 (patch)
tree90365dc8954afebe2bdac13c355ba6347252a7aa /cura/ConvexHullDecorator.py
parentfd42a43270afe38eab76e6517a0cd3a9801f9e21 (diff)
Fixed up the convex hull 'shadow' creation and deletion after the merge.
Contributes to CURA-1504
Diffstat (limited to 'cura/ConvexHullDecorator.py')
-rw-r--r--cura/ConvexHullDecorator.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py
index fab22f898e..29fa3bce0a 100644
--- a/cura/ConvexHullDecorator.py
+++ b/cura/ConvexHullDecorator.py
@@ -19,6 +19,19 @@ class ConvexHullDecorator(SceneNodeDecorator):
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
self._onGlobalStackChanged()
+ def setNode(self, node):
+ previous_node = self._node
+ if previous_node is not None and node is not previous_node:
+ previous_node.transformationChanged.connect(self._onChanged)
+ previous_node.parentChanged.connect(self._onChanged)
+
+ super().setNode(node)
+
+ self._node.transformationChanged.connect(self._onChanged)
+ self._node.parentChanged.connect(self._onChanged)
+
+ self._onChanged()
+
## Force that a new (empty) object is created upon copy.
def __deepcopy__(self, memo):
return ConvexHullDecorator()
@@ -67,16 +80,19 @@ class ConvexHullDecorator(SceneNodeDecorator):
return None
def recomputeConvexHull(self):
- if self._node is None:
- return None
+ root = Application.getInstance().getController().getScene().getRoot()
+ if self._node is None or not self.__isDescendant(root, self._node):
+ if self._convex_hull_node:
+ self._convex_hull_node.setParent(None)
+ self._convex_hull_node = None
+ return
convex_hull = self.getConvexHull()
if self._convex_hull_node:
if self._convex_hull_node.getHull() == convex_hull:
return
self._convex_hull_node.setParent(None)
- hull_node = ConvexHullNode.ConvexHullNode(self._node, convex_hull,
- Application.getInstance().getController().getScene().getRoot())
+ hull_node = ConvexHullNode.ConvexHullNode(self._node, convex_hull, root)
self._convex_hull_node = hull_node
def _onSettingValueChanged(self, key, property_name):
@@ -205,3 +221,11 @@ class ConvexHullDecorator(SceneNodeDecorator):
self._global_stack.containersChanged.connect(self._onChanged)
self._onChanged()
+
+ ## Returns true if node is a descendent or the same as the root node.
+ def __isDescendant(self, root, node):
+ if node is None:
+ return False
+ if root is node:
+ return True
+ return self.__isDescendant(root, node.getParent())