Cleanup: use return args last
authorCampbell Barton <ideasman42@gmail.com>
Sat, 16 Mar 2019 00:38:55 +0000 (11:38 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 16 Mar 2019 00:45:22 +0000 (11:45 +1100)
source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_select.c

index 9fcd0c9..b912cf8 100644 (file)
@@ -365,9 +365,15 @@ int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct Me
 
 int ED_mesh_mirror_get_vert(struct Object *ob, int index);
 
-bool ED_mesh_pick_vert(struct bContext *C,      struct Object *ob, const int mval[2], uint *r_index, uint dist_px, bool use_zbuf);
-bool ED_mesh_pick_face(struct bContext *C,      struct Object *ob, const int mval[2], uint *r_index, uint dist_px);
-bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], uint *r_index, uint dist_px);
+bool ED_mesh_pick_vert(
+        struct bContext *C, struct Object *ob, const int mval[2], uint dist_px, bool use_zbuf,
+        uint *r_index);
+bool ED_mesh_pick_face(
+        struct bContext *C, struct Object *ob, const int mval[2], uint dist_px,
+        uint *r_index);
+bool ED_mesh_pick_face_vert(
+        struct bContext *C, struct Object *ob, const int mval[2], uint dist_px,
+        uint *r_index);
 
 
 struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct BMVert **r_eve);
index e226985..12a96d4 100644 (file)
@@ -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;
index 0b2b935..5339c83 100644 (file)
@@ -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;
index 24a2667..a371d8e 100644 (file)
@@ -188,15 +188,15 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
                ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
 
                if (use_vert_sel) {
-                       if (ED_mesh_pick_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_VERT_DIST, true)) {
+                       if (ED_mesh_pick_vert(C, vc.obact, event->mval, ED_MESH_PICK_DEFAULT_VERT_DIST, true, &index)) {
                                v_idx_best = index;
                        }
                }
                else {
-                       if (ED_mesh_pick_face_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) {
+                       if (ED_mesh_pick_face_vert(C, vc.obact, event->mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) {
                                v_idx_best = index;
                        }
-                       else if (ED_mesh_pick_face(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) {
+                       else if (ED_mesh_pick_face(C, vc.obact, event->mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) {
                                /* this relies on knowning the internal worksings of ED_mesh_pick_face_vert() */
                                BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations");
                        }
@@ -312,13 +312,13 @@ static const EnumPropertyItem *weight_paint_sample_enum_itemf(
                                ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
 
                                if (use_vert_sel) {
-                                       if (ED_mesh_pick_vert(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_DIST, true)) {
+                                       if (ED_mesh_pick_vert(C, vc.obact, mval, ED_MESH_PICK_DEFAULT_VERT_DIST, true, &index)) {
                                                MDeformVert *dvert = &me->dvert[index];
                                                found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups);
                                        }
                                }
                                else {
-                                       if (ED_mesh_pick_face(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) {
+                                       if (ED_mesh_pick_face(C, vc.obact, mval, ED_MESH_PICK_DEFAULT_FACE_DIST, &index)) {
                                                const MPoly *mp = &me->mpoly[index];
                                                uint fidx = mp->totloop - 1;
 
index 25cc885..75f6f9f 100644 (file)
@@ -533,8 +533,6 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
 
 static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
 {
-       RegionView3D *rv3d = ar->regiondata;
-
        ED_view3d_stop_render_preview(wm, ar);
 }
 
index 02d469b..6a42c06 100644 (file)
@@ -1924,7 +1924,7 @@ static bool ed_wpaint_vertex_select_pick(
        uint index = 0;
        MVert *mv;
 
-       if (ED_mesh_pick_vert(C, obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_DIST, use_zbuf)) {
+       if (ED_mesh_pick_vert(C, obact, mval, ED_MESH_PICK_DEFAULT_VERT_DIST, use_zbuf, &index)) {
                mv = &me->mvert[index];
                if (extend) {
                        mv->flag |= SELECT;