[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3250] contrib/py/scripts/addons/ mesh_bevel_round.py: Fix a couple of crashes in bevel round when faces non-planar.

Howard Trickey howard.trickey at gmail.com
Thu Apr 12 15:12:13 CEST 2012


Revision: 3250
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3250
Author:   howardt
Date:     2012-04-12 13:12:13 +0000 (Thu, 12 Apr 2012)
Log Message:
-----------
Fix a couple of crashes in bevel round when faces non-planar.

Modified Paths:
--------------
    contrib/py/scripts/addons/mesh_bevel_round.py

Modified: contrib/py/scripts/addons/mesh_bevel_round.py
===================================================================
--- contrib/py/scripts/addons/mesh_bevel_round.py	2012-04-12 08:41:55 UTC (rev 3249)
+++ contrib/py/scripts/addons/mesh_bevel_round.py	2012-04-12 13:12:13 UTC (rev 3250)
@@ -2091,6 +2091,11 @@
         ptcur = intersect_line_line(edcur.parallels[ifacecur], lineinter)
         ptnext = intersect_line_line(ednext.parallels[ifacenext], lineinter)
 
+        # It is possible that the offset lines don't intersect the face intersection if
+        # either face is non-planar.
+        if not ptcur or not ptnext:
+            return False
+
         # Common vertex
         vertex = None
         for v1 in edgecur.verts:
@@ -2157,6 +2162,10 @@
     # and the plane containing pt2 with normal normal2.
     def profile_compute_by_vectors(self, profile_type, pt1, vec1, pt2, normal2):
         origin = intersect_line_plane([pt1, vec1], [pt2, normal2])
+        if not origin:
+            # Can happen if one of the faces is non-planar
+            # Just make an origin to avoid a crash
+            origin = pt1.lerp(pt2, 0.5) + (pt2 - pt1).length * Vector([0.1, 0.1, 0.2])
         offset1 = (pt1 - origin).length
         offset2 = (pt2 - origin).length
         vec2 = pt2 - origin



More information about the Bf-extensions-cvs mailing list