diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-13 08:14:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-13 08:14:35 +0400 |
commit | 2d1a05874b46d31ee3598ec786a77b45512d99e1 (patch) | |
tree | f0c453f231b52b5898911f77365d908145da8460 /source/blender/modifiers | |
parent | 7be1cd733dfe064d1976b706610c39f97e536b90 (diff) | |
parent | 399ad54204ad9c3bc9dbd15ec4840824d224dc0c (diff) |
svn merge ^/trunk/blender -r44024:44076
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_explode.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index afbc7e2a046..afcfcc396ee 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -795,8 +795,8 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, float cfra; /* float timestep; */ int *facepa=emd->facepa; - int totdup=0,totvert=0,totface=0,totpart=0; - int i, v; + int totdup=0,totvert=0,totface=0,totpart=0,delface=0; + int i, v, u; unsigned int ed_v1, ed_v2, mindex=0; MTFace *mtface = NULL, *mtf; @@ -818,6 +818,18 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, vertpahash= BLI_edgehash_new(); for (i=0; i<totface; i++) { + if(facepa[i]!=totpart) + { + pa=pars+facepa[i]; + + if((pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) + || (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) + || (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0)) { + delface++; + continue; + } + } + /* do mindex + totvert to ensure the vertex index to be the first * with BLI_edgehashIterator_getKey */ if(facepa[i]==totpart || cfra < (pars+facepa[i])->time) @@ -844,7 +856,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, BLI_edgehashIterator_free(ehi); /* the final duplicated vertices */ - explode= CDDM_from_template(dm, totdup, 0,totface, 0, 0); + explode= CDDM_from_template(dm, totdup, 0,totface-delface, 0, 0); mtface = CustomData_get_layer_named(&explode->faceData, CD_MTFACE, emd->uvname); /*dupvert= CDDM_get_verts(explode);*/ @@ -899,7 +911,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, BLI_edgehashIterator_free(ehi); /*map new vertices to faces*/ - for (i=0; i<totface; i++) { + for (i=0,u=0; i<totface; i++) { MFace source; int orig_v4; @@ -913,7 +925,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, } dm->getTessFace(dm,i,&source); - mf=CDDM_get_tessface(explode,i); + mf=CDDM_get_tessface(explode,u); orig_v4 = source.v4; @@ -928,7 +940,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, if(source.v4) source.v4 = edgecut_get(vertpahash, source.v4, mindex); - DM_copy_tessface_data(dm,explode,i,i,1); + DM_copy_tessface_data(dm,explode,i,u,1); *mf = source; @@ -938,13 +950,14 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, /* Clamp to this range to avoid flipping to the other side of the coordinates. */ CLAMP(age, 0.001f, 0.999f); - mtf = mtface + i; + mtf = mtface + u; mtf->uv[0][0] = mtf->uv[1][0] = mtf->uv[2][0] = mtf->uv[3][0] = age; mtf->uv[0][1] = mtf->uv[1][1] = mtf->uv[2][1] = mtf->uv[3][1] = 0.5f; } - test_index_face(mf, &explode->faceData, i, (orig_v4 ? 4 : 3)); + test_index_face(mf, &explode->faceData, u, (orig_v4 ? 4 : 3)); + u++; } /* cleanup */ |