diff options
author | Arjen Hiemstra <ahiemstra@heimr.nl> | 2015-08-19 20:14:22 +0300 |
---|---|---|
committer | Arjen Hiemstra <ahiemstra@heimr.nl> | 2015-08-19 20:14:22 +0300 |
commit | 6fa6b1ac5d541ac10a1bbd035f0f468c584032a2 (patch) | |
tree | 44befc45033bfb5de7cf1224ccf20d9ad2f8f388 /cura/ConvexHullNode.py | |
parent | 79bd590656a6f18d33f87197141cf31bceed516b (diff) |
Render ConvexHullNode with different colors depending on setting/profile overrides
Diffstat (limited to 'cura/ConvexHullNode.py')
-rw-r--r-- | cura/ConvexHullNode.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index 6d56fd7364..7de28e777e 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -22,10 +22,13 @@ class ConvexHullNode(SceneNode): self._inherit_orientation = False self._inherit_scale = False + self._color = Color(35, 35, 35, 0.5) + self._node = node self._node.transformationChanged.connect(self._onNodePositionChanged) self._node.parentChanged.connect(self._onNodeParentChanged) - #self._onNodePositionChanged(self._node) + self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged) + self._onNodeDecoratorsChanged(self._node) self._hull = hull @@ -55,25 +58,32 @@ class ConvexHullNode(SceneNode): if not self._material: self._material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "color.frag")) - self._material.setUniformValue("u_color", Color(35, 35, 35, 128)) if self.getParent(): + self._material.setUniformValue("u_color", self._color) renderer.queueNode(self, material = self._material, transparent = True) return True - def _onNodePositionChanged(self, node): - #self.setPosition(node.getWorldPosition()) if node.callDecoration("getConvexHull"): node.callDecoration("setConvexHull", None) node.callDecoration("setConvexHullNode", None) self.setParent(None) - #self._node.transformationChanged.disconnect(self._onNodePositionChanged) - #self._node.parentChanged.disconnect(self._onNodeParentChanged) - def _onNodeParentChanged(self, node): if node.getParent(): self.setParent(self._original_parent) else: self.setParent(None) + + def _onNodeDecoratorsChanged(self, node): + self._color = Color(35, 35, 35, 0.5) + + if not node: + return + + if node.hasDecoration("getProfile"): + self._color.setR(0.75) + + if node.hasDecoration("getSetting"): + self._color.setG(0.75) |