diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-16 07:55:10 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-16 07:55:10 +0300 |
commit | 4f37b548bd6b3436d5f0742b74424c7c9454a5ba (patch) | |
tree | 7969e8446a57f68e5461d9bcce95d946ac86d96c /source/blender/editors/lattice/editlattice_select.c | |
parent | 8cfdad99a0edbc70beb266518458199b757497b5 (diff) |
Cleanup: de-duplicate struct declaration
Also use boolean instead of int.
Diffstat (limited to 'source/blender/editors/lattice/editlattice_select.c')
-rw-r--r-- | source/blender/editors/lattice/editlattice_select.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c index 883476aed7d..bc3bca248a4 100644 --- a/source/blender/editors/lattice/editlattice_select.c +++ b/source/blender/editors/lattice/editlattice_select.c @@ -556,15 +556,18 @@ void LATTICE_OT_select_ungrouped(wmOperatorType *ot) * Gets called via generic mouse select operator. * \{ */ -static void findnearestLattvert__doClosest(void *userData, BPoint *bp, const float screen_co[2]) +struct NearestLatticeVert_UserData { + BPoint *bp; + float dist; + /** When true, the existing selection gets a disadvantage. */ + bool select; + float mval_fl[2]; + bool is_changed; +}; + +static void findnearestLattvert__doClosest(void *user_data, BPoint *bp, const float screen_co[2]) { - struct { - BPoint *bp; - float dist; - int select; - float mval_fl[2]; - bool is_changed; - } *data = userData; + struct NearestLatticeVert_UserData *data = user_data; float dist_test = len_manhattan_v2v2(data->mval_fl, screen_co); if ((bp->f1 & SELECT) && data->select) { @@ -578,21 +581,12 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, const flo } } -static BPoint *findnearestLattvert(ViewContext *vc, int sel, Base **r_base) +static BPoint *findnearestLattvert(ViewContext *vc, bool select, Base **r_base) { - /* (sel == 1): selected gets a disadvantage */ - /* in nurb and bezt or bp the nearest is written */ - /* return 0 1 2: handlepunt */ - struct { - BPoint *bp; - float dist; - int select; - float mval_fl[2]; - bool is_changed; - } data = {NULL}; + struct NearestLatticeVert_UserData data = {NULL}; data.dist = ED_view3d_select_dist_px(); - data.select = sel; + data.select = select; data.mval_fl[0] = vc->mval[0]; data.mval_fl[1] = vc->mval[1]; |