[Bf-blender-cvs] [b2df4c5d5b9] greasepencil-experimental: GP: Cleanup code
Antonioya
noreply at git.blender.org
Fri Jan 4 10:48:00 CET 2019
Commit: b2df4c5d5b91b05628d7890e1e69c68bbc60b90d
Author: Antonioya
Date: Fri Jan 4 10:43:35 2019 +0100
Branches: greasepencil-experimental
https://developer.blender.org/rBb2df4c5d5b91b05628d7890e1e69c68bbc60b90d
GP: Cleanup code
===================================================================
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_select.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/include/ED_gpencil.h
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 504e191fb9f..1fe4a33f0e8 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3738,7 +3738,7 @@ typedef bool(*GPencilTestFn)(
bGPDstroke *gps, bGPDspoint *pt,
const GP_SpaceConversion *gsc, const float diff_mat[4][4], void *user_data);
-static void gpencil_cutter_dissolve(bGPdata *gpd, bGPDlayer *hit_layer, bGPDstroke *hit_stroke)
+static void gpencil_cutter_dissolve(bGPDlayer *hit_layer, bGPDstroke *hit_stroke)
{
bGPDspoint *pt = NULL;
bGPDspoint *pt1 = NULL;
@@ -3812,9 +3812,6 @@ static int gpencil_cutter_lasso_select(
/* deselect all strokes first */
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
- bGPDspoint *pt;
- int i;
-
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
pt->flag &= ~GP_SPOINT_SELECT;
}
@@ -3842,7 +3839,7 @@ static int gpencil_cutter_lasso_select(
float r_hita[3], r_hitb[3];
if (gps->totpoints > 1) {
ED_gpencil_select_stroke_segment(
- gpd, gpl, gps, pt, true, true, r_hita, r_hitb);
+ gpl, gps, pt, true, true, r_hita, r_hitb);
}
}
}
@@ -3866,7 +3863,7 @@ static int gpencil_cutter_lasso_select(
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gpsn) {
gpsn = gps->next;
if (gps->flag & GP_STROKE_SELECT) {
- gpencil_cutter_dissolve(gpd, gpl, gps);
+ gpencil_cutter_dissolve(gpl, gps);
}
}
}
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index d07d452cf9e..1e099b844ee 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -861,12 +861,13 @@ void GPENCIL_OT_select_less(wmOperatorType *ot)
* It would be great to de-duplicate the logic here sometime, but that can wait...
*/
static bool gp_stroke_do_circle_sel(
- bGPdata *gpd, bGPDlayer *gpl,
+ bGPDlayer *gpl,
bGPDstroke *gps, GP_SpaceConversion *gsc,
const int mx, const int my, const int radius,
const bool select, rcti *rect, float diff_mat[4][4], const int selectmode)
{
- bGPDspoint *pt1, *pt2;
+ bGPDspoint *pt1 = NULL;
+ bGPDspoint *pt2 = NULL;
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
int i;
bool changed = false;
@@ -964,7 +965,7 @@ static bool gp_stroke_do_circle_sel(
float r_hita[3], r_hitb[3];
bool hit_select = (bool)(pt1->flag & GP_SPOINT_SELECT);
ED_gpencil_select_stroke_segment(
- gpd, gpl, gps, pt1, hit_select, false, r_hita, r_hitb);
+ gpl, gps, pt1, hit_select, false, r_hita, r_hitb);
}
/* Ensure that stroke selection is in sync with its points */
@@ -1021,7 +1022,7 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
GP_EDITABLE_STROKES_BEGIN(gpstroke_iter, C, gpl, gps)
{
changed |= gp_stroke_do_circle_sel(
- gpd, gpl, gps, &gsc, mx, my, radius, select, &rect,
+ gpl, gps, &gsc, mx, my, radius, select, &rect,
gpstroke_iter.diff_mat, selectmode);
}
GP_EDITABLE_STROKES_END(gpstroke_iter);
@@ -1145,7 +1146,7 @@ static int gpencil_generic_select_exec(
bool hit_select = (bool)(pt->flag & GP_SPOINT_SELECT);
float r_hita[3], r_hitb[3];
ED_gpencil_select_stroke_segment(
- gpd, gpl, gps, pt, hit_select, false, r_hita, r_hitb);
+ gpl, gps, pt, hit_select, false, r_hita, r_hitb);
}
}
@@ -1486,7 +1487,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op)
float r_hita[3], r_hitb[3];
bool hit_select = (bool)(hit_point->flag & GP_SPOINT_SELECT);
ED_gpencil_select_stroke_segment(
- gpd, hit_layer, hit_stroke, hit_point, hit_select,
+ hit_layer, hit_stroke, hit_point, hit_select,
false, r_hita, r_hitb);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 6c34137f5de..0a4781346b5 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1949,7 +1949,7 @@ void ED_gpencil_update_color_uv(Main *bmain, Material *mat)
}
static bool gpencil_check_collision(
- bGPDstroke *gps, bGPDstroke **gps_array, GHash *all_2d,
+ bGPDstroke **gps_array, GHash *all_2d,
int totstrokes, float p2d_a1[2], float p2d_a2[2], float r_hit[2])
{
bool hit = false;
@@ -2093,7 +2093,7 @@ static float gp_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2])
/* extend selection to stroke intersections */
int ED_gpencil_select_stroke_segment(
- bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, bGPDspoint *pt,
+ bGPDlayer *gpl, bGPDstroke *gps, bGPDspoint *pt,
bool select, bool insert,
float r_hita[3], float r_hitb[3])
{
@@ -2180,7 +2180,7 @@ int ED_gpencil_select_stroke_segment(
copy_v2_v2(p2d_a2, points2d[i2]);
hit_a = gpencil_check_collision(
- gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+ gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
if (select) {
pta1->flag |= GP_SPOINT_SELECT;
@@ -2214,7 +2214,7 @@ int ED_gpencil_select_stroke_segment(
copy_v2_v2(p2d_a2, points2d[i2]);
hit_b = gpencil_check_collision(
- gps, gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
+ gps_array, all_2d, totstrokes, p2d_a1, p2d_a2, r_hit2d);
if (select) {
pta1->flag |= GP_SPOINT_SELECT;
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 0136c72fcdf..6daafae8e6f 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -267,7 +267,7 @@ void ED_gpencil_update_color_uv(struct Main *bmain, struct Material *mat);
* 3 - Hit in point A and B
*/
int ED_gpencil_select_stroke_segment(
- struct bGPdata *gpd, struct bGPDlayer *gpl,
+ struct bGPDlayer *gpl,
struct bGPDstroke *gps, struct bGPDspoint *pt,
bool select, bool insert,
float r_hita[3], float r_hitb[3]);
More information about the Bf-blender-cvs
mailing list