fix tracker url
[blender-addons-contrib.git] / mesh_select_vertex_groups.py
index 0d45627edd6e7253c770be4dd02fad743ea056cf..4d401a01e88c34744345670a05f6fa93dd5118c3 100644 (file)
@@ -165,18 +165,17 @@ def found_verts(vertex_group):
     obj = bpy.context.active_object
     if vertex_group == 'no group':
         for v in obj.data.vertices:
-            if v.index in used_vertexes and len(v.groups) == 0:
-                gfound.append(v)
+            if v.index in used_vertexes and (not v.groups):
+                vgfound.append(v)
     else:
-        vgnum = -1
-        for vg in obj.vertex_groups:
-            if vg.name == vertex_group: vgnum = vg.index
+        vgnum = obj.vertex_groups.find(vertex_group)
         for v in obj.data.vertices:
             if v.index in used_vertexes:
-                found = False
                 for g in v.groups:
-                        if g.group == vgnum: found = True
-                if found: vgfound.append(v)
+                    if g.group == vgnum:
+                        vgfound.append(v)
+                        break
+
     print('%d vertexes found for %s' % (len(vgfound), vertex_group))
     return vgfound
 
@@ -185,6 +184,7 @@ class VIEW3D_PT_FixVertexGroups(bpy.types.Panel):
     bl_space_type = "VIEW_3D"
     bl_region_type = "TOOLS"
     bl_label = "Select Vertex Groups"
+    bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(self, context):