fix for bug where particle system would fail when the original mesh had no tessface's
authorCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 17:44:36 +0000 (17:44 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 19 Feb 2012 17:44:36 +0000 (17:44 +0000)
source/blender/blenkernel/intern/particle.c

index e4afff5380ba56795b2d2a5e56bbb5f85b27c198..38a73daab2a5b1479f4b1068ac5f29d8b43992ca 100644 (file)
@@ -806,7 +806,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
        mface= dm->getTessFaceArray(dm);
        origindex= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
        totface= dm->getNumTessFaces(dm);
-       totorigface= me->totface;
+       totorigface= me->totpoly;
 
        if(totface == 0 || totorigface == 0)
                return tot;
@@ -2937,6 +2937,11 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
                        vg_length = psys_cache_vgroup(psmd->dm, psys, PSYS_VG_LENGTH);
        }
 
+       /* ensure we have tessfaces to be used for mapping */
+       if (part->from != PART_FROM_VERT) {
+               DM_ensure_tessface(psmd->dm);
+       }
+
        /*---first main loop: create all actual particles' paths---*/
        LOOP_SHOWN_PARTICLES {
                if(!psys->totchild) {