Fixed the order of a check with intersect_line_face to correct the script from checki...
authorPaul Marshall <portsidepaul@hotmail.com>
Thu, 6 Sep 2012 19:05:34 +0000 (19:05 +0000)
committerPaul Marshall <portsidepaul@hotmail.com>
Thu, 6 Sep 2012 19:05:34 +0000 (19:05 +0000)
Also have discovered a possible bug with bmesh.types.BMEdgeSeq.remove() crashing Blender - as such some functionality may be crippled until that is resolved.

mesh_edgetools.py

index 0c274e0d988d03d1e93da779ba284f7f65f8f515..5cf4b84d74193c27154008c7af63a503efeeb387 100644 (file)
@@ -523,7 +523,8 @@ def intersect_line_face(edge, face, is_infinite = False, error = 0.000002):
         p1, p2, p3 = face.verts[0].co, face.verts[1].co, face.verts[2].co
         int_co = intersect_line_plane(edge.verts[0].co, edge.verts[1].co, p1, face.normal)
 
-        if int_co != None:
+        # Only check if the triangle is not being treated as an infinite plane:
+        if int_co != None and not is_infinite:
             pA = p1 - int_co
             pB = p2 - int_co
             pC = p3 - int_co
@@ -533,7 +534,7 @@ def intersect_line_face(edge, face, is_infinite = False, error = 0.000002):
             sumA = aAB + aBC + aCA
 
             # If the point is outside the triangle:
-            if (sumA > (pi + error) and sumA < (pi - error)) and not is_infinite:
+            if (sumA > (pi + error) and sumA < (pi - error)):
                 int_co = None
 
     # This is the default case where we either have a planar quad or an n-gon.
@@ -1453,9 +1454,15 @@ class Slice(bpy.types.Operator):
                             newV1.co = intersection
                             newV2 = bVerts.new()
                             newV2.co = intersection
+                            if bpy.app.debug:
+                                print("New vertices were successfully created")
                             newE1 = bEdges.new((v1, newV1))
                             newE2 = bEdges.new((v2, newV2))
+                            if bpy.app.debug:
+                                print("New edges were successfully created")
                             bEdges.remove(e)
+                            if bpy.app.debug:
+                                print("Old edge successfully removed")
                         else:
                             new = list(bmesh.utils.edge_split(e, v1, 0.5))
                             new[1].co = intersection