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:
authorBart Crouch <bartius.crouch@gmail.com>2011-11-01 22:52:14 +0400
committerBart Crouch <bartius.crouch@gmail.com>2011-11-01 22:52:14 +0400
commitcb2e4fd4fe71ea7b1f9fa9be90b1293cb1790020 (patch)
tree22d799e41624a5a80a9d46e00b0bd8d4d692b056 /mesh_looptools.py
parenta1d5eacb52f86f8e9091306d94e4b16dc2cd3ff2 (diff)
Fix for divide-by-zero errors.
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r--mesh_looptools.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py
index 0bfb876e..174c3224 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -19,9 +19,9 @@
bl_info = {
'name': "LoopTools",
'author': "Bart Crouch",
- 'version': (3, 2, 0),
- 'blender': (2, 5, 7),
- 'api': 35979,
+ 'version': (3, 2, 1),
+ 'blender': (2, 6, 0),
+ 'api': 41270,
'location': "View3D > Toolbar and View3D > Specials (W-key)",
'warning': "",
'description': "Mesh modelling toolkit. Several tools to aid modelling",
@@ -249,9 +249,13 @@ def calculate_plane(mesh_mod, loop, method="best_fit", object=False):
vec = mathutils.Vector((1.0, 1.0, 1.0))
vec2 = (mat * vec)/(mat * vec).length
while vec != vec2 and iter<itermax:
- iter += 1
+ iter+=1
vec = vec2
- vec2 = (mat * vec)/(mat * vec).length
+ vec2 = mat * vec
+ if vec2.length != 0:
+ vec2 /= vec2.length
+ if vec2.length == 0:
+ vec2 = mathutils.Vector((1.0, 1.0, 1.0))
normal = vec2
elif method == 'normal':
@@ -936,7 +940,11 @@ def bridge_calculate_lines(mesh, loops, mode, twist, reverse):
while vec != vec2 and iter<itermax:
iter+=1
vec = vec2
- vec2 = (mat * vec)/(mat * vec).length
+ vec2 = mat * vec
+ if vec2.length != 0:
+ vec2 /= vec2.length
+ if vec2.length == 0:
+ vec2 = mathutils.Vector((1.0, 1.0, 1.0))
normal = vec2
normals.append(normal)
# have plane normals face in the same direction (maximum angle: 90 degrees)