diff options
author | Ben Batt <benbatt@gmail.com> | 2006-08-13 18:59:05 +0400 |
---|---|---|
committer | Ben Batt <benbatt@gmail.com> | 2006-08-13 18:59:05 +0400 |
commit | 879fa3cb4e04dfab6cee96effa7931bf18e3b6ce (patch) | |
tree | e39a2b31fe3f7d1a4820106ce66f1df7707e5073 /source | |
parent | e341a4e1f45d8d3ba47dadc6ee72e94897369098 (diff) |
Fix for bug #4825 - array modifier crashes blender.
Some faces were not being checked for vertex indices of 0 before remapping,
leading to bad remapping and screwed up output meshes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 93af5168012..b796d8f0216 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -891,7 +891,8 @@ static DispListMesh *arrayModifier_doArray(ArrayModifierData *amd, mf->v1 = indexMap[inMF->v1].new; mf->v2 = indexMap[inMF->v2].new; mf->v3 = indexMap[inMF->v3].new; - mf->v4 = indexMap[inMF->v4].new; + if(inMF->v4) + mf->v4 = indexMap[inMF->v4].new; /* if vertices are to be merged with the final copies of their * merge targets, calculate that final copy @@ -902,19 +903,19 @@ static DispListMesh *arrayModifier_doArray(ArrayModifierData *amd, mf->v2 = calc_mapping(indexMap, indexMap[inMF->v2].merge, count-2); if(indexMap[inMF->v3].merge_final) mf->v3 = calc_mapping(indexMap, indexMap[inMF->v3].merge, count-2); - if(indexMap[inMF->v4].merge_final) + if(inMF->v4 && indexMap[inMF->v4].merge_final) mf->v4 = calc_mapping(indexMap, indexMap[inMF->v4].merge, count-2); if (initFlags) mf->flag |= ME_FACE_STEPINDEX; if (inDLM->tface) { TFace *inTF = &inDLM->tface[i]; - TFace *tf = &dlm->tface[dlm->totface-1]; + tf = &dlm->tface[dlm->totface-1]; *tf = *inTF; } else if (inDLM->mcol) { MCol *inMC = &inDLM->mcol[i*4]; - MCol *mc = &dlm->mcol[(dlm->totface-1)*4]; + mc = &dlm->mcol[(dlm->totface-1)*4]; mc[0] = inMC[0]; mc[1] = inMC[1]; @@ -922,6 +923,12 @@ static DispListMesh *arrayModifier_doArray(ArrayModifierData *amd, mc[3] = inMC[3]; } + test_index_face(mf, mc, tf, inMF->v4?4:3); + + /* if the face has fewer than 3 vertices, don't create it */ + if(mf->v3 == 0) + dlm->totface--; + for(j=0; j < count - 1; j++) { mf2 = &dlm->mface[dlm->totface++]; |