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>2015-09-03 17:34:25 +0300
committerJaime van Kessel <nallath@gmail.com>2015-09-03 17:34:25 +0300
commit45f213cd82ebdb4f5963a217ac4a391d4dc53810 (patch)
treee9a86fdad492348756eca92f46edbb45d0e8ec21 /cura/ConvexHullNode.py
parent57632f895e15000b1b8c862b1c09f8a5dddc8583 (diff)
Head shape is now also shown in hull
Diffstat (limited to 'cura/ConvexHullNode.py')
-rw-r--r--cura/ConvexHullNode.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py
index 3ea148dce8..4b36a11949 100644
--- a/cura/ConvexHullNode.py
+++ b/cura/ConvexHullNode.py
@@ -29,16 +29,24 @@ class ConvexHullNode(SceneNode):
self._node.parentChanged.connect(self._onNodeParentChanged)
self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged)
self._onNodeDecoratorsChanged(self._node)
-
+ self.convexHullHeadMesh = None
self._hull = hull
hull_points = self._hull.getPoints()
+ hull_mesh = self.createHullMesh(self._hull.getPoints())
+ if hull_mesh:
+ self.setMeshData(hull_mesh)
+ convex_hull_head = self._node.callDecoration("getConvexHullHead")
+ if convex_hull_head:
+ self.convexHullHeadMesh = self.createHullMesh(convex_hull_head.getPoints())
+
+ def createHullMesh(self, hull_points):
mesh = MeshData()
if len(hull_points) > 3:
center = (hull_points.min(0) + hull_points.max(0)) / 2.0
mesh.addVertex(center[0], 0.1, center[1])
- else: #Hull has not enough points
- return
+ else:
+ return None
for point in hull_points:
mesh.addVertex(point[0], 0.1, point[1])
indices = []
@@ -48,8 +56,7 @@ class ConvexHullNode(SceneNode):
indices.append([0, mesh.getVertexCount() - 1, 1])
mesh.addIndices(numpy.array(indices, numpy.int32))
-
- self.setMeshData(mesh)
+ return mesh
def getWatchedNode(self):
return self._node
@@ -61,6 +68,8 @@ class ConvexHullNode(SceneNode):
if self.getParent():
self._material.setUniformValue("u_color", self._color)
renderer.queueNode(self, material = self._material, transparent = True)
+ if self.convexHullHeadMesh:
+ renderer.queueNode(self, material = self._material,transparent = True, mesh = self.convexHullHeadMesh)
return True