[Bf-extensions-cvs] [44153e0] master: Fix T44567: inset polygon added crash
Howard Trickey
noreply at git.blender.org
Fri May 1 13:55:43 CEST 2015
Commit: 44153e0c67f7ccbe3091215875c7f127ec847f1f
Author: Howard Trickey
Date: Fri May 1 07:53:07 2015 -0400
Branches: master
https://developer.blender.org/rBA44153e0c67f7ccbe3091215875c7f127ec847f1f
Fix T44567: inset polygon added crash
Crash caused by some vertices in the input model being doubled.
The code to test for the maximum inset deduped the vertices
but the faces were not remapped. Fixed by having that test code
not dedup the vertices.
===================================================================
M mesh_inset/geom.py
M mesh_inset/offset.py
===================================================================
diff --git a/mesh_inset/geom.py b/mesh_inset/geom.py
index a7eb4fe..dce2a81 100644
--- a/mesh_inset/geom.py
+++ b/mesh_inset/geom.py
@@ -67,11 +67,12 @@ class Points(object):
return tuple([int(round(v * INVDISTTOL)) for v in p])
- def AddPoint(self, p):
+ def AddPoint(self, p, allowdups = False):
"""Add point p to the Points set and return vertex number.
If there is an existing point which quantizes the same,,
don't add a new one but instead return existing index.
+ Except if allowdups is True, don't do that deduping.
Args:
p: tuple of float - coordinates (2-tuple or 3-tuple)
@@ -80,14 +81,14 @@ class Points(object):
"""
qp = Points.Quantize(p)
- if qp in self.invmap:
+ if qp in self.invmap and not allowdups:
return self.invmap[qp]
else:
self.invmap[qp] = len(self.pos)
self.pos.append(p)
return len(self.pos) - 1
- def AddPoints(self, points):
+ def AddPoints(self, points, allowdups = False):
"""Add another set of points to this set.
We need to return a mapping from indices
@@ -102,7 +103,7 @@ class Points(object):
vmap = [0] * len(points.pos)
for i in range(len(points.pos)):
- vmap[i] = self.AddPoint(points.pos[i])
+ vmap[i] = self.AddPoint(points.pos[i], allowdups)
return vmap
def AddZCoord(self, z):
diff --git a/mesh_inset/offset.py b/mesh_inset/offset.py
index 4e860b6..3c6a7c7 100644
--- a/mesh_inset/offset.py
+++ b/mesh_inset/offset.py
@@ -706,7 +706,7 @@ class Offset(object):
# so don't add points that won't be used when
# really do a Build with a smaller amount
test_points = geom.Points()
- test_points.AddPoints(self.polyarea.points)
+ test_points.AddPoints(self.polyarea.points, True)
save_points = self.polyarea.points
self.polyarea.points = test_points
self.Build()
More information about the Bf-extensions-cvs
mailing list