diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-06 12:07:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-06 12:07:12 +0400 |
commit | 0b805fcb5d87b067f4d53b27dd349eb2c46563fa (patch) | |
tree | ea7452e521832fb9e5912cea7351c670abc5ed7c | |
parent | e4ced610ee8e4d7373c4599db789755358163444 (diff) |
remove double lookus in BM_GetCDf/BM_SetCDf, also remove bm_cdata_get_single_float which was a duplicate of BM_GetCDf.
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 16 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_select.c | 17 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 6 |
3 files changed, 8 insertions, 31 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 00e51fbd32f..c3ea18ab9d0 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -936,20 +936,12 @@ void BM_free_data_layer_n(BMesh *bm, CustomData *data, int type, int n) float BM_GetCDf(CustomData *cd, void *element, int type) { - if (CustomData_has_layer(cd, type)) { - float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type); - return *f; - } - - return 0.0; + float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type); + return f ? *f : 0.0f; } void BM_SetCDf(CustomData *cd, void *element, int type, float val) { - if (CustomData_has_layer(cd, type)) { - float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type); - *f = val; - } - - return; + float *f = CustomData_bmesh_get(cd, ((BMHeader*)element)->data, type); + if (f) *f = val; } diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index 02f2531554e..271d82dea99 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -1174,19 +1174,6 @@ static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val } } -static float bm_cdata_get_single_float(BMesh *UNUSED(bm), CustomData *cdata, void *element, int type) -{ - BMHeader *ele = element; - float *f; - - if (!CustomData_has_layer(cdata, type)) - return 0.0f; - - f = CustomData_bmesh_get(cdata, ele->data, type); - - return *f; -} - static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e) { switch (scene->toolsettings->edge_mode) { @@ -1197,9 +1184,9 @@ static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e) case EDGE_MODE_TAG_SHARP: return BM_TestHFlag(e, BM_SHARP); case EDGE_MODE_TAG_CREASE: - return bm_cdata_get_single_float(em->bm, &em->bm->edata, e, CD_CREASE) ? 1 : 0; + return BM_GetCDf(&em->bm->edata, e, CD_CREASE) ? 1 : 0; case EDGE_MODE_TAG_BEVEL: - return bm_cdata_get_single_float(em->bm, &em->bm->edata, e, CD_BWEIGHT) ? 1 : 0; + return BM_GetCDf(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0; } return 0; } diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 3b8ed3a0249..c6fce0c3e48 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -4492,10 +4492,8 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op) df *= 2.0; } - - for (i=0; i<BLI_array_count(w); i++) { - w[i] /= ftot; - } + + mul_vn_fl(w, BLI_array_count(w), 1.0f / (float)ftot); fac = factor; for (i=0; i<BLI_array_count(w); i++) { |