Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesh_inset/geom.py9
-rw-r--r--mesh_inset/offset.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/mesh_inset/geom.py b/mesh_inset/geom.py
index a7eb4fed..dce2a818 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 4e860b67..3c6a7c76 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()