svn merge -r36603:36651 https://svn.blender.org/svnroot/bf-blender/trunk/blender...
[blender.git] / source / blender / editors / physics / particle_edit.c
index f4f66c174590dd5d87cab148c9a307ccb0830212..15986fad3d80994235fb9180b5e7859ac44af866 100644 (file)
@@ -1056,7 +1056,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
 
        BLI_kdtree_free(edit->emitter_field);
 
-       totface=dm->getNumFaces(dm);
+       totface=dm->getNumTessFaces(dm);
        /*totvert=dm->getNumVerts(dm);*/ /*UNSUED*/
 
        edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float),"emitter cosnos");
@@ -1067,7 +1067,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
        nor=vec+3;
 
        for(i=0; i<totface; i++, vec+=6, nor+=6) {
-               MFace *mface=dm->getFaceData(dm,i,CD_MFACE);
+               MFace *mface=dm->getTessFaceData(dm,i,CD_MFACE);
                MVert *mvert;
 
                mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
@@ -2598,7 +2598,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
        PTCacheEditPoint *newpoint, *new_points;
        POINT_P; KEY_K;
        HairKey *hkey;
-       int *mirrorfaces;
+       int *mirrorfaces = NULL;
        int rotation, totpart, newtotpart;
 
        if(psys->flag & PSYS_GLOBAL_HAIR)
@@ -2608,7 +2608,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
        if(!psmd->dm)
                return;
 
-       mirrorfaces= mesh_get_x_mirror_faces(ob, NULL);
+       //BMESH_TODO mirrorfaces= mesh_get_x_mirror_faces(ob, NULL);
 
        if(!edit->mirror_cache)
                PE_update_mirror_cache(ob, psys);
@@ -2629,7 +2629,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
                        }
                }
 
-               if((point->flag & PEP_TAG) && mirrorfaces[pa->num*2] != -1)
+               if((point->flag & PEP_TAG) && mirrorfaces && mirrorfaces[pa->num*2] != -1)
                        newtotpart++;
        }
 
@@ -2666,7 +2666,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 
                        if(point->flag & PEP_HIDE)
                                continue;
-                       if(!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
+                       if(!(point->flag & PEP_TAG) || (mirrorfaces && mirrorfaces[pa->num*2] == -1))
                                continue;
 
                        /* duplicate */
@@ -2676,7 +2676,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
                        if(point->keys) newpoint->keys= MEM_dupallocN(point->keys);
 
                        /* rotate weights according to vertex index rotation */
-                       rotation= mirrorfaces[pa->num*2+1];
+                       rotation= mirrorfaces ? mirrorfaces[pa->num*2+1] : 0;
                        newpa->fuv[0]= pa->fuv[2];
                        newpa->fuv[1]= pa->fuv[1];
                        newpa->fuv[2]= pa->fuv[0];
@@ -2688,7 +2688,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
                                        SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2])
 
                        /* assign face inddex */
-                       newpa->num= mirrorfaces[pa->num*2];
+                                       newpa->num= mirrorfaces ? mirrorfaces[pa->num*2] : 0;
                        newpa->num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,newpa->num,newpa->fuv, NULL);
 
                        /* update edit key pointers */
@@ -2710,7 +2710,8 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
                point->flag &= ~PEP_TAG;
        }
 
-       MEM_freeN(mirrorfaces);
+       if (mirrorfaces)
+               MEM_freeN(mirrorfaces);
 }
 
 static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3110,8 +3111,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
                VECCOPY(p_max,pa_minmax+3);
        }
 
-       totface=dm->getNumFaces(dm);
-       mface=dm->getFaceDataArray(dm,CD_MFACE);
+       totface=dm->getNumTessFaces(dm);
+       mface=dm->getTessFaceDataArray(dm,CD_MFACE);
        mvert=dm->getVertDataArray(dm,CD_MVERT);
        
        /* lets intersect the faces */