Cleanup: use return args last
This commit is contained in:
parent
3600bb79d0
commit
bd1d80d0cf
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user