[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3212] contrib/py/scripts/addons/ mesh_vertex_slide.py: Fix for bug reported by Sebastian Nell.

Valter Battioli valtervb at live.com
Wed Apr 4 21:35:24 CEST 2012


Revision: 3212
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3212
Author:   valtervb
Date:     2012-04-04 19:35:24 +0000 (Wed, 04 Apr 2012)
Log Message:
-----------
Fix for bug reported by Sebastian Nell. Now check for duplicate vertices. If some linked vertices have the same coords of selected vertices we have the error "division by 0. Now in this case the script don't start.

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

Modified: contrib/py/scripts/addons/mesh_vertex_slide.py
===================================================================
--- contrib/py/scripts/addons/mesh_vertex_slide.py	2012-04-04 09:24:52 UTC (rev 3211)
+++ contrib/py/scripts/addons/mesh_vertex_slide.py	2012-04-04 19:35:24 UTC (rev 3212)
@@ -62,6 +62,7 @@
 #ver. 1.1.6: Now the vertex movement is always coherent with Mouse movement
 #ver. 2.0.0: Update to Bmesh and remove all mode switching
 #ver. 2.0.1: Replaced Conv3DtoScreen2D function with location_3d_to_region_2d
+#ver. 2.0.2: Fix crash if there are some duplicate vertices
 #***********************************************************************
 
 import bpy
@@ -423,7 +424,12 @@
         if len(SelectedVertices) == 1 and len(self.LinkedVertices1) == 0:
             self.report({'WARNING'}, "Isolated vertex or mixed Select Mode!")
             return {'CANCELLED'}
-
+        # Check for duplicate vertices. If some linked vertice have the same coords of selected vertice
+        # we have the error "division by 0
+        if self.Vertex1.original.co == self.Vertex2.original.co:
+            self.report({'WARNING'}, "At least one duplicate vertex")
+            return {'CANCELLED'}
+            
         self.bm.verts[self.Vertex1.original.idx].select = True  # Select the first selected vertex
         if len(SelectedVertices) == 2:
             self.bm.verts[self.Vertex2.original.idx].select = True  # Select the second selected vertex



More information about the Bf-extensions-cvs mailing list