=bmesh=
authorJoseph Eagar <joeedh@gmail.com>
Sun, 27 Feb 2011 07:49:36 +0000 (07:49 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Sun, 27 Feb 2011 07:49:36 +0000 (07:49 +0000)
Mirror modifier no longer uses bmesh, but is now
100% CDDM.  This is faster; the sluggishness was
driving me crazy.  Still need to deal with UVs,
but that shouldn't be hard.

intern/ghost/intern/GHOST_EventManager.cpp
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_rna.c

index c42cf90ba7c110d7eb2bd049c014b36a36772fba..80b99552988cd873f809dafa3a71e7acfb66ff04 100644 (file)
@@ -156,7 +156,7 @@ GHOST_TSuccess GHOST_EventManager::pushEvent(GHOST_IEvent* event)
                        
                        /*write modifier key states*/
                        sys->getModifierKeys(keys);
-                       fprintf(m_recfile, "lshift: %d rshift: %d lalt: %d ralt: %d lctrl: %d rctrl: %d command: %d\n", 
+                       fprintf(m_recfile, "lshift: %d rshift: %d lalt: %d ralt: %d lctrl: %d rctrl: %d", 
                                (int)keys.get(GHOST_kModifierKeyLeftShift),
                                (int)keys.get(GHOST_kModifierKeyRightShift), 
                                (int)keys.get(GHOST_kModifierKeyLeftAlt), 
index 368e84cce303db92e602b9e83dce6fa6218feb28..a23663d12754135c1f841d83d270e51bab999817 100644 (file)
@@ -2225,9 +2225,6 @@ void CDDM_calc_normals(DerivedMesh *dm)
        if (CustomData_has_layer(&dm->faceData, CD_NORMAL))
                CustomData_free_layer(&dm->faceData, CD_NORMAL, dm->numFaceData, 0);
 
-       temp_nors = MEM_callocN(numVerts * sizeof(*temp_nors),
-                                                       "CDDM_calc_normals temp_nors");
-
        /*recalc tesselation to ensure we have valid origindex values
          for mface->mpoly lookups.*/
        cdDM_recalcTesselation2(dm);
@@ -2283,12 +2280,14 @@ void CDDM_calc_normals(DerivedMesh *dm)
                face_nors, dm->numFaceData);
 }
 
-#if 0
+#if 1
 /*merge verts
  
   vtargetmap is a table that maps vertices to target vertices.  a value of -1
   indicates a vertex is a target, and is to be kept.
   
+  this frees dm, and returns a new one.
+  
   this is a really horribly written function.  ger. - joeedh
 
  */
@@ -2304,96 +2303,20 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
        BLI_array_declare(mpoly);
        MLoop *ml, *mloop = NULL;
        BLI_array_declare(mloop);
-       SmallHash _hash, *hash=&_hash;
-       SmallHash _hash2, *hash2=&_hash2;
+       EdgeHash *ehash = BLI_edgehash_new();
        int *newv = NULL, *newe = NULL, *newl = NULL;
        int *oldv = NULL, *olde = NULL, *oldl = NULL, *oldp = NULL;
        BLI_array_declare(oldv); BLI_array_declare(olde); BLI_array_declare(oldl); BLI_array_declare(oldp);
        int i, j, c, totloop, totpoly;
        
-       BLI_smallhash_init(hash);
-       BLI_smallhash_init(hash2);
-
-#if 0
-       /*split off ngon faces with merges in them*/
-       mp = cddm->mpoly;
-       for (i=0; i<dm->numPolyData; i++, mp++) {
-               ml = cddm->mloop + mp->loopstart;
-               for (j=0; j<mp->totloop; j++, ml++) {
-                       MLoop *ml2 = NULL;
-                       int k, k1, a;
-                       
-                       if (ml->v == -1)
-                               continue;
-                       
-                       for (k1=0; k1<mp->totloop; k1++) {
-                               k = (j + k1) % mp->totloop;
-                               ml2 = cddm->mloop + mp->loopstart + k;
-                               
-                               if (ml == ml2 || ml2->v == -1)
-                                       continue;
-                               
-                               if (vtargetmap[ml->v] == ml2->v || vtargetmap[ml2->v] == ml->v) {
-                                       MLoop *ml3;
-                                       MPoly *mp2;
-                                       int s, e, l, tot;
-                                       
-                                       if (k < j) 
-                                               SWAP(int, k, j);
-                                       
-                                       s = j; e = k; tot = 0;
-                                       l = BLI_array_count(mloop);
-                                       ml3 = cddm->mloop + mp->loopstart + s;
-                                       for (a=s; a<e; a++, ml3++) {
-                                               if (ml3->v == -1)
-                                                       continue;
-                                               
-                                               BLI_smallhash_insert(hash, dm->numLoopData + BLI_array_count(mloop), SET_INT_IN_POINTER(mp->loopstart + a - s));
-                                               BLI_array_append(mloop, *ml3);
-                                               
-                                               ml3->v = -1;
-                                               ml3->e = -1;
-                                               tot++;
-                                       }
-                                       
-                                       if (!tot)
-                                               continue;
-                                       
-                                       BLI_smallhash_insert(hash2, dm->numPolyData + BLI_array_count(mpoly), SET_INT_IN_POINTER(i));
-       
-                                       mp2 = BLI_array_append(mpoly, *mp);
-                                       mp2->loopstart = l + dm->numLoopData;
-                                       mp2->totloop = tot;
-                               }
-                       }
-               }
-       }
-
-       ml = MEM_callocN(sizeof(MLoop)*(dm->numLoopData + BLI_array_count(mloop)), "merge mloop");
-       mp = MEM_callocN(sizeof(MPoly)*(dm->numPolyData + BLI_array_count(mloop)), "merge mpoly");
-       
-       memcpy(ml, cddm->mloop, sizeof(MLoop)*dm->numLoopData);
-       memcpy(mp, cddm->mpoly, sizeof(MPoly)*dm->numPolyData);
-       
-       cddm->mloop = ml; cddm->mpoly = mp;
-       
-       memcpy(cddm->mloop+dm->numLoopData, mloop, sizeof(MLoop)*BLI_array_count(mloop));
-       memcpy(cddm->mpoly+dm->numPolyData, mpoly, sizeof(MPoly)*BLI_array_count(mpoly));
-       
-       totloop = dm->numLoopData + BLI_array_count(mloop);
-       totpoly = dm->numPolyData + BLI_array_count(mpoly);
-       
-       BLI_array_empty(mloop);
-       BLI_array_empty(mpoly);
-#else
        totloop = dm->numLoopData;
        totpoly = dm->numPolyData;
-#endif
        
        newv = MEM_callocN(sizeof(int)*dm->numVertData, "newv vtable CDDM_merge_verts");
        newe = MEM_callocN(sizeof(int)*dm->numEdgeData, "newv etable CDDM_merge_verts");
        newl = MEM_callocN(sizeof(int)*totloop, "newv ltable CDDM_merge_verts");
-               
+       
+       /*fill newl with destination vertex indices*/
        mv = cddm->mvert;
        c = 0;
        for (i=0; i<dm->numVertData; i++, mv++) {
@@ -2404,6 +2327,13 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
                }
        }
        
+       /*now link target vertices to destination indices*/
+       for (i=0; i<dm->numVertData; i++) {
+               if (vtargetmap[i] != -1) {
+                       newv[i] = newv[vtargetmap[i]];
+               }
+       }
+       
        /*find-replace merged vertices with target vertices*/   
        ml = cddm->mloop;
        c = 0;
@@ -2426,12 +2356,32 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
        me = cddm->medge;
        c = 0;
        for (i=0; i<dm->numEdgeData; i++, me++) {
-               if (me->v1 == me->v2)
+               int v1, v2;
+               
+               if (me->v1 == me->v2) {
+                       newe[i] = -1;
                        continue;
+               }
                
-               BLI_array_append(olde, i);
-               newe[i] = c++;
-               BLI_array_append(medge, *me);
+               if (vtargetmap[me->v1] != -1)
+                       v1 = vtargetmap[me->v1];
+               else
+                       v1 = me->v1;
+               
+               if (vtargetmap[me->v2] != -1)
+                       v2 = vtargetmap[me->v2];
+               else
+                       v2 = me->v2;
+               
+               if (BLI_edgehash_haskey(ehash, v1, v2)) {
+                       newe[i] = GET_INT_FROM_POINTER(BLI_edgehash_lookup(ehash, v1, v2));
+               } else {
+                       BLI_array_append(olde, i);
+                       newe[i] = c;
+                       BLI_array_append(medge, *me);
+                       BLI_edgehash_insert(ehash, v1, v2, SET_INT_IN_POINTER(c));
+                       c++;
+               }
        }
        
        mp = cddm->mpoly;
@@ -2447,9 +2397,9 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
                        
                        me = cddm->medge + ml->e;
                        if (me->v1 != me->v2) {
-                               BLI_array_append(oldl, j);
+                               BLI_array_append(oldl, j+mp->loopstart);
                                BLI_array_append(mloop, *ml);
-                               newl[c] = BLI_array_count(mloop)-1;
+                               newl[j+mp->loopstart] = BLI_array_count(mloop)-1;
                                c++;
                        }
                }
@@ -2467,69 +2417,48 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
        /*create new cddm*/     
        cddm2 = (CDDerivedMesh*) CDDM_new(BLI_array_count(mvert), BLI_array_count(medge), 0, BLI_array_count(mloop), BLI_array_count(mpoly));
        
-       /*copy over data.  CustomData_add_layer can do this, need to look it up.*/
-       memcpy(cddm2->mvert, mvert, sizeof(MVert)*BLI_array_count(mvert));
-       memcpy(cddm2->medge, medge, sizeof(MEdge)*BLI_array_count(medge));
-       memcpy(cddm2->mloop, mloop, sizeof(MLoop)*BLI_array_count(mloop));
-       memcpy(cddm2->mpoly, mpoly, sizeof(MPoly)*BLI_array_count(mpoly));
-       
-       BLI_array_free(mvert); BLI_array_free(medge); BLI_array_free(mloop); BLI_array_free(mpoly);
-       mvert = cddm2->mvert; medge = cddm2->medge; mloop = cddm2->mloop; mpoly = cddm2->mpoly;
-       
        /*update edge indices and copy customdata*/
-       me = cddm2->medge;
+       me = medge;
        for (i=0; i<cddm2->dm.numEdgeData; i++, me++) {
-               MEdge cpy;
+               if (newv[me->v1] != -1)
+                       me->v1 = newv[me->v1];
+               if (newv[me->v2] != -1)
+                       me->v2 = newv[me->v2];
                
-               me->v1 = newv[me->v1];
-               me->v2 = newv[me->v2];
-               
-               cpy = *me;
                CustomData_copy_data(&dm->edgeData, &cddm2->dm.edgeData, olde[i], i, 1);
-               *me = cpy;
        }
        
        /*update loop indices and copy customdata*/
-       ml = cddm2->mloop;
+       ml = mloop;
        for (i=0; i<cddm2->dm.numLoopData; i++, ml++) {
-               MLoop cpy;
-               
-               ml->e = newe[ml->e];
-               ml->v = newv[ml->v];
+               if (newe[ml->e] != -1)
+                       ml->e = newe[ml->e];
+               if (newv[ml->v] != -1)
+                       ml->v = newv[ml->v];
                        
-               cpy = *ml;
-               
-               if (oldl[i] >= dm->numLoopData)
-                       oldl[i] = GET_INT_FROM_POINTER(BLI_smallhash_lookup(hash, (intptr_t)oldl[i]));
-
                CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1);
-               *ml = cpy;
        }
        
        /*copy vertex customdata*/      
-       mv = cddm2->mvert;
+       mv = mvert;
        for (i=0; i<cddm2->dm.numVertData; i++, mv++) {
-               MVert cpy = *mv;
-               
                CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1);
-               *mv = cpy;
        }
        
        /*copy poly customdata*/
-       mp = cddm2->mpoly;
+       mp = mpoly;
        for (i=0; i<cddm2->dm.numPolyData; i++, mp++) {
-               MPoly cpy = *mp;
-               
-               if (oldl[i] >= dm->numPolyData)
-                       oldl[i] = GET_INT_FROM_POINTER(BLI_smallhash_lookup(hash, (intptr_t)oldl[i]));
-
                CustomData_copy_data(&dm->polyData, &cddm2->dm.polyData, oldp[i], i, 1);
-               *mp = cpy;
        }
        
-       /*eek! not sure what to do with ORIGINDEX stuff here!!*/        
-       cddm2->dm.numFaceData = mesh_recalcTesselation(&cddm2->dm.faceData, &cddm2->dm.loopData, &cddm2->dm.polyData, cddm2->mvert, 0, cddm2->dm.numLoopData, cddm2->dm.numPolyData, 1, 0);
-       cddm2->mface = CustomData_get_layer(&cddm->dm.faceData, CD_MFACE);
+       /*copy over data.  CustomData_add_layer can do this, need to look it up.*/
+       memcpy(cddm2->mvert, mvert, sizeof(MVert)*BLI_array_count(mvert));
+       memcpy(cddm2->medge, medge, sizeof(MEdge)*BLI_array_count(medge));
+       memcpy(cddm2->mloop, mloop, sizeof(MLoop)*BLI_array_count(mloop));
+       memcpy(cddm2->mpoly, mpoly, sizeof(MPoly)*BLI_array_count(mpoly));
+       BLI_array_free(mvert); BLI_array_free(medge); BLI_array_free(mloop); BLI_array_free(mpoly);
+
+       CDDM_recalc_tesselation(cddm2);
        
        if (newv) 
                MEM_freeN(newv); 
@@ -2545,10 +2474,10 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap)
                MEM_freeN(oldl); 
        if (oldp) 
                MEM_freeN(oldp);
-       
-       BLI_smallhash_release(hash);
-       BLI_smallhash_release(hash2);
-       
+       if (ehash)
+               BLI_edgehash_free(ehash, NULL);
+
+       /*free old derivedmesh*/
        dm->needsFree = 1;
        dm->release(dm);
        
@@ -2743,6 +2672,11 @@ MFace *CDDM_get_tessfaces(DerivedMesh *dm)
        return ((CDDerivedMesh*)dm)->mface;
 }
 
+MLoop *CDDM_get_loops(DerivedMesh *dm)
+{
+       return ((CDDerivedMesh*)dm)->mloop;
+}
+
 MPoly *CDDM_get_polys(DerivedMesh *dm)
 {
        return ((CDDerivedMesh*)dm)->mpoly;
index f5a276aeadc916f5abd9bdf4b25bb2b43614af14..8ed1bcc1b4544c3416aef340aabded5dbd464976 100644 (file)
@@ -529,7 +529,7 @@ static DerivedMesh *applyModifier(
 }
 
 static DerivedMesh *applyModifierEM(
-               ModifierData *md, Object *ob, struct EditMesh *editData,
+               ModifierData *md, Object *ob, struct BMEditMesh *editData,
   DerivedMesh *derivedData)
 {
        return applyModifier(md, ob, derivedData, 0, 1);
@@ -560,6 +560,7 @@ ModifierTypeInfo modifierType_Array = {
        /* isDisabled */        0,
        /* updateDepgraph */    updateDepgraph,
        /* dependsOnTime */     0,
+       /* dependsOnNormal */   0,      
        /* foreachObjectLink */ foreachObjectLink,
        /* foreachIDLink */     0,
 };
index 4549448f45ea22152acea73d29e3846a48497d55..bbb314cc085fec292e3a645b20d3fcfae6d0f196 100644 (file)
@@ -459,6 +459,7 @@ ModifierTypeInfo modifierType_EdgeSplit = {
        /* isDisabled */        0,
        /* updateDepgraph */    0,
        /* dependsOnTime */     0,
+       /* dependsOnNormal */     0,
        /* foreachObjectLink */ 0,
        /* foreachIDLink */     0,
 };
index 2540a1e3b3b64a91a1aa791971484230a55655c8..a4ab28a6d7c96de3636487938e57963a842eb21e 100644 (file)
@@ -34,6 +34,8 @@
 #include "DNA_object_types.h"
 
 #include "BLI_math.h"
+#include "BLI_smallhash.h"
+#include "BLI_array.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_mesh.h"
@@ -76,8 +78,8 @@ static void foreachObjectLink(
                walk(userData, ob, &mmd->mirror_ob);
 }
 
-static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *scene,
-                                         Object *ob, DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UNUSED(scene),
+                                         Object *UNUSED(ob), DagNode *obNode)
 {
        MirrorModifierData *mmd = (MirrorModifierData*) md;
 
@@ -97,29 +99,26 @@ void vertgroup_flip_name (char *name, int strip_number);
 DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
                Object *ob,
                DerivedMesh *dm,
-               int initFlags,
+               int UNUSED(initFlags),
                int axis)
 {
        float tolerance = mmd->tolerance;
-       DerivedMesh *result, *cddm;
-       BMEditMesh *em;
-       BMesh *bm;
-       BMOIter siter1;
-       BMOperator op;
-       BMVert *v1;
-       BMIter iter;
+       DerivedMesh *cddm, *origdm;
        bDeformGroup *def, *defb;
        bDeformGroup **vector_def = NULL;
+       MVert *mv;
+       MEdge *me;
+       MLoop *ml;
+       MPoly *mp;
        float mtx[4][4], imtx[4][4];
-       int j;
+       int i, j, *vtargetmap = NULL;
+       BLI_array_declare(vtargetmap);
        int vector_size=0, a, b;
-
-       cddm = dm; //copying shouldn't be necassary here, as all modifiers return CDDM's
-       em = CDDM_To_BMesh(dm, NULL);
-
-       /*convienence variable*/
-       bm = em->bm;
-
+       
+       origdm = dm;
+       if (!CDDM_Check(dm))
+               dm = CDDM_copy(dm, 0);
+       
        if (mmd->flag & MOD_MIR_VGROUP) {
                /* calculate the number of deformedGroups */
                for(vector_size = 0, def = ob->defbase.first; def;
@@ -142,56 +141,100 @@ DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
        } else {
                unit_m4(mtx);
        }
+       
+       cddm = CDDM_from_template(dm, dm->numVertData*2, dm->numEdgeData*2, 0, dm->numLoopData*2, dm->numPolyData*2);
+       
+       /*copy customdata to original geometry*/
+       CustomData_copy_data(&dm->vertData, &cddm->vertData, 0, 0, dm->numVertData);
+       CustomData_copy_data(&dm->edgeData, &cddm->edgeData, 0, 0, dm->numEdgeData);
+       CustomData_copy_data(&dm->loopData, &cddm->loopData, 0, 0, dm->numLoopData);
+       CustomData_copy_data(&dm->polyData, &cddm->polyData, 0, 0, dm->numPolyData);
+
+       /*copy customdata to new geometry*/
+       CustomData_copy_data(&dm->vertData, &cddm->vertData, 0, dm->numVertData, dm->numVertData);
+       CustomData_copy_data(&dm->edgeData, &cddm->edgeData, 0, dm->numEdgeData, dm->numEdgeData);
+       CustomData_copy_data(&dm->polyData, &cddm->polyData, 0, dm->numPolyData, dm->numPolyData);
+       
+       /*mirror vertex coordinates*/
+       mv = CDDM_get_verts(cddm) + dm->numVertData;
+       for (i=0; i<dm->numVertData; i++, mv++) {
+               mv->co[axis] = -mv->co[axis];
+               if (fabs(mv->co[axis]) < tolerance) {
+                       BLI_array_append(vtargetmap, i+dm->numVertData);
+               } else BLI_array_append(vtargetmap, -1);
+       }
+       
+       for (i=0; i<dm->numVertData; i++) {
+               BLI_array_append(vtargetmap, -1);
+       }
+       
+       /*adjust mirrored edge vertex indices*/
+       me = CDDM_get_edges(cddm) + dm->numEdgeData;
+       for (i=0; i<dm->numEdgeData; i++, me++) {
+               me->v1 += dm->numVertData;
+               me->v2 += dm->numVertData;
+       }
+       
+       /*adjust mirrored poly loopstart indices, and reverse loop order (normals)*/    
+       mp = CDDM_get_polys(cddm) + dm->numPolyData;
+       for (i=0; i<dm->numPolyData; i++, mp++) {
+               for (j=0; j<mp->totloop; j++) {
+                       CustomData_copy_data(&dm->loopData, &cddm->loopData, mp->loopstart+j,
+                                                                mp->loopstart+dm->numLoopData+mp->totloop-j-1, 1);
+               }
 
-       BMO_InitOpf(bm, &op, "mirror geom=%avef mat=%m4 mergedist=%f axis=%d",
-                               mtx, mmd->tolerance, axis);
+               mp->loopstart += dm->numLoopData;
+       }
 
-       BMO_Exec_Op(bm, &op);
+       /*adjust mirrored loop vertex and edge indices*/        
+       ml = CDDM_get_loops(cddm) + dm->numLoopData;
+       for (i=0; i<dm->numLoopData; i++, ml++) {
+               ml->v += dm->numVertData;
+               ml->e += dm->numEdgeData;
+       }
 
-       BMO_CallOpf(bm, "reversefaces faces=%s", &op, "newout");
+       CDDM_recalc_tesselation(cddm);
        
        /*handle vgroup stuff*/
-       if (mmd->flag & MOD_MIR_VGROUP) {
-               BMO_ITER(v1, &siter1, bm, &op, "newout", BM_VERT) {
-                       MDeformVert *dvert = CustomData_bmesh_get(&bm->vdata, v1->head.data, CD_MDEFORMVERT);
-
-                       if (dvert) {
-                               for(j = 0; j < dvert[0].totweight; ++j) {
-                                       char tmpname[32];
-
-                                       if(dvert->dw[j].def_nr < 0 ||
-                                          dvert->dw[j].def_nr >= vector_size)
-                                               continue;
-
-                                       def = vector_def[dvert->dw[j].def_nr];
-                                       strcpy(tmpname, def->name);
-                                       vertgroup_flip_name(tmpname,0);
-
-                                       for(b = 0, defb = ob->defbase.first; defb;
-                                               defb = defb->next, b++)
+       if ((mmd->flag & MOD_MIR_VGROUP) && CustomData_has_layer(&cddm->vertData, CD_MDEFORMVERT)) {
+               MDeformVert *dvert = CustomData_get_layer(&cddm->vertData, CD_MDEFORMVERT);
+               
+               for (i=0; i<dm->numVertData; i++, dvert++) {
+                       for(j = 0; j < dvert->totweight; ++j) {
+                               char tmpname[32];
+
+                               if(dvert->dw[j].def_nr < 0 ||
+                                  dvert->dw[j].def_nr >= vector_size)
+                                       continue;
+
+                               def = vector_def[dvert->dw[j].def_nr];
+                               strcpy(tmpname, def->name);
+                               vertgroup_flip_name(tmpname,0);
+
+                               for(b = 0, defb = ob->defbase.first; defb;
+                                       defb = defb->next, b++)
+                               {
+                                       if(!strcmp(defb->name, tmpname))
                                        {
-                                               if(!strcmp(defb->name, tmpname))
-                                               {
-                                                       dvert->dw[j].def_nr = b;
-                                                       break;
-                                               }
+                                               dvert->dw[j].def_nr = b;
+                                               break;
                                        }
                                }
                        }
                }
        }
-
-       BMO_Finish_Op(bm, &op);
-
+       
+       cddm = CDDM_merge_verts(cddm, vtargetmap);
+       BLI_array_free(vtargetmap);
+       
        if (vector_def) MEM_freeN(vector_def);
        
-       BMEdit_RecalcTesselation(em);
-       result = CDDM_from_BMEditMesh(em, NULL);
-
-       BMEdit_Free(em);
-       MEM_freeN(em);
+       if (dm != origdm) {
+               dm->needsFree = 1;
+               dm->release(dm);
+       }
        
-       return result;
+       return cddm;
 }
 
 static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
@@ -220,7 +263,7 @@ static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
 
 static DerivedMesh *applyModifier(
                ModifierData *md, Object *ob, DerivedMesh *derivedData,
-  int useRenderParams, int isFinalCalc)
+  int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
 {
        DerivedMesh *result;
        MirrorModifierData *mmd = (MirrorModifierData*) md;
@@ -234,7 +277,7 @@ static DerivedMesh *applyModifier(
 }
 
 static DerivedMesh *applyModifierEM(
-               ModifierData *md, Object *ob, struct BMEditMesh *editData,
+               ModifierData *md, Object *ob, struct BMEditMesh *UNUSED(editData),
   DerivedMesh *derivedData)
 {
        return applyModifier(md, ob, derivedData, 0, 1);
@@ -254,8 +297,8 @@ ModifierTypeInfo modifierType_Mirror = {
 
        /* copyData */          copyData,
        /* deformVerts */       0,
-       /* deformVertsEM */     0,
        /* deformMatrices */    0,
+       /* deformVertsEM */     0,
        /* deformMatricesEM */  0,
        /* applyModifier */     applyModifier,
        /* applyModifierEM */   applyModifierEM,
@@ -265,6 +308,7 @@ ModifierTypeInfo modifierType_Mirror = {
        /* isDisabled */        0,
        /* updateDepgraph */    updateDepgraph,
        /* dependsOnTime */     0,
+       /* dependsOnNormal */     0,
        /* foreachObjectLink */ foreachObjectLink,
        /* foreachIDLink */     0,
 };
index 669c6541bc5cc09be588353971cb87f96c8f6ecd..4f59467a9d6340eaa9740254a8b0dddb1fa2b72d 100644 (file)
@@ -353,10 +353,6 @@ typedef struct {
 } PyModuleObject;
 #endif
 
-int PyC_MainModule_Backup(PyObject **main_mod);
-PyObject *PyC_DefaultNameSpace(const char *n);
-int PyC_MainModule_Restore(PyObject *main_mod);
-
 static int python_script_exec(bContext *C, const char *fn, struct Text *text, struct ReportList *reports)
 {
        PyObject *main_mod= NULL;
index d3bda0e2a5f6f377d85f24250f39d949fe08f806..f18b1aee5abe9dad224ac3806ce2c077064c7506 100644 (file)
@@ -1116,8 +1116,6 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                        int subtype= RNA_property_subtype(prop);
                        if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
                                /* TODO, get size */
-                               PyObject *PyC_UnicodeAsByte(PyObject *value, PyObject **value_coerce);
-
                                param= PyC_UnicodeAsByte(value, &value_coerce);
                        }
                        else {