diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 13:54:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-21 13:54:33 +0400 |
commit | 88dd983f3cde0ee0cd91b3a9d12430ceff17d842 (patch) | |
tree | 4ce19188f707d0ef3aebf24e8bbd474e760945d4 /source/blender/blenkernel | |
parent | 04affbe80eeddd0cd9a47b888cce3f9b26dbbe04 (diff) |
fix regression in own recent commit, vertex flags were left uninitialized.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 25 |
2 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 0197cc3fa77..d41893b4335 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1410,7 +1410,7 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r) normal_float_to_short_v3(vert_r->no, eve->no); vert_r->flag = BM_vert_flag_to_mflag(eve); - if (cd_vert_bweight_offset != -1) vert_r->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset); + vert_r->bweight = (cd_vert_bweight_offset != -1) ? BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset) : 0; vert_r++; } @@ -1421,7 +1421,7 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r) normal_float_to_short_v3(vert_r->no, eve->no); vert_r->flag = BM_vert_flag_to_mflag(eve); - if (cd_vert_bweight_offset != -1) vert_r->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset); + vert_r->bweight = (cd_vert_bweight_offset != -1) ? BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset) : 0; vert_r++; } @@ -1445,8 +1445,8 @@ static void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r) edge_r->flag = BM_edge_flag_to_mflag(eed); - if (cd_edge_crease_offset != -1) edge_r->crease = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_crease_offset); - if (cd_edge_bweight_offset != -1) edge_r->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_bweight_offset); + edge_r->crease = (cd_edge_crease_offset != -1) ? BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_crease_offset) : 0; + edge_r->bweight = (cd_edge_bweight_offset != -1) ? BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_bweight_offset) : 0; edge_r++; } @@ -1469,6 +1469,7 @@ static void emDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r) face_r->mat_nr = (unsigned char) ef->mat_nr; face_r->flag = BM_face_flag_to_mflag(ef); + face_r->edcode = 0; face_r->v1 = BM_elem_index_get(l[0]->v); face_r->v2 = BM_elem_index_get(l[1]->v); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 6d4313d1bc3..d665269c6ca 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1013,7 +1013,11 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) mf->flag = faceFlags[i].flag; mf->mat_nr = faceFlags[i].mat_nr; } - else mf->flag = ME_SMOOTH; + else { + mf->flag = ME_SMOOTH; + } + + mf->edcode = 0; } /* Translate GridHidden into the ME_HIDE flag for MVerts. Assumes @@ -1122,6 +1126,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x); copy_v3_v3(mvert[i].co, CCG_elem_co(&key, vd)); normal_float_to_short_v3(mvert[i].no, CCG_elem_no(&key, vd)); + mvert[i].flag = mvert[i].bweight = 0; } } @@ -1131,6 +1136,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) vd = ccgSubSurf_getFaceGridData(ss, f, S, x, y); copy_v3_v3(mvert[i].co, CCG_elem_co(&key, vd)); normal_float_to_short_v3(mvert[i].no, CCG_elem_no(&key, vd)); + mvert[i].flag = mvert[i].bweight = 0; } } } @@ -1150,6 +1156,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) * faces which are now zerod out, see comment in: * ccgSubSurf__calcVertNormals(), - campbell */ normal_float_to_short_v3(mvert[i].no, CCG_elem_no(&key, vd)); + mvert[i].flag = mvert[i].bweight = 0; } } @@ -1160,6 +1167,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) vd = ccgSubSurf_getVertData(ss, v); copy_v3_v3(mvert[i].co, CCG_elem_co(&key, vd)); normal_float_to_short_v3(mvert[i].no, CCG_elem_no(&key, vd)); + mvert[i].flag = mvert[i].bweight = 0; i++; } } @@ -1174,6 +1182,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) int edgeSize = ccgSubSurf_getEdgeSize(ss); int i = 0; short *edgeFlags = ccgdm->edgeFlags; + const short ed_interior_flag = ccgdm->drawInteriorEdges ? (ME_EDGEDRAW | ME_EDGERENDER) : 0; totface = ccgSubSurf_getNumFaces(ss); for (index = 0; index < totface; index++) { @@ -1184,10 +1193,10 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) for (x = 0; x < gridSize - 1; x++) { MEdge *med = &medge[i]; - if (ccgdm->drawInteriorEdges) - med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize); med->v2 = getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize); + med->crease = med->bweight = 0; + med->flag = ed_interior_flag; i++; } @@ -1196,21 +1205,21 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) MEdge *med; med = &medge[i]; - if (ccgdm->drawInteriorEdges) - med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, x, y, edgeSize, gridSize); med->v2 = getFaceIndex(ss, f, S, x, y + 1, edgeSize, gridSize); + med->crease = med->bweight = 0; + med->flag = ed_interior_flag; i++; med = &medge[i]; - if (ccgdm->drawInteriorEdges) - med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, y, x, edgeSize, gridSize); med->v2 = getFaceIndex(ss, f, S, y + 1, x, edgeSize, gridSize); + med->crease = med->bweight = 0; + med->flag = ed_interior_flag; i++; } } @@ -1239,6 +1248,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) MEdge *med = &medge[i]; med->v1 = getEdgeIndex(ss, e, x, edgeSize); med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize); + med->crease = med->bweight = 0; med->flag = flags; i++; } @@ -1278,6 +1288,7 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface) edgeSize, gridSize); mf->mat_nr = mat_nr; mf->flag = flag; + mf->edcode = 0; i++; } |