Revision: 43636
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43636
Author:   campbellbarton
Date:     2012-01-23 13:50:00 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
speedup for mesh -> bmesh conversion
- was looping over all verts/edges/faces to setup the selection store, even 
when there was no selection store (mselect), since this is fairly common case, 
add a check.

also use BLI_array_growitems rather then BLI_array_growone to allocate in 
larger steps.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c

Modified: branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c   
2012-01-23 13:44:57 UTC (rev 43635)
+++ branches/bmesh/blender/source/blender/bmesh/operators/mesh_conv.c   
2012-01-23 13:50:00 UTC (rev 43636)
@@ -204,14 +204,15 @@
 
                BLI_array_empty(fedges);
                BLI_array_empty(verts);
+
+               BLI_array_growitems(fedges, mpoly->totloop);
+               BLI_array_growitems(verts, mpoly->totloop);
+
                for (j=0; j<mpoly->totloop; j++) {
                        ml = &me->mloop[mpoly->loopstart+j];
                        v = vt[ml->v];
                        e = et[ml->e];
 
-                       BLI_array_growone(fedges);
-                       BLI_array_growone(verts);
-
                        fedges[j] = e;
                        verts[j] = v;
                }
@@ -277,7 +278,7 @@
                }
        }
 
-       {
+       if (me->mselect && me->totselect != 0) {
                BMIter iter;
                BMVert *vertex;
                BMEdge *edge;
@@ -323,6 +324,13 @@
                MEM_freeN(edge_array);
                MEM_freeN(face_array);
        }
+       else {
+               me->totselect = 0;
+               if (me->mselect) {
+                       MEM_freeN(me->mselect);
+                       me->mselect = NULL;
+               }
+       }
 
        BLI_array_free(fedges);
        BLI_array_free(verts);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to