Revision: 58519
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58519
Author:   campbellbarton
Date:     2013-07-22 23:33:53 +0000 (Mon, 22 Jul 2013)
Log Message:
-----------
use BLI_bitmap for crazyspace vertex tagging.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/util/crazyspace.c

Modified: trunk/blender/source/blender/editors/util/crazyspace.c
===================================================================
--- trunk/blender/source/blender/editors/util/crazyspace.c      2013-07-22 
23:20:48 UTC (rev 58518)
+++ trunk/blender/source/blender/editors/util/crazyspace.c      2013-07-22 
23:33:53 UTC (rev 58519)
@@ -40,6 +40,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
+#include "BLI_bitmap.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_modifier.h"
@@ -51,7 +52,7 @@
 
 typedef struct {
        float *vertexcos;
-       short *flags;
+       BLI_bitmap *vertex_visit;
 } MappedUserData;
 
 #define TAN_MAKE_VEC(a, b, c)   a[0] = b[0] + 0.2f * (b[0] - c[0]); a[1] = 
b[1] + 0.2f * (b[1] - c[1]); a[2] = b[2] + 0.2f * (b[2] - c[2])
@@ -79,11 +80,11 @@
        float *vec = mappedData->vertexcos;
 
        vec += 3 * index;
-       if (!mappedData->flags[index]) {
+       if (BLI_BITMAP_GET(mappedData->vertex_visit, index) == 0) {
                /* we need coord from prototype vertex, not it clones or images,
                 * suppose they stored in the beginning of vertex array stored 
in DM */
                copy_v3_v3(vec, co);
-               mappedData->flags[index] = 1;
+               BLI_BITMAP_SET(mappedData->vertex_visit, index);
        }
 }
 
@@ -109,7 +110,7 @@
        DerivedMesh *dm;
        float *vertexcos;
        int nverts = me->edit_btmesh->bm->totvert;
-       short *flags;
+       BLI_bitmap *vertex_visit;
        MappedUserData userData;
 
        /* disable subsurf temporal, get mapped cos, and enable it */
@@ -122,10 +123,10 @@
        dm = editbmesh_get_derived_cage(scene, obedit, me->edit_btmesh, 
CD_MASK_BAREMESH);
 
        vertexcos = MEM_callocN(3 * sizeof(float) * nverts, "vertexcos map");
-       flags = MEM_callocN(sizeof(short) * nverts, "vertexcos flags");
+       vertex_visit = BLI_BITMAP_NEW(nverts, "vertexcos flags");
 
        userData.vertexcos = vertexcos;
-       userData.flags = flags;
+       userData.vertex_visit = vertex_visit;
        dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData, 
DM_FOREACH_NOP);
 
        dm->release(dm);
@@ -133,7 +134,7 @@
        /* set back the flag, no new cage needs to be built, transform does it 
*/
        modifiers_disable_subsurf_temporary(obedit);
 
-       MEM_freeN(flags);
+       MEM_freeN(vertex_visit);
 
        return vertexcos;
 }
@@ -278,7 +279,7 @@
                        if (!defmats) {
                                dm = getEditDerivedBMesh(em, ob, NULL);
                                deformedVerts = editbmesh_get_vertex_cos(em, 
&numVerts);
-                               defmats = MEM_callocN(sizeof(*defmats) * 
numVerts, "defmats");
+                               defmats = MEM_mallocN(sizeof(*defmats) * 
numVerts, "defmats");
 
                                for (a = 0; a < numVerts; a++)
                                        unit_m3(defmats[a]);

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

Reply via email to