diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-01 05:41:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-01 05:41:56 +0400 |
commit | f06bbaed9263fbcc00a91ca47edcaace288efe9c (patch) | |
tree | ae72a5ae61f9d9f1f07f0e5292d42004272b20a6 /source/blender/blenkernel | |
parent | 25098c741b4ee227b4d63ab3d56bb5e829305612 (diff) |
split BMFlags_To_MEFlags & MEFlags_To_BMFlags into type specific calls, since we always know the types with these functions theres not much point in having generic calls with a type switch.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editderivedbmesh.c | 22 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifiers_bmesh.c | 6 |
3 files changed, 16 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 470f6a09d65..9a1a5cfaafa 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2021,7 +2021,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis normal_float_to_short_v3(mv->no, eve->no); - mv->flag = BMFlags_To_MEFlags(eve); + mv->flag = BM_Vert_Flag_To_MEFlag(eve); if (has_vert_bweight) mv->bweight = (unsigned char)(BM_GetCDf(&bm->vdata, eve, CD_BWEIGHT)*255.0f); @@ -2047,7 +2047,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis if (has_edge_bweight) med->bweight = (unsigned char)(BM_GetCDf(&bm->edata, eed, CD_BWEIGHT)*255.0f); - med->flag = BMFlags_To_MEFlags(eed); + med->flag = BM_Edge_Flag_To_MEFlag(eed); CustomData_from_bmesh_block(&bm->edata, &dm->edgeData, eed->head.data, i); if (add_orig) *index = i; @@ -2068,7 +2068,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis mf->v3 = BM_GetIndex(l[2]->v); mf->v4 = 0; mf->mat_nr = efa->mat_nr; - mf->flag = BMFlags_To_MEFlags(efa); + mf->flag = BM_Face_Flag_To_MEFlag(efa); *index = add_orig ? BM_GetIndex(efa) : *(int*)CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_ORIGINDEX); *polyindex = BM_GetIndex(efa); @@ -2085,7 +2085,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis MPoly *mp = &mpoly[i]; mp->totloop = efa->len; - mp->flag = BMFlags_To_MEFlags(efa); + mp->flag = BM_Face_Flag_To_MEFlag(efa); mp->loopstart = j; mp->mat_nr = efa->mat_nr; diff --git a/source/blender/blenkernel/intern/editderivedbmesh.c b/source/blender/blenkernel/intern/editderivedbmesh.c index 08c4ea5fa00..df28ab99bec 100644 --- a/source/blender/blenkernel/intern/editderivedbmesh.c +++ b/source/blender/blenkernel/intern/editderivedbmesh.c @@ -1294,11 +1294,9 @@ static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *vert_r) { copy_v3_v3(vert_r->co, ev->co); - vert_r->no[0] = (short)(ev->no[0] * 32767.0f); - vert_r->no[1] = (short)(ev->no[1] * 32767.0f); - vert_r->no[2] = (short)(ev->no[2] * 32767.0f); + normal_float_to_short_v3(vert_r->no, ev->no); - vert_r->flag = BMFlags_To_MEFlags(ev); + vert_r->flag = BM_Vert_Flag_To_MEFlag(ev); if (CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) { vert_r->bweight = (unsigned char) (BM_GetCDf(&bm->vdata, ev, CD_BWEIGHT)*255.0f); @@ -1341,7 +1339,7 @@ static void bmDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r) edge_r->crease = (unsigned char) (BM_GetCDf(&bm->edata, e, CD_CREASE)*255.0f); } - edge_r->flag = BMFlags_To_MEFlags(e); + edge_r->flag = BM_Edge_Flag_To_MEFlag(e); edge_r->v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(bmdm->vhash, e->v1)); edge_r->v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(bmdm->vhash, e->v2)); @@ -1363,7 +1361,7 @@ static void bmDM_getTessFace(DerivedMesh *dm, int index, MFace *face_r) ef = l[0]->f; face_r->mat_nr = (unsigned char) ef->mat_nr; - face_r->flag = BMFlags_To_MEFlags(ef); + face_r->flag = BM_Face_Flag_To_MEFlag(ef); face_r->v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(bmdm->vhash, l[0]->v)); face_r->v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(bmdm->vhash, l[1]->v)); @@ -1383,11 +1381,9 @@ static void bmDM_copyVertArray(DerivedMesh *dm, MVert *vert_r) for( ; ev; ev = BMIter_Step(&iter), ++vert_r) { copy_v3_v3(vert_r->co, ev->co); - vert_r->no[0] = (short) (ev->no[0] * 32767.0); - vert_r->no[1] = (short) (ev->no[1] * 32767.0); - vert_r->no[2] = (short) (ev->no[2] * 32767.0); + normal_float_to_short_v3(vert_r->no, ev->no); - vert_r->flag = BMFlags_To_MEFlags(ev); + vert_r->flag = BM_Vert_Flag_To_MEFlag(ev); if (CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) { vert_r->bweight = (unsigned char) (BM_GetCDf(&bm->vdata, ev, CD_BWEIGHT)*255.0f); @@ -1415,7 +1411,7 @@ static void bmDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r) edge_r->crease = (unsigned char) (BM_GetCDf(&bm->edata, ee, CD_CREASE)*255.0f); } - edge_r->flag = BMFlags_To_MEFlags(ee); + edge_r->flag = BM_Edge_Flag_To_MEFlag(ee); edge_r->v1 = (int)BM_GetIndex(ee->v1); edge_r->v2 = (int)BM_GetIndex(ee->v2); @@ -1438,7 +1434,7 @@ static void bmDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r) face_r->mat_nr = (unsigned char) ef->mat_nr; - face_r->flag = BMFlags_To_MEFlags(ef); + face_r->flag = BM_Face_Flag_To_MEFlag(ef); face_r->v1 = BM_GetIndex(l[0]->v); face_r->v2 = BM_GetIndex(l[1]->v); @@ -1479,7 +1475,7 @@ static void bmDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r) i = 0; BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { - poly_r->flag = BMFlags_To_MEFlags(f); + poly_r->flag = BM_Face_Flag_To_MEFlag(f); poly_r->loopstart = i; poly_r->totloop = f->len; poly_r->mat_nr = f->mat_nr; diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index 2dc994b2159..079d8fad7cb 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -148,7 +148,7 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing) for (i=0; i<totvert; i++, mv++) { v = BM_Make_Vert(bm, mv->co, NULL); normal_short_to_float_v3(v->no, mv->no); - v->head.hflag = MEFlags_To_BMFlags(mv->flag, BM_VERT); + v->head.hflag = BM_Vert_Flag_From_MEFlag(mv->flag); CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, &v->head.data); vtable[i] = v; @@ -160,7 +160,7 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing) for (i=0; i<totedge; i++, me++) { e = BM_Make_Edge(bm, vtable[me->v1], vtable[me->v2], NULL, 0); - e->head.hflag = MEFlags_To_BMFlags(me->flag, BM_EDGE); + e->head.hflag = BM_Edge_Flag_From_MEFlag(me->flag); CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->head.data); etable[i] = e; @@ -190,7 +190,7 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing) if (!f) continue; - f->head.hflag = MEFlags_To_BMFlags(mp->flag, BM_FACE); + f->head.hflag = BM_Vert_Flag_From_MEFlag(mp->flag); f->mat_nr = mp->mat_nr; l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f); |