Revert "Simplify code flow a bit"

This reverts commit 2c45efb70d.
This commit is contained in:
Ghostkeeper 2018-01-05 09:16:03 +01:00
parent 2c45efb70d
commit 63f7902fca
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -160,10 +160,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
return offset_hull
else:
if not self._node.getMeshData(): #Node has no mesh data, so just return an empty Polygon.
return Polygon([])
offset_hull = None
mesh = None
world_transform = None
if self._node.getMeshData():
mesh = self._node.getMeshData()
world_transform = self._node.getWorldTransformation()
@ -177,8 +177,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
# Do not throw away vertices: the convex hull may be too small and objects can collide.
# vertex_data = vertex_data[vertex_data[:,1] >= -0.01]
if not vertex_data or len(vertex_data) < 4:
return Polygon([])
if vertex_data and len(vertex_data) >= 4:
# Round the vertex data to 1/10th of a mm, then remove all duplicate vertices
# This is done to greatly speed up further convex hull calculations as the convex hull
# becomes much less complex when dealing with highly detailed models.
@ -201,6 +200,8 @@ class ConvexHullDecorator(SceneNodeDecorator):
if len(vertex_data) >= 3:
convex_hull = hull.getConvexHull()
offset_hull = self._offsetHull(convex_hull)
else:
return Polygon([]) # Node has no mesh data, so just return an empty Polygon.
# Store the result in the cache
self._2d_convex_hull_mesh = mesh