Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-10-31 18:07:36 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-11-04 12:54:59 +0300
commite236f5b5749f256034e7605a66f611f1fad74c41 (patch)
tree9db334e7b8760bef134801417336c6e0785e4269 /source/blender/editors/mask
parent3d55d80c59d97ce12d1e5f344e7f1aaf1c9c2a4f (diff)
Masking: Cleanup, limit variable scope
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r--source/blender/editors/mask/mask_draw.c3
-rw-r--r--source/blender/editors/mask/mask_edit.c10
-rw-r--r--source/blender/editors/mask/mask_ops.c65
-rw-r--r--source/blender/editors/mask/mask_relationships.c20
-rw-r--r--source/blender/editors/mask/mask_select.c72
-rw-r--r--source/blender/editors/mask/mask_shapekey.c31
6 files changed, 62 insertions, 139 deletions
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index bcca7f8b35f..71aa860d703 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -608,14 +608,13 @@ static void draw_mask_layers(const bContext *C,
for (mask_layer = mask->masklayers.first, i = 0; mask_layer != NULL;
mask_layer = mask_layer->next, i++) {
- MaskSpline *spline;
const bool is_active = (i == mask->masklay_act);
if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
/* draw curve itself first... */
draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 0c5591ed89b..56d8ef56160 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -371,7 +371,6 @@ void ED_mask_cursor_location_get(ScrArea *sa, float cursor[2])
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool ok = false;
if (mask == NULL) {
@@ -379,15 +378,14 @@ bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2])
}
INIT_MINMAX2(min, max);
- for (mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
+ mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
- int i;
- for (i = 0; i < spline->tot_point; i++) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
MaskSplinePoint *deform_point = &points_array[i];
BezTriple *bezt = &point->bezt;
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index b40bddacb49..3a982b255f0 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -555,7 +555,6 @@ static bool spline_under_mouse_get(const bContext *C,
const float threshold = 19.0f;
ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- MaskLayer *mask_layer;
int width, height;
float pixel_co[2];
float closest_dist_squared = 0.0f;
@@ -570,13 +569,13 @@ static bool spline_under_mouse_get(const bContext *C,
if (sc != NULL) {
undistort = (sc->clip != NULL) && (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
}
- for (mask_layer = mask->masklayers.first; mask_layer != NULL; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer != NULL;
+ mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
continue;
}
- for (spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline != NULL; spline = spline->next) {
MaskSplinePoint *points_array;
float min[2], max[2], center[2];
float dist_squared;
@@ -1586,16 +1585,13 @@ void MASK_OT_slide_spline_curvature(wmOperatorType *ot)
static int cyclic_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
spline->flag ^= MASK_SPLINE_CYCLIC;
}
@@ -1666,10 +1662,9 @@ static void delete_feather_points(MaskSplinePoint *point)
static int delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
MaskSpline *spline;
int mask_layer_shape_ofs = 0;
@@ -1787,20 +1782,18 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
bool changed_layer = false;
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
BKE_mask_spline_direction_switch(mask_layer, spline);
changed = true;
@@ -1847,22 +1840,19 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op)
{
Scene *scene = CTX_data_scene(C);
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
- int i;
bool changed = false;
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
bool changed_layer = false;
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
@@ -1913,21 +1903,17 @@ void MASK_OT_normals_make_consistent(wmOperatorType *ot)
static int set_handle_type_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
int handle_type = RNA_enum_get(op->ptr, "type");
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
- int i;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
@@ -1999,11 +1985,10 @@ void MASK_OT_handle_type_set(wmOperatorType *ot)
static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
const bool select = RNA_boolean_get(op->ptr, "select");
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & OB_RESTRICT_VIEWPORT) {
ED_mask_layer_select_set(mask_layer, select);
@@ -2044,11 +2029,10 @@ void MASK_OT_hide_view_clear(wmOperatorType *ot)
static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
continue;
@@ -2108,19 +2092,15 @@ void MASK_OT_hide_view_set(wmOperatorType *ot)
static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
- int i;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_SELECT | MASK_RESTRICT_VIEW)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
@@ -2247,12 +2227,9 @@ void MASK_OT_layer_move(wmOperatorType *ot)
static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
- for (spline = mask_layer->splines.last; spline; spline = spline->prev) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskSpline *spline = mask_layer->splines.last; spline; spline = spline->prev) {
MaskSplinePoint *point = spline->points;
int i = 0;
while (i < spline->tot_point) {
diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c
index b72edd3977b..130ebb61a90 100644
--- a/source/blender/editors/mask/mask_relationships.c
+++ b/source/blender/editors/mask/mask_relationships.c
@@ -43,18 +43,14 @@
static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
- int i;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
@@ -89,7 +85,6 @@ void MASK_OT_parent_clear(wmOperatorType *ot)
static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
/* parent info */
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -141,16 +136,13 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
- int i;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 17bf8df7236..656c055a7d9 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -70,13 +70,11 @@ bool ED_mask_spline_select_check(MaskSpline *spline)
bool ED_mask_layer_select_check(MaskLayer *mask_layer)
{
- MaskSpline *spline;
-
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
return false;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
return true;
}
@@ -87,9 +85,7 @@ bool ED_mask_layer_select_check(MaskLayer *mask_layer)
bool ED_mask_select_check(Mask *mask)
{
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (ED_mask_layer_select_check(mask_layer)) {
return true;
}
@@ -119,23 +115,19 @@ void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
{
- MaskSpline *spline;
-
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
if (do_select == true) {
return;
}
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
ED_mask_spline_select_set(spline, do_select);
}
}
void ED_mask_select_toggle_all(Mask *mask, int action)
{
- MaskLayer *mask_layer;
-
if (action == SEL_TOGGLE) {
if (ED_mask_select_check(mask)) {
action = SEL_DESELECT;
@@ -145,7 +137,7 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
}
}
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) {
continue;
@@ -155,11 +147,10 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
/* we don't have generic functions for this, its restricted to this operator
* if one day we need to re-use such functionality, they can be split out */
- MaskSpline *spline;
if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
int i;
for (i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
@@ -175,14 +166,8 @@ void ED_mask_select_toggle_all(Mask *mask, int action)
void ED_mask_select_flush_all(Mask *mask)
{
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
-
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- int i;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
spline->flag &= ~SELECT;
/* intentionally _dont_ do this in the mask layer loop
@@ -191,7 +176,7 @@ void ED_mask_select_flush_all(Mask *mask)
continue;
}
- for (i = 0; i < spline->tot_point; i++) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *cur_point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(cur_point)) {
@@ -454,8 +439,6 @@ static int box_select_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
- int i;
rcti rect;
rctf rectf;
@@ -475,17 +458,15 @@ static int box_select_exec(bContext *C, wmOperator *op)
ED_mask_point_pos(sa, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
- for (i = 0; i < spline->tot_point; i++) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
MaskSplinePoint *point_deform = &points_array[i];
@@ -548,8 +529,6 @@ static bool do_lasso_select_mask(bContext *C,
ARegion *ar = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
- int i;
rcti rect;
bool changed = false;
@@ -564,17 +543,15 @@ static bool do_lasso_select_mask(bContext *C,
BLI_lasso_boundbox(&rect, mcords, moves);
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
- for (i = 0; i < spline->tot_point; i++) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
MaskSplinePoint *point_deform = &points_array[i];
@@ -678,7 +655,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
ARegion *ar = CTX_wm_region(C);
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
int i;
float zoomx, zoomy, offset[2], ellipse[2];
@@ -709,14 +685,12 @@ static int circle_select_exec(bContext *C, wmOperator *op)
}
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
for (i = 0; i < spline->tot_point; i++) {
@@ -836,19 +810,16 @@ void MASK_OT_select_linked_pick(wmOperatorType *ot)
static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
/* do actual selection */
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
if (ED_mask_spline_select_check(spline)) {
ED_mask_spline_select_set(spline, true);
changed = true;
@@ -892,16 +863,13 @@ void MASK_OT_select_linked(wmOperatorType *ot)
static int mask_select_more_less(bContext *C, bool more)
{
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
-
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
- MaskSpline *spline;
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
const bool cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
bool start_sel, end_sel, prev_sel, cur_sel;
int i;
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index 886f7efb1c5..2300289fd3b 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -51,10 +51,9 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
MaskLayerShape *mask_layer_shape;
if (!ED_mask_layer_select_check(mask_layer)) {
@@ -97,10 +96,9 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene = CTX_data_scene(C);
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
MaskLayerShape *mask_layer_shape;
if (!ED_mask_layer_select_check(mask_layer)) {
@@ -146,10 +144,9 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
Scene *scene = CTX_data_scene(C);
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
@@ -169,16 +166,14 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
if (mask_layer_shape_reset->tot_vert == mask_layer_shape->tot_vert) {
int i_abs = 0;
- int i;
- MaskSpline *spline;
MaskLayerShapeElem *shape_ele_src;
MaskLayerShapeElem *shape_ele_dst;
shape_ele_src = (MaskLayerShapeElem *)mask_layer_shape_reset->data;
shape_ele_dst = (MaskLayerShapeElem *)mask_layer_shape->data;
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
if (MASKPOINT_ISSEL_ANY(point)) {
@@ -243,14 +238,12 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
const int frame = CFRA;
Mask *mask = CTX_data_edit_mask(C);
- MaskLayer *mask_layer;
bool changed = false;
const bool do_feather = RNA_boolean_get(op->ptr, "feather");
const bool do_location = RNA_boolean_get(op->ptr, "location");
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
-
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
continue;
}
@@ -319,8 +312,6 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
mask_layer_shape_tmp = mask_layer_shape_tmp_next) {
/* restore */
int i_abs = 0;
- int i;
- MaskSpline *spline;
MaskLayerShapeElem *shape_ele_src;
MaskLayerShapeElem *shape_ele_dst;
@@ -333,8 +324,8 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
shape_ele_src = (MaskLayerShapeElem *)mask_layer_shape_tmp->data;
shape_ele_dst = (MaskLayerShapeElem *)mask_layer_shape_tmp_rekey->data;
- for (spline = mask_layer->splines.first; spline; spline = spline->next) {
- for (i = 0; i < spline->tot_point; i++) {
+ for (MaskSpline *spline = mask_layer->splines.first; spline; spline = spline->next) {
+ for (int i = 0; i < spline->tot_point; i++) {
MaskSplinePoint *point = &spline->points[i];
/* not especially efficient but makes this easier to follow */
@@ -411,10 +402,9 @@ void ED_mask_layer_shape_auto_key(MaskLayer *mask_layer, const int frame)
bool ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
{
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
ED_mask_layer_shape_auto_key(mask_layer, frame);
changed = true;
}
@@ -424,10 +414,9 @@ bool ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame)
bool ED_mask_layer_shape_auto_key_select(Mask *mask, const int frame)
{
- MaskLayer *mask_layer;
bool changed = false;
- for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ for (MaskLayer *mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
if (!ED_mask_layer_select_check(mask_layer)) {
continue;