[#18277] Segfault crash by editing mesh with subsurf+ParticleInstance modifiers
authorAndre Susano Pinto <andresusanopinto@gmail.com>
Sat, 21 Feb 2009 12:15:57 +0000 (12:15 +0000)
committerAndre Susano Pinto <andresusanopinto@gmail.com>
Sat, 21 Feb 2009 12:15:57 +0000 (12:15 +0000)
particleInstanceModifier_applyModifier uses getVertCo,which is not implemented by ccgDM.

getVertCo was used to simply perform a min/max, so it was fixed to use the apropriate min/max
dm->getMinMax(dm, min_r, max_r);

Maybe the fact ccgDM doesn't implements getVertCo/getVertNo is a bug, since it implements every
other DM function and its strange those are left out.

source/blender/blenkernel/intern/modifier.c

index 6bdd395a2ac1f22d1c737b6d7bb20f8fdcb00f5d..566a139f72c406f8f7dd61c337f640ad67a6e61c 100644 (file)
@@ -6380,20 +6380,11 @@ static DerivedMesh * particleInstanceModifier_applyModifier(
        psys->lattice=psys_get_lattice(ob, psys);
 
        if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED)){
-               float co[3];
-               for(i=0; i< totvert; i++){
-                       dm->getVertCo(dm,i,co);
-                       if(i==0){
-                               min_co=max_co=co[track];
-                       }
-                       else{
-                               if(co[track]<min_co)
-                                       min_co=co[track];
 
-                               if(co[track]>max_co)
-                                       max_co=co[track];
-                       }
-               }
+               float min_r[3], max_r[3];
+               dm->getMinMax(dm, min_r, max_r);                
+               min_co=min_r[track];
+               max_co=max_r[track];
        }
 
        result = CDDM_from_template(dm, maxvert,dm->getNumEdges(dm)*totpart,maxface);