diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:37:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:42:19 +0300 |
commit | 501d2443d03cce18985fab3ffad5d23238748f3e (patch) | |
tree | 1d127d4e4c6d82fc85feedc9826dd5619174e346 /source/blender/editors/gpencil | |
parent | df9597cfba78deb40009553ab9dcf09c21edd434 (diff) |
Cleanup: use const arguments for accessor functions
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/editaction_gpencil.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 14 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_sculpt_paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 16 |
4 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 92f1629f7f7..6e6d94a2909 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -107,7 +107,7 @@ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlys /* Selection Tools */ /* check if one of the frames in this layer is selected */ -bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl) +bool ED_gpencil_layer_frame_select_check(const bGPDlayer *gpl) { /* error checking */ if (gpl == NULL) { @@ -115,7 +115,7 @@ bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl) } /* stop at the first one found */ - LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { + LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) { if (gpf->flag & GP_FRAME_SELECT) { return true; } diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index e11ed927cbf..e272f46d13d 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -871,20 +871,20 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot) } /* ********************* Clean Duplicated Frames ************************** */ -static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b) +static bool gpencil_frame_is_equal(const bGPDframe *gpf_a, const bGPDframe *gpf_b) { if ((gpf_a == NULL) || (gpf_b == NULL)) { return false; } /* If the number of strokes is different, cannot be equal. */ - int totstrokes_a = BLI_listbase_count(&gpf_a->strokes); - int totstrokes_b = BLI_listbase_count(&gpf_b->strokes); + const int totstrokes_a = BLI_listbase_count(&gpf_a->strokes); + const int totstrokes_b = BLI_listbase_count(&gpf_b->strokes); if ((totstrokes_a == 0) || (totstrokes_b == 0) || (totstrokes_a != totstrokes_b)) { return false; } /* Loop all strokes and check. */ - bGPDstroke *gps_a = gpf_a->strokes.first; - bGPDstroke *gps_b = gpf_b->strokes.first; + const bGPDstroke *gps_a = gpf_a->strokes.first; + const bGPDstroke *gps_b = gpf_b->strokes.first; for (int i = 0; i < totstrokes_a; i++) { /* If the number of points is different, cannot be equal. */ if (gps_a->totpoints != gps_b->totpoints) { @@ -924,8 +924,8 @@ static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b) /* Loop points and check if equals or not. */ for (int p = 0; p < gps_a->totpoints; p++) { - bGPDspoint *pt_a = &gps_a->points[p]; - bGPDspoint *pt_b = &gps_b->points[p]; + const bGPDspoint *pt_a = &gps_a->points[p]; + const bGPDspoint *pt_b = &gps_b->points[p]; if (!equals_v3v3(&pt_a->x, &pt_b->x)) { return false; } diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 864231e6aab..0226558b4a0 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1381,7 +1381,7 @@ static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso, return 0.0f; } - GP_SpaceConversion *gsc = &gso->gsc; + const GP_SpaceConversion *gsc = &gso->gsc; bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval; bGPDspoint *pt_orig = &gps_orig->points[pt_eval->runtime.idx_orig]; bGPDspoint *pt_prev_eval = NULL; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 15ada6e0891..54672743439 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -3106,8 +3106,8 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph, } /* Get the bigger 2D bound box points. */ -void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc, - bGPDstroke *gps, +void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc, + const bGPDstroke *gps, const float diff_mat[4][4], float r_min[2], float r_max[2]) @@ -3140,7 +3140,7 @@ void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc, } /* Check if the stroke collides with brush. */ -bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, +bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc, bGPDstroke *gps, const float mouse[2], const int radius, @@ -3175,9 +3175,9 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, * \param diff_mat: View matrix. * \return True if the point is inside. */ -bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, - GP_SpaceConversion *gsc, - int mouse[2], +bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps, + const GP_SpaceConversion *gsc, + const int mouse[2], const float diff_mat[4][4]) { bool hit = false; @@ -3190,7 +3190,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, mcoords = MEM_mallocN(sizeof(int[2]) * len, __func__); /* Convert stroke to 2D array of points. */ - bGPDspoint *pt; + const bGPDspoint *pt; int i; for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { bGPDspoint pt2; @@ -3214,7 +3214,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, } bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C, - GP_SpaceConversion *gsc, + const GP_SpaceConversion *gsc, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, |