merge with trunk at r27259 and commit of a patch by anthony jones to fix msvc (though...
[blender-staging.git] / source / blender / blenkernel / intern / particle_system.c
index 9b1d48ac8c3ef715bb69b1d58b2b89c98779d016..b057976e3b5902b6c612db02622debb97e9f22e9 100644 (file)
@@ -304,9 +304,9 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
                        origindex= dm->getVertDataArray(dm, CD_ORIGINDEX);
                }
                else { /* FROM_FACE/FROM_VOLUME */
-                       totdmelem= dm->getNumFaces(dm);
+                       totdmelem= dm->getNumTessFaces(dm);
                        totelem= me->totface;
-                       origindex= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+                       origindex= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
                }
        
                nodedmelem= MEM_callocN(sizeof(LinkNode)*totdmelem, "psys node elems");
@@ -436,8 +436,8 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys)
                int a, a1, a2, a0mul, a1mul, a2mul, totface;
                int amax= from==PART_FROM_FACE ? 3 : 1;
 
-               totface=dm->getNumFaces(dm);
-               mface=dm->getFaceDataArray(dm,CD_MFACE);
+               totface=dm->getNumTessFaces(dm);
+               mface=dm->getTessFaceDataArray(dm,CD_MFACE);
                
                for(a=0; a<amax; a++){
                        if(a==0){ a0mul=res*res; a1mul=res; a2mul=1; }
@@ -446,7 +446,7 @@ static void distribute_particles_in_grid(DerivedMesh *dm, ParticleSystem *psys)
 
                        for(a1=0; a1<size[(a+1)%3]; a1++){
                                for(a2=0; a2<size[(a+2)%3]; a2++){
-                                       mface=dm->getFaceDataArray(dm,CD_MFACE);
+                                       mface=dm->getTessFaceDataArray(dm,CD_MFACE);
 
                                        pa=psys->particles + a1*a1mul + a2*a2mul;
                                        VECCOPY(co1,pa->fuv);
@@ -659,7 +659,7 @@ static void psys_thread_distribute_particle(ParticleThread *thread, ParticleData
                MFace *mface;
 
                pa->num = i = ctx->index[p];
-               mface = dm->getFaceData(dm,i,CD_MFACE);
+               mface = dm->getTessFaceData(dm,i,CD_MFACE);
                
                switch(distr){
                case PART_DISTR_JIT:
@@ -679,7 +679,7 @@ static void psys_thread_distribute_particle(ParticleThread *thread, ParticleData
                if(from==PART_FROM_VOLUME){
                        MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
 
-                       tot=dm->getNumFaces(dm);
+                       tot=dm->getNumTessFaces(dm);
 
                        psys_interpolate_face(mvert,mface,0,0,pa->fuv,co1,nor,0,0,0,0);
 
@@ -691,7 +691,7 @@ static void psys_thread_distribute_particle(ParticleThread *thread, ParticleData
                        min_d=2.0;
                        intersect=0;
 
-                       for(i=0,mface=dm->getFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++){
+                       for(i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++){
                                if(i==pa->num) continue;
 
                                v1=mvert[mface->v1].co;
@@ -748,7 +748,7 @@ static void psys_thread_distribute_particle(ParticleThread *thread, ParticleData
                        return;
                }
 
-               mf= dm->getFaceData(dm, ctx->index[p], CD_MFACE);
+               mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE);
 
                randu= rng_getFloat(thread->rng);
                randv= rng_getFloat(thread->rng);
@@ -962,7 +962,7 @@ static int psys_threads_init_distribution(ParticleThread *threads, Scene *scene,
        if(totpart==0)
                return 0;
 
-       if (!finaldm->deformedOnly && !finaldm->getFaceDataArray(finaldm, CD_ORIGINDEX)) {
+       if (!finaldm->deformedOnly && !finaldm->getTessFaceDataArray(finaldm, CD_ORIGINDEX)) {
                printf("Can't create particles with the current modifier stack, disable destructive modifiers\n");
 // XXX         error("Can't paint with the current modifier stack, disable destructive modifiers");
                return 0;
@@ -1105,7 +1105,7 @@ static int psys_threads_init_distribution(ParticleThread *threads, Scene *scene,
                        break;
                case PART_FROM_VOLUME:
                case PART_FROM_FACE:
-                       tot = dm->getNumFaces(dm);
+                       tot = dm->getNumTessFaces(dm);
                        break;
                case PART_FROM_PARTICLE:
                        if(psys->target_ob)
@@ -1165,7 +1165,7 @@ static int psys_threads_init_distribution(ParticleThread *threads, Scene *scene,
                orcodata= dm->getVertDataArray(dm, CD_ORCO);
 
                for(i=0; i<tot; i++){
-                       MFace *mf=dm->getFaceData(dm,i,CD_MFACE);
+                       MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
 
                        if(orcodata) {
                                VECCOPY(co1, orcodata[mf->v1]);
@@ -1234,7 +1234,7 @@ static int psys_threads_init_distribution(ParticleThread *threads, Scene *scene,
                        }
                        else { /* PART_FROM_FACE / PART_FROM_VOLUME */
                                for(i=0;i<tot; i++){
-                                       MFace *mf=dm->getFaceData(dm,i,CD_MFACE);
+                                       MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
                                        tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
                                
                                        if(mf->v4) {
@@ -1309,7 +1309,7 @@ static int psys_threads_init_distribution(ParticleThread *threads, Scene *scene,
                        }
                        else {
                                if(dm->numFaceData)
-                                       COMPARE_ORIG_INDEX= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+                                       COMPARE_ORIG_INDEX= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
                        }
 
                        if(COMPARE_ORIG_INDEX) {
@@ -2539,8 +2539,8 @@ int psys_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, float *vert_cos
                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 */
@@ -3019,7 +3019,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
        }
 
        if(!dm) {
-               dm = psys->hair_in_dm = CDDM_new(totpoint, totedge, 0);
+               dm = psys->hair_in_dm = CDDM_new(totpoint, totedge, 0, 0, 0);
                DM_add_vert_layer(dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
        }