[Bf-blender-cvs] [4f37b548bd6] master: Cleanup: de-duplicate struct declaration
Campbell Barton
noreply at git.blender.org
Wed Mar 16 06:57:38 CET 2022
Commit: 4f37b548bd6b3436d5f0742b74424c7c9454a5ba
Author: Campbell Barton
Date: Wed Mar 16 15:55:10 2022 +1100
Branches: master
https://developer.blender.org/rB4f37b548bd6b3436d5f0742b74424c7c9454a5ba
Cleanup: de-duplicate struct declaration
Also use boolean instead of int.
===================================================================
M source/blender/editors/lattice/editlattice_select.c
===================================================================
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];
More information about the Bf-blender-cvs
mailing list