From bd1d80d0cf9c8aa856b37a91750c94a0048528f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Mar 2019 11:38:55 +1100 Subject: Cleanup: use return args last --- source/blender/editors/mesh/editface.c | 8 +++++--- source/blender/editors/mesh/meshtools.c | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index e226985300c..12a96d41711 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -272,7 +272,7 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b if (me == NULL || me->totpoly == 0) return; if (mval) { - if (!ED_mesh_pick_face(C, ob, mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) { + if (!ED_mesh_pick_face(C, ob, mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) { return; } } @@ -374,11 +374,13 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b /* Get the face under the cursor */ me = BKE_mesh_from_object(ob); - if (!ED_mesh_pick_face(C, ob, mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) + if (!ED_mesh_pick_face(C, ob, mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) { return false; + } - if (index >= me->totpoly) + if (index >= me->totpoly) { return false; + } mpoly_sel = me->mpoly + index; if (mpoly_sel->flag & ME_HIDE) return false; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 0b2b9355a8a..5339c83d158 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -1014,7 +1014,9 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval) * * \return boolean true == Found */ -bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index, uint dist_px) +bool ED_mesh_pick_face( + bContext *C, Object *ob, const int mval[2], uint dist_px, + uint *r_index) { ViewContext vc; Mesh *me = ob->data; @@ -1032,18 +1034,19 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int ED_view3d_select_id_validate(&vc); - *index = ED_view3d_select_id_read_nearest( + *r_index = ED_view3d_select_id_read_nearest( &vc, mval, 1, me->totpoly + 1, &dist_px); } else { /* sample only on the exact position */ - *index = ED_view3d_select_id_sample(&vc, mval[0], mval[1]); + *r_index = ED_view3d_select_id_sample(&vc, mval[0], mval[1]); } - if ((*index) == 0 || (*index) > (unsigned int)me->totpoly) + if ((*r_index) == 0 || (*r_index) > (unsigned int)me->totpoly) { return false; + } - (*index)--; + (*r_index)--; return true; } @@ -1076,7 +1079,9 @@ static void ed_mesh_pick_face_vert__mpoly_find( * Use when the back buffer stores face index values. but we want a vert. * This gets the face then finds the closest vertex to mval. */ -bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], uint *r_index, uint dist_px) +bool ED_mesh_pick_face_vert( + bContext *C, Object *ob, const int mval[2], uint dist_px, + uint *r_index) { Depsgraph *depsgraph = CTX_data_depsgraph(C); unsigned int poly_index; @@ -1084,7 +1089,7 @@ bool ED_mesh_pick_face_vert(bContext *C, Object *ob, const int mval[2], uint *r_ BLI_assert(me && GS(me->id.name) == ID_ME); - if (ED_mesh_pick_face(C, ob, mval, &poly_index, dist_px)) { + if (ED_mesh_pick_face(C, ob, mval, dist_px, &poly_index)) { Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); struct ARegion *ar = CTX_wm_region(C); @@ -1184,7 +1189,9 @@ static void ed_mesh_pick_vert__mapFunc(void *userData, int index, const float co } } } -bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], uint *r_index, uint dist_px, bool use_zbuf) +bool ED_mesh_pick_vert( + bContext *C, Object *ob, const int mval[2], uint dist_px, bool use_zbuf, + uint *r_index) { ViewContext vc; Mesh *me = ob->data; -- cgit v1.2.3