diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-31 17:36:43 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-04 12:54:59 +0300 |
commit | a81108ae74bde032c004b6a9bfb116d8e43f9283 (patch) | |
tree | 30917a035bbaad81dde37952bc19122d905b9b6c /source/blender/editors/mask | |
parent | e45cfb574ee75b85de084d09fcb8325778806bd2 (diff) |
Masking: Cleanup, naming of mask layer
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_add.c | 125 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 80 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_editaction.c | 183 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_intern.h | 10 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 206 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_relationships.c | 16 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_select.c | 122 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_shapekey.c | 176 |
8 files changed, 469 insertions, 449 deletions
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index 4624611419e..dade81a5daf 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -55,7 +55,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, float tangent[2], const bool use_deform, const bool use_project, - MaskLayer **masklay_r, + MaskLayer **mask_layer_r, MaskSpline **spline_r, MaskSplinePoint **point_r, float *u_r, @@ -64,7 +64,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *point_masklay; + MaskLayer *point_mask_layer; MaskSpline *point_spline; MaskSplinePoint *point = NULL; float dist_best_sq = FLT_MAX, co[2]; @@ -81,16 +81,16 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (MaskLayer *masklay_orig = mask_orig->masklayers.first, - *masklay_eval = mask_eval->masklayers.first; - masklay_orig != NULL; - masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { - if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first, + *mask_layer_eval = mask_eval->masklayers.first; + mask_layer_orig != NULL; + mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) { + if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (MaskSpline *spline_orig = masklay_orig->splines.first, - *spline_eval = masklay_eval->splines.first; + for (MaskSpline *spline_orig = mask_layer_orig->splines.first, + *spline_eval = mask_layer_eval->splines.first; spline_orig != NULL; spline_orig = spline_orig->next, spline_eval = spline_eval->next) { int i; @@ -136,7 +136,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, sub_v2_v2v2(tangent, &diff_points[2 * j + 2], &diff_points[2 * j]); } - point_masklay = masklay_orig; + point_mask_layer = mask_layer_orig; point_spline = spline_orig; point = use_deform ? &spline_orig->points[(cur_point_eval - spline_eval->points_deform)] : @@ -156,8 +156,8 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, } if (point && dist_best_sq < threshold) { - if (masklay_r) { - *masklay_r = point_masklay; + if (mask_layer_r) { + *mask_layer_r = point_mask_layer; } if (spline_r) { @@ -184,8 +184,8 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, return true; } - if (masklay_r) { - *masklay_r = NULL; + if (mask_layer_r) { + *mask_layer_r = NULL; } if (spline_r) { @@ -331,21 +331,22 @@ static void setup_vertex_point(Mask *mask, /* **** add extrude vertex **** */ -static void finSelectedSplinePoint(MaskLayer *masklay, +static void finSelectedSplinePoint(MaskLayer *mask_layer, MaskSpline **spline, MaskSplinePoint **point, bool check_active) { - MaskSpline *cur_spline = masklay->splines.first; + MaskSpline *cur_spline = mask_layer->splines.first; *spline = NULL; *point = NULL; if (check_active) { /* TODO, having an active point but no active spline is possible, why? */ - if (masklay->act_spline && masklay->act_point && MASKPOINT_ISSEL_ANY(masklay->act_point)) { - *spline = masklay->act_spline; - *point = masklay->act_point; + if (mask_layer->act_spline && mask_layer->act_point && + MASKPOINT_ISSEL_ANY(mask_layer->act_point)) { + *spline = mask_layer->act_spline; + *point = mask_layer->act_point; return; } } @@ -397,7 +398,7 @@ static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index) static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2]) { - MaskLayer *masklay; + MaskLayer *mask_layer; MaskSpline *spline; MaskSplinePoint *point = NULL; const float threshold = 9; @@ -412,7 +413,7 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2 tangent, true, true, - &masklay, + &mask_layer, &spline, &point, &u, @@ -432,14 +433,14 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2 setup_vertex_point(mask, spline, new_point, co, u, ctime, NULL, true); /* TODO - we could pass the spline! */ - BKE_mask_layer_shape_changed_add(masklay, - BKE_mask_layer_shape_spline_to_index(masklay, spline) + + BKE_mask_layer_shape_changed_add(mask_layer, + BKE_mask_layer_shape_spline_to_index(mask_layer, spline) + point_index + 1, true, true); - masklay->act_spline = spline; - masklay->act_point = new_point; + mask_layer->act_spline = spline; + mask_layer->act_point = new_point; WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -451,7 +452,7 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2 static bool add_vertex_extrude(const bContext *C, Mask *mask, - MaskLayer *masklay, + MaskLayer *mask_layer, const float co[2]) { Scene *scene = CTX_data_scene(C); @@ -468,11 +469,11 @@ static bool add_vertex_extrude(const bContext *C, bool do_cyclic_correct = false; bool do_prev; /* use prev point rather then next?? */ - if (!masklay) { + if (!mask_layer) { return false; } else { - finSelectedSplinePoint(masklay, &spline, &point, true); + finSelectedSplinePoint(mask_layer, &spline, &point, true); } ED_mask_select_toggle_all(mask, SEL_DESELECT); @@ -533,14 +534,17 @@ static bool add_vertex_extrude(const bContext *C, new_point = &spline->points[point_index + 1]; } - masklay->act_point = new_point; + mask_layer->act_point = new_point; setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false); - if (masklay->splines_shapes.first) { + if (mask_layer->splines_shapes.first) { point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point); - BKE_mask_layer_shape_changed_add( - masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, true, true); + BKE_mask_layer_shape_changed_add(mask_layer, + BKE_mask_layer_shape_spline_to_index(mask_layer, spline) + + point_index, + true, + true); } WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -548,7 +552,7 @@ static bool add_vertex_extrude(const bContext *C, return true; } -static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, const float co[2]) +static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2]) { Scene *scene = CTX_data_scene(C); const float ctime = CFRA; @@ -556,27 +560,30 @@ static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, co MaskSpline *spline; MaskSplinePoint *new_point = NULL, *ref_point = NULL; - if (!masklay) { - /* if there's no masklay currently operationg on, create new one */ - masklay = BKE_mask_layer_new(mask, ""); + if (!mask_layer) { + /* if there's no mask layer currently operationg on, create new one */ + mask_layer = BKE_mask_layer_new(mask, ""); mask->masklay_act = mask->masklay_tot - 1; } ED_mask_select_toggle_all(mask, SEL_DESELECT); - spline = BKE_mask_spline_add(masklay); + spline = BKE_mask_spline_add(mask_layer); - masklay->act_spline = spline; + mask_layer->act_spline = spline; new_point = spline->points; - masklay->act_point = new_point; + mask_layer->act_point = new_point; setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false); { int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point); - BKE_mask_layer_shape_changed_add( - masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index, true, true); + BKE_mask_layer_shape_changed_add(mask_layer, + BKE_mask_layer_shape_spline_to_index(mask_layer, spline) + + point_index, + true, + true); } WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); @@ -587,7 +594,6 @@ static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, co static int add_vertex_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; float co[2]; @@ -596,21 +602,21 @@ static int add_vertex_exec(bContext *C, wmOperator *op) mask = ED_mask_new(C, NULL); } - masklay = BKE_mask_layer_active(mask); + MaskLayer *mask_layer = BKE_mask_layer_active(mask); - if (masklay && masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { - masklay = NULL; + if (mask_layer && mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + mask_layer = NULL; } RNA_float_get_array(op->ptr, "location", co); /* TODO, having an active point but no active spline is possible, why? */ - if (masklay && masklay->act_spline && masklay->act_point && - MASKPOINT_ISSEL_ANY(masklay->act_point)) { + if (mask_layer && mask_layer->act_spline && mask_layer->act_point && + MASKPOINT_ISSEL_ANY(mask_layer->act_point)) { /* cheap trick - double click for cyclic */ - MaskSpline *spline = masklay->act_spline; - MaskSplinePoint *point = masklay->act_point; + MaskSpline *spline = mask_layer->act_spline; + MaskSplinePoint *point = mask_layer->act_point; const bool is_sta = (point == spline->points); const bool is_end = (point == &spline->points[spline->tot_point - 1]); @@ -639,14 +645,14 @@ static int add_vertex_exec(bContext *C, wmOperator *op) } if (!add_vertex_subdivide(C, mask, co)) { - if (!add_vertex_extrude(C, mask, masklay, co)) { + if (!add_vertex_extrude(C, mask, mask_layer, co)) { return OPERATOR_CANCELLED; } } } else { if (!add_vertex_subdivide(C, mask, co)) { - if (!add_vertex_new(C, mask, masklay, co)) { + if (!add_vertex_new(C, mask, mask_layer, co)) { return OPERATOR_CANCELLED; } } @@ -704,7 +710,7 @@ void MASK_OT_add_vertex(wmOperatorType *ot) static int add_feather_vertex_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; MaskSpline *spline; MaskSplinePoint *point = NULL; const float threshold = 9; @@ -717,8 +723,19 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } - if (ED_mask_find_nearest_diff_point( - C, mask, co, threshold, true, NULL, true, true, &masklay, &spline, &point, &u, NULL)) { + if (ED_mask_find_nearest_diff_point(C, + mask, + co, + threshold, + true, + NULL, + true, + true, + &mask_layer, + &spline, + &point, + &u, + NULL)) { float w = BKE_mask_point_weight(spline, point, u); float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 85fedac05ce..4e75d49987e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -56,13 +56,13 @@ #include "mask_intern.h" /* own include */ -static void mask_spline_color_get(MaskLayer *masklay, +static void mask_spline_color_get(MaskLayer *mask_layer, MaskSpline *spline, const bool is_sel, unsigned char r_rgb[4]) { if (is_sel) { - if (masklay->act_spline == spline) { + if (mask_layer->act_spline == spline) { r_rgb[0] = r_rgb[1] = r_rgb[2] = 255; } else { @@ -78,7 +78,7 @@ static void mask_spline_color_get(MaskLayer *masklay, r_rgb[3] = 255; } -static void mask_spline_feather_color_get(MaskLayer *UNUSED(masklay), +static void mask_spline_feather_color_get(MaskLayer *UNUSED(mask_layer), MaskSpline *UNUSED(spline), const bool is_sel, unsigned char r_rgb[4]) @@ -187,13 +187,13 @@ static void draw_single_handle(const MaskLayer *mask_layer, /* return non-zero if spline is selected */ static void draw_spline_points(const bContext *C, - MaskLayer *masklay, + MaskLayer *mask_layer, MaskSpline *spline, const char draw_flag, const char draw_type) { const bool is_spline_sel = (spline->flag & SELECT) && - (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; + (mask_layer->restrictflag & MASK_RESTRICT_SELECT) == 0; const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0; unsigned char rgb_spline[4]; @@ -216,7 +216,7 @@ static void draw_spline_points(const bContext *C, /* TODO, add this to sequence editor */ float handle_size = 2.0f * UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE) * U.pixelsize; - mask_spline_color_get(masklay, spline, is_spline_sel, rgb_spline); + mask_spline_color_get(mask_layer, spline, is_spline_sel, rgb_spline); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -249,7 +249,7 @@ static void draw_spline_points(const bContext *C, } if (sel) { - if (point == masklay->act_point) { + if (point == mask_layer->act_point) { immUniformColor3f(1.0f, 1.0f, 1.0f); } else { @@ -300,7 +300,7 @@ static void draw_spline_points(const bContext *C, mask_point_undistort_pos(sc, handle, handle); } draw_single_handle( - masklay, point, MASK_WHICH_HANDLE_STICK, draw_type, handle_size, vert, handle); + mask_layer, point, MASK_WHICH_HANDLE_STICK, draw_type, handle_size, vert, handle); } else { float handle_left[2], handle_right[2]; @@ -311,9 +311,9 @@ static void draw_spline_points(const bContext *C, mask_point_undistort_pos(sc, handle_left, handle_left); } draw_single_handle( - masklay, point, MASK_WHICH_HANDLE_LEFT, draw_type, handle_size, vert, handle_left); + mask_layer, point, MASK_WHICH_HANDLE_LEFT, draw_type, handle_size, vert, handle_left); draw_single_handle( - masklay, point, MASK_WHICH_HANDLE_RIGHT, draw_type, handle_size, vert, handle_right); + mask_layer, point, MASK_WHICH_HANDLE_RIGHT, draw_type, handle_size, vert, handle_right); } /* bind program in loop so it does not interfere with draw_single_handle */ @@ -321,7 +321,7 @@ static void draw_spline_points(const bContext *C, /* draw CV point */ if (MASKPOINT_ISSEL_KNOT(point)) { - if (point == masklay->act_point) { + if (point == mask_layer->act_point) { immUniformColor3f(1.0f, 1.0f, 1.0f); } else { @@ -352,7 +352,7 @@ static void draw_spline_points(const bContext *C, immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA); immUniform1f("outlineWidth", 1.5f); - if (masklay->act_spline == spline) { + if (mask_layer->act_spline == spline) { immUniformColor3f(1.0f, 1.0f, 1.0f); } else { @@ -519,7 +519,7 @@ static void mask_draw_curve_type(const bContext *C, } static void draw_spline_curve(const bContext *C, - MaskLayer *masklay, + MaskLayer *mask_layer, MaskSpline *spline, const char draw_flag, const char draw_type, @@ -533,7 +533,7 @@ static void draw_spline_curve(const bContext *C, unsigned char rgb_tmp[4]; const bool is_spline_sel = (spline->flag & SELECT) && - (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0; + (mask_layer->restrictflag & MASK_RESTRICT_SELECT) == 0; const bool is_smooth = (draw_flag & MASK_DRAWFLAG_SMOOTH) != 0; const bool is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; @@ -557,7 +557,7 @@ static void draw_spline_curve(const bContext *C, spline, &tot_feather_point, resol, (is_fill != false)); /* draw feather */ - mask_spline_feather_color_get(masklay, spline, is_spline_sel, rgb_tmp); + mask_spline_feather_color_get(mask_layer, spline, is_spline_sel, rgb_tmp); mask_draw_curve_type( C, spline, feather_points, tot_feather_point, true, is_active, rgb_tmp, draw_type); @@ -581,7 +581,7 @@ static void draw_spline_curve(const bContext *C, MEM_freeN(feather_points); /* draw main curve */ - mask_spline_color_get(masklay, spline, is_spline_sel, rgb_tmp); + mask_spline_color_get(mask_layer, spline, is_spline_sel, rgb_tmp); mask_draw_curve_type( C, spline, diff_points, tot_diff_point, false, is_active, rgb_tmp, draw_type); MEM_freeN(diff_points); @@ -591,37 +591,38 @@ static void draw_spline_curve(const bContext *C, } } -static void draw_masklays(const bContext *C, - Mask *mask, - const char draw_flag, - const char draw_type, - const int width, - const int height) +static void draw_mask_layers(const bContext *C, + Mask *mask, + const char draw_flag, + const char draw_type, + const int width, + const int height) { GPU_blend(true); GPU_blend_set_func_separate( GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); GPU_program_point_size(true); - MaskLayer *masklay; + MaskLayer *mask_layer; int i; - for (masklay = mask->masklayers.first, i = 0; masklay; masklay = masklay->next, i++) { + 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 (masklay->restrictflag & MASK_RESTRICT_VIEW) { + if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { /* draw curve itself first... */ - draw_spline_curve(C, masklay, spline, draw_flag, draw_type, is_active, width, height); + draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height); - if (!(masklay->restrictflag & MASK_RESTRICT_SELECT)) { + if (!(mask_layer->restrictflag & MASK_RESTRICT_SELECT)) { /* ...and then handles over the curve so they're nicely visible */ - draw_spline_points(C, masklay, spline, draw_flag, draw_type); + draw_spline_points(C, mask_layer, spline, draw_flag, draw_type); } /* show undeform for testing */ @@ -629,8 +630,8 @@ static void draw_masklays(const bContext *C, void *back = spline->points_deform; spline->points_deform = NULL; - draw_spline_curve(C, masklay, spline, draw_flag, draw_type, is_active, width, height); - draw_spline_points(C, masklay, spline, draw_flag, draw_type); + draw_spline_curve(C, mask_layer, spline, draw_flag, draw_type, is_active, width, height); + draw_spline_points(C, mask_layer, spline, draw_flag, draw_type); spline->points_deform = back; } } @@ -652,7 +653,7 @@ void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type) ED_mask_get_size(sa, &width, &height); - draw_masklays(C, mask, draw_flag, draw_type, width, height); + draw_mask_layers(C, mask, draw_flag, draw_type, width, height); } static float *mask_rasterize(Mask *mask, const int width, const int height) @@ -784,7 +785,7 @@ void ED_mask_draw_region( } /* draw! */ - draw_masklays(C, mask_eval, draw_flag, draw_type, width, height); + draw_mask_layers(C, mask_eval, draw_flag, draw_type, width, height); if (do_draw_cb) { ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); @@ -797,10 +798,10 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra { const float framelen = ar->winx / (float)(efra - sfra + 1); - MaskLayer *masklay = BKE_mask_layer_active(mask); + MaskLayer *mask_layer = BKE_mask_layer_active(mask); - if (masklay) { - unsigned int num_lines = BLI_listbase_count(&masklay->splines_shapes); + if (mask_layer) { + unsigned int num_lines = BLI_listbase_count(&mask_layer->splines_shapes); if (num_lines > 0) { /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ @@ -815,9 +816,10 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra immBegin(GPU_PRIM_LINES, 2 * num_lines); - for (MaskLayerShape *masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { - int frame = masklay_shape->frame; + for (MaskLayerShape *mask_layer_shape = mask_layer->splines_shapes.first; + mask_layer_shape != NULL; + mask_layer_shape = mask_layer_shape->next) { + int frame = mask_layer_shape->frame; /* draw_keyframe(i, CFRA, sfra, framelen, 1); */ int height = (frame == cfra) ? 22 : 10; diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 985fa58cace..33f4bab14ec 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -53,22 +53,22 @@ /* Generics - Loopers */ /* Loops over the mask-frames for a mask-layer, and applies the given callback */ -bool ED_masklayer_frames_looper(MaskLayer *masklay, +bool ED_masklayer_frames_looper(MaskLayer *mask_layer, Scene *scene, - short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) + short (*mask_layer_shape_cb)(MaskLayerShape *, Scene *)) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; /* error checker */ - if (masklay == NULL) { + if (mask_layer == NULL) { return false; } /* do loop */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { /* execute callback */ - if (masklay_shape_cb(masklay_shape, scene)) { + if (mask_layer_shape_cb(mask_layer_shape, scene)) { return true; } } @@ -81,24 +81,24 @@ bool ED_masklayer_frames_looper(MaskLayer *masklay, /* Data Conversion Tools */ /* make a listing all the mask-frames in a layer as cfraelems */ -void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, bool onlysel) +void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool onlysel) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; CfraElem *ce; /* error checking */ - if (ELEM(NULL, masklay, elems)) { + if (ELEM(NULL, mask_layer, elems)) { return; } /* loop through mask-frames, adding */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { - if ((onlysel == false) || (masklay_shape->flag & MASK_SHAPE_SELECT)) { + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { + if ((onlysel == false) || (mask_layer_shape->flag & MASK_SHAPE_SELECT)) { ce = MEM_callocN(sizeof(CfraElem), "CfraElem"); - ce->cfra = (float)masklay_shape->frame; - ce->sel = (masklay_shape->flag & MASK_SHAPE_SELECT) ? 1 : 0; + ce->cfra = (float)mask_layer_shape->frame; + ce->sel = (mask_layer_shape->flag & MASK_SHAPE_SELECT) ? 1 : 0; BLI_addtail(elems, ce); } @@ -109,19 +109,19 @@ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, bool onlys /* Selection Tools */ /* check if one of the frames in this layer is selected */ -bool ED_masklayer_frame_select_check(MaskLayer *masklay) +bool ED_masklayer_frame_select_check(MaskLayer *mask_layer) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; /* error checking */ - if (masklay == NULL) { + if (mask_layer == NULL) { return 0; } /* stop at the first one found */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { - if (masklay_shape->flag & MASK_SHAPE_SELECT) { + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { return 1; } } @@ -131,120 +131,120 @@ bool ED_masklayer_frame_select_check(MaskLayer *masklay) } /* helper function - select mask-frame based on SELECT_* mode */ -static void masklayshape_select(MaskLayerShape *masklay_shape, short select_mode) +static void mask_layer_shape_select(MaskLayerShape *mask_layer_shape, short select_mode) { - if (masklay_shape == NULL) { + if (mask_layer_shape == NULL) { return; } switch (select_mode) { case SELECT_ADD: - masklay_shape->flag |= MASK_SHAPE_SELECT; + mask_layer_shape->flag |= MASK_SHAPE_SELECT; break; case SELECT_SUBTRACT: - masklay_shape->flag &= ~MASK_SHAPE_SELECT; + mask_layer_shape->flag &= ~MASK_SHAPE_SELECT; break; case SELECT_INVERT: - masklay_shape->flag ^= MASK_SHAPE_SELECT; + mask_layer_shape->flag ^= MASK_SHAPE_SELECT; break; } } /* set all/none/invert select (like above, but with SELECT_* modes) */ -void ED_mask_select_frames(MaskLayer *masklay, short select_mode) +void ED_mask_select_frames(MaskLayer *mask_layer, short select_mode) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; /* error checking */ - if (masklay == NULL) { + if (mask_layer == NULL) { return; } /* handle according to mode */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { - masklayshape_select(masklay_shape, select_mode); + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { + mask_layer_shape_select(mask_layer_shape, select_mode); } } /* set all/none/invert select */ -void ED_masklayer_frame_select_set(MaskLayer *masklay, short mode) +void ED_masklayer_frame_select_set(MaskLayer *mask_layer, short mode) { /* error checking */ - if (masklay == NULL) { + if (mask_layer == NULL) { return; } /* now call the standard function */ - ED_mask_select_frames(masklay, mode); + ED_mask_select_frames(mask_layer, mode); } /* select the frame in this layer that occurs on this frame (there should only be one at most) */ -void ED_mask_select_frame(MaskLayer *masklay, int selx, short select_mode) +void ED_mask_select_frame(MaskLayer *mask_layer, int selx, short select_mode) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; - if (masklay == NULL) { + if (mask_layer == NULL) { return; } - masklay_shape = BKE_mask_layer_shape_find_frame(masklay, selx); + mask_layer_shape = BKE_mask_layer_shape_find_frame(mask_layer, selx); - if (masklay_shape) { - masklayshape_select(masklay_shape, select_mode); + if (mask_layer_shape) { + mask_layer_shape_select(mask_layer_shape, select_mode); } } /* select the frames in this layer that occur within the bounds specified */ -void ED_masklayer_frames_select_box(MaskLayer *masklay, float min, float max, short select_mode) +void ED_masklayer_frames_select_box(MaskLayer *mask_layer, float min, float max, short select_mode) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; - if (masklay == NULL) { + if (mask_layer == NULL) { return; } /* only select those frames which are in bounds */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { - if (IN_RANGE(masklay_shape->frame, min, max)) { - masklayshape_select(masklay_shape, select_mode); + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { + if (IN_RANGE(mask_layer_shape->frame, min, max)) { + mask_layer_shape_select(mask_layer_shape, select_mode); } } } /* select the frames in this layer that occur within the lasso/circle region specified */ void ED_masklayer_frames_select_region(KeyframeEditData *ked, - MaskLayer *masklay, + MaskLayer *mask_layer, short tool, short select_mode) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; - if (masklay == NULL) { + if (mask_layer == NULL) { return; } /* only select frames which are within the region */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { /* construct a dummy point coordinate to do this testing with */ float pt[2] = {0}; - pt[0] = masklay_shape->frame; + pt[0] = mask_layer_shape->frame; pt[1] = ked->channel_y; /* check the necessary regions */ if (tool == BEZT_OK_CHANNEL_LASSO) { /* Lasso */ if (keyframe_region_lasso_test(ked->data, pt)) { - masklayshape_select(masklay_shape, select_mode); + mask_layer_shape_select(mask_layer_shape, select_mode); } } else if (tool == BEZT_OK_CHANNEL_CIRCLE) { /* Circle */ if (keyframe_region_circle_test(ked->data, pt)) { - masklayshape_select(masklay_shape, select_mode); + mask_layer_shape_select(mask_layer_shape, select_mode); } } } @@ -254,23 +254,23 @@ void ED_masklayer_frames_select_region(KeyframeEditData *ked, /* Frame Editing Tools */ /* Delete selected frames */ -bool ED_masklayer_frames_delete(MaskLayer *masklay) +bool ED_masklayer_frames_delete(MaskLayer *mask_layer) { - MaskLayerShape *masklay_shape, *masklay_shape_next; + MaskLayerShape *mask_layer_shape, *mask_layer_shape_next; bool changed = false; /* error checking */ - if (masklay == NULL) { + if (mask_layer == NULL) { return false; } /* check for frames to delete */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape_next) { - masklay_shape_next = masklay_shape->next; + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape_next) { + mask_layer_shape_next = mask_layer_shape->next; - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - BKE_mask_layer_shape_unlink(masklay, masklay_shape); + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + BKE_mask_layer_shape_unlink(mask_layer, mask_layer_shape); changed = true; } } @@ -279,29 +279,30 @@ bool ED_masklayer_frames_delete(MaskLayer *masklay) } /* Duplicate selected frames from given mask-layer */ -void ED_masklayer_frames_duplicate(MaskLayer *masklay) +void ED_masklayer_frames_duplicate(MaskLayer *mask_layer) { - MaskLayerShape *masklay_shape, *gpfn; + MaskLayerShape *mask_layer_shape, *gpfn; /* error checking */ - if (masklay == NULL) { + if (mask_layer == NULL) { return; } /* duplicate selected frames */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = gpfn) { - gpfn = masklay_shape->next; + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = gpfn) { + gpfn = mask_layer_shape->next; /* duplicate this frame */ - if (masklay_shape->flag & MASK_SHAPE_SELECT) { + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { MaskLayerShape *mask_shape_dupe; /* duplicate frame, and deselect self */ - mask_shape_dupe = BKE_mask_layer_shape_duplicate(masklay_shape); - masklay_shape->flag &= ~MASK_SHAPE_SELECT; + mask_shape_dupe = BKE_mask_layer_shape_duplicate(mask_layer_shape); + mask_layer_shape->flag &= ~MASK_SHAPE_SELECT; /* XXX - how to handle duplicate frames? */ - BLI_insertlinkafter(&masklay->splines_shapes, masklay_shape, mask_shape_dupe); + BLI_insertlinkafter(&mask_layer->splines_shapes, mask_layer_shape, mask_shape_dupe); } } } @@ -309,55 +310,55 @@ void ED_masklayer_frames_duplicate(MaskLayer *masklay) /* -------------------------------------- */ /* Snap Tools */ -static short snap_masklayer_nearest(MaskLayerShape *masklay_shape, Scene *UNUSED(scene)) +static short snap_mask_layer_nearest(MaskLayerShape *mask_layer_shape, Scene *UNUSED(scene)) { - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - masklay_shape->frame = (int)(floor(masklay_shape->frame + 0.5)); + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + mask_layer_shape->frame = (int)(floor(mask_layer_shape->frame + 0.5)); } return 0; } -static short snap_masklayer_nearestsec(MaskLayerShape *masklay_shape, Scene *scene) +static short snap_mask_layer_nearestsec(MaskLayerShape *mask_layer_shape, Scene *scene) { float secf = (float)FPS; - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - masklay_shape->frame = (int)(floorf(masklay_shape->frame / secf + 0.5f) * secf); + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + mask_layer_shape->frame = (int)(floorf(mask_layer_shape->frame / secf + 0.5f) * secf); } return 0; } -static short snap_masklayer_cframe(MaskLayerShape *masklay_shape, Scene *scene) +static short snap_mask_layer_cframe(MaskLayerShape *mask_layer_shape, Scene *scene) { - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - masklay_shape->frame = (int)CFRA; + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + mask_layer_shape->frame = (int)CFRA; } return 0; } -static short snap_masklayer_nearmarker(MaskLayerShape *masklay_shape, Scene *scene) +static short snap_mask_layer_nearmarker(MaskLayerShape *mask_layer_shape, Scene *scene) { - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - masklay_shape->frame = (int)ED_markers_find_nearest_marker_time(&scene->markers, - (float)masklay_shape->frame); + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + mask_layer_shape->frame = (int)ED_markers_find_nearest_marker_time( + &scene->markers, (float)mask_layer_shape->frame); } return 0; } /* snap selected frames to ... */ -void ED_masklayer_snap_frames(MaskLayer *masklay, Scene *scene, short mode) +void ED_masklayer_snap_frames(MaskLayer *mask_layer, Scene *scene, short mode) { switch (mode) { case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */ - ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearest); + ED_masklayer_frames_looper(mask_layer, scene, snap_mask_layer_nearest); break; case SNAP_KEYS_CURFRAME: /* snap to current frame */ - ED_masklayer_frames_looper(masklay, scene, snap_masklayer_cframe); + ED_masklayer_frames_looper(mask_layer, scene, snap_mask_layer_cframe); break; case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */ - ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearmarker); + ED_masklayer_frames_looper(mask_layer, scene, snap_mask_layer_nearmarker); break; case SNAP_KEYS_NEARSEC: /* snap to nearest second */ - ED_masklayer_frames_looper(masklay, scene, snap_masklayer_nearestsec); + ED_masklayer_frames_looper(mask_layer, scene, snap_mask_layer_nearestsec); break; default: /* just in case */ break; diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index 67785f1ae46..7cf92a9051a 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -39,7 +39,7 @@ bool ED_mask_find_nearest_diff_point(const struct bContext *C, float tangent[2], const bool use_deform, const bool use_project, - struct MaskLayer **masklay_r, + struct MaskLayer **mask_layer_r, struct MaskSpline **spline_r, struct MaskSplinePoint **point_r, float *u_r, @@ -76,7 +76,7 @@ bool ED_mask_feather_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], const float threshold, - struct MaskLayer **masklay_r, + struct MaskLayer **mask_layer_r, struct MaskSpline **spline_r, struct MaskSplinePoint **point_r, struct MaskSplinePointUW **uw_r, @@ -86,7 +86,7 @@ struct MaskSplinePoint *ED_mask_point_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], const float threshold, - struct MaskLayer **masklay_r, + struct MaskLayer **mask_layer_r, struct MaskSpline **spline_r, eMaskWhichHandle *which_handle_r, float *score); @@ -114,11 +114,11 @@ void MASK_OT_select_more(struct wmOperatorType *ot); void MASK_OT_select_less(struct wmOperatorType *ot); bool ED_mask_spline_select_check(struct MaskSpline *spline); -bool ED_mask_layer_select_check(struct MaskLayer *masklay); +bool ED_mask_layer_select_check(struct MaskLayer *mask_layer); bool ED_mask_select_check(struct Mask *mask); void ED_mask_spline_select_set(struct MaskSpline *spline, const bool do_select); -void ED_mask_layer_select_set(struct MaskLayer *masklay, const bool do_select); +void ED_mask_layer_select_set(struct MaskLayer *mask_layer, const bool do_select); void ED_mask_select_toggle_all(struct Mask *mask, int action); void ED_mask_select_flush_all(struct Mask *mask); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index c91f431ad20..b40bddacb49 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -69,7 +69,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], const float threshold, - MaskLayer **masklay_r, + MaskLayer **mask_layer_r, MaskSpline **spline_r, eMaskWhichHandle *which_handle_r, float *score) @@ -77,7 +77,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *point_masklay = NULL; + MaskLayer *point_mask_layer = NULL; MaskSpline *point_spline = NULL; MaskSplinePoint *point = NULL; float co[2]; @@ -95,17 +95,17 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (MaskLayer *masklay_orig = mask_orig->masklayers.first, - *masklay_eval = mask_eval->masklayers.first; - masklay_orig != NULL; - masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { + for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first, + *mask_layer_eval = mask_eval->masklayers.first; + mask_layer_orig != NULL; + mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) { - if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (MaskSpline *spline_orig = masklay_orig->splines.first, - *spline_eval = masklay_eval->splines.first; + for (MaskSpline *spline_orig = mask_layer_orig->splines.first, + *spline_eval = mask_layer_eval->splines.first; spline_orig != NULL; spline_orig = spline_orig->next, spline_eval = spline_eval->next) { MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline_eval); @@ -124,7 +124,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, if (cur_len_sq < len_sq) { point_spline = spline_orig; - point_masklay = masklay_orig; + point_mask_layer = mask_layer_orig; point = cur_point_orig; len_sq = cur_len_sq; which_handle = MASK_WHICH_HANDLE_NONE; @@ -174,7 +174,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, } if (cur_len_sq <= len_sq && cur_which_handle != MASK_WHICH_HANDLE_NONE) { - point_masklay = masklay_orig; + point_mask_layer = mask_layer_orig; point_spline = spline_orig; point = cur_point_orig; len_sq = cur_len_sq; @@ -185,8 +185,8 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, } if (len_sq < threshold_sq) { - if (masklay_r) { - *masklay_r = point_masklay; + if (mask_layer_r) { + *mask_layer_r = point_mask_layer; } if (spline_r) { @@ -204,8 +204,8 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, return point; } - if (masklay_r) { - *masklay_r = NULL; + if (mask_layer_r) { + *mask_layer_r = NULL; } if (spline_r) { @@ -223,7 +223,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], const float threshold, - MaskLayer **masklay_r, + MaskLayer **mask_layer_r, MaskSpline **spline_r, MaskSplinePoint **point_r, MaskSplinePointUW **uw_r, @@ -232,7 +232,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); - MaskLayer *point_masklay = NULL; + MaskLayer *point_mask_layer = NULL; MaskSpline *point_spline = NULL; MaskSplinePoint *point = NULL; MaskSplinePointUW *uw = NULL; @@ -250,13 +250,13 @@ bool ED_mask_feather_find_nearest(const bContext *C, co[0] = normal_co[0] * scalex; co[1] = normal_co[1] * scaley; - for (MaskLayer *masklay_orig = mask_orig->masklayers.first, - *masklay_eval = mask_eval->masklayers.first; - masklay_orig != NULL; - masklay_orig = masklay_orig->next, masklay_eval = masklay_eval->next) { + for (MaskLayer *mask_layer_orig = mask_orig->masklayers.first, + *mask_layer_eval = mask_eval->masklayers.first; + mask_layer_orig != NULL; + mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) { - for (MaskSpline *spline_orig = masklay_orig->splines.first, - *spline_eval = masklay_eval->splines.first; + for (MaskSpline *spline_orig = mask_layer_orig->splines.first, + *spline_eval = mask_layer_eval->splines.first; spline_orig != NULL; spline_orig = spline_orig->next, spline_eval = spline_eval->next) { // MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline); @@ -264,7 +264,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, int i, tot_feather_point; float(*feather_points)[2], (*fp)[2]; - if (masklay_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer_orig->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } @@ -291,7 +291,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, uw = &cur_point_orig->uw[j - 1]; } - point_masklay = masklay_orig; + point_mask_layer = mask_layer_orig; point_spline = spline_orig; point = cur_point_orig; len = cur_len_sq; @@ -306,8 +306,8 @@ bool ED_mask_feather_find_nearest(const bContext *C, } if (len < threshold_sq) { - if (masklay_r) { - *masklay_r = point_masklay; + if (mask_layer_r) { + *mask_layer_r = point_mask_layer; } if (spline_r) { @@ -329,8 +329,8 @@ bool ED_mask_feather_find_nearest(const bContext *C, return true; } - if (masklay_r) { - *masklay_r = NULL; + if (mask_layer_r) { + *mask_layer_r = NULL; } if (spline_r) { @@ -428,9 +428,9 @@ void MASK_OT_new(wmOperatorType *ot) RNA_def_string(ot->srna, "name", NULL, MAX_ID_NAME - 2, "Name", "Name of new mask"); } -/******************** create new masklay *********************/ +/******************** create new mask layer *********************/ -static int masklay_new_exec(bContext *C, wmOperator *op) +static int mask_layer_new_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); char name[MAX_ID_NAME - 2]; @@ -454,7 +454,7 @@ void MASK_OT_layer_new(wmOperatorType *ot) ot->idname = "MASK_OT_layer_new"; /* api callbacks */ - ot->exec = masklay_new_exec; + ot->exec = mask_layer_new_exec; ot->poll = ED_maskedit_poll; /* flags */ @@ -466,13 +466,13 @@ void MASK_OT_layer_new(wmOperatorType *ot) /******************** remove mask layer *********************/ -static int masklay_remove_exec(bContext *C, wmOperator *UNUSED(op)) +static int mask_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay = BKE_mask_layer_active(mask); + MaskLayer *mask_layer = BKE_mask_layer_active(mask); - if (masklay) { - BKE_mask_layer_remove(mask, masklay); + if (mask_layer) { + BKE_mask_layer_remove(mask, mask_layer); WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); DEG_id_tag_update(&mask->id, ID_RECALC_COPY_ON_WRITE); @@ -489,7 +489,7 @@ void MASK_OT_layer_remove(wmOperatorType *ot) ot->idname = "MASK_OT_layer_remove"; /* api callbacks */ - ot->exec = masklay_remove_exec; + ot->exec = mask_layer_remove_exec; ot->poll = ED_maskedit_poll; /* flags */ @@ -511,7 +511,7 @@ typedef struct SlidePointData { short event_invoke_type; int action; Mask *mask; - MaskLayer *masklay; + MaskLayer *mask_layer; MaskSpline *spline, *orig_spline; MaskSplinePoint *point; MaskSplinePointUW *uw; @@ -719,7 +719,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * Mask *mask = CTX_data_edit_mask(C); SlidePointData *customdata = NULL; - MaskLayer *masklay, *cv_masklay, *feather_masklay; + MaskLayer *mask_layer, *cv_mask_layer, *feather_mask_layer; MaskSpline *spline, *cv_spline, *feather_spline; MaskSplinePoint *point, *cv_point, *feather_point; MaskSplinePointUW *uw = NULL; @@ -733,13 +733,13 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * ED_mask_get_size(sa, &width, &height); cv_point = ED_mask_point_find_nearest( - C, mask, co, threshold, &cv_masklay, &cv_spline, &which_handle, &cv_score); + C, mask, co, threshold, &cv_mask_layer, &cv_spline, &which_handle, &cv_score); if (ED_mask_feather_find_nearest(C, mask, co, threshold, - &feather_masklay, + &feather_mask_layer, &feather_spline, &feather_point, &uw, @@ -747,7 +747,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * if (slide_feather || !cv_point || feather_score < cv_score) { action = SLIDE_ACTION_FEATHER; - masklay = feather_masklay; + mask_layer = feather_mask_layer; spline = feather_spline; point = feather_point; } @@ -761,13 +761,13 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * action = SLIDE_ACTION_POINT; } - masklay = cv_masklay; + mask_layer = cv_mask_layer; spline = cv_spline; point = cv_point; } if (action == SLIDE_ACTION_NONE) { - if (spline_under_mouse_get(C, mask, co, &masklay, &spline)) { + if (spline_under_mouse_get(C, mask, co, &mask_layer, &spline)) { action = SLIDE_ACTION_SPLINE; point = NULL; } @@ -777,7 +777,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * customdata = MEM_callocN(sizeof(SlidePointData), "mask slide point data"); customdata->event_invoke_type = event->type; customdata->mask = mask; - customdata->masklay = masklay; + customdata->mask_layer = mask_layer; customdata->spline = spline; customdata->point = point; customdata->width = width; @@ -790,7 +790,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent * if (customdata->action != SLIDE_ACTION_SPLINE) { customdata->old_h1 = point->bezt.h1; customdata->old_h2 = point->bezt.h2; - select_sliding_point(mask, masklay, spline, point, which_handle); + select_sliding_point(mask, mask_layer, spline, point, which_handle); check_sliding_handle_type(point, which_handle); } @@ -850,8 +850,8 @@ static int slide_point_invoke(bContext *C, wmOperator *op, const wmEvent *event) WM_event_add_modal_handler(C, op); - slidedata->masklay->act_spline = slidedata->spline; - slidedata->masklay->act_point = slidedata->point; + slidedata->mask_layer->act_spline = slidedata->spline; + slidedata->mask_layer->act_point = slidedata->point; WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); @@ -1140,7 +1140,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) /* dont key sliding feather uw's */ if ((data->action == SLIDE_ACTION_FEATHER && data->uw) == false) { if (IS_AUTOKEY_ON(scene)) { - ED_mask_layer_shape_auto_key(data->masklay, CFRA); + ED_mask_layer_shape_auto_key(data->mask_layer, CFRA); } } @@ -1586,16 +1586,16 @@ 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 *masklay; + MaskLayer *mask_layer; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { if (ED_mask_spline_select_check(spline)) { spline->flag ^= MASK_SPLINE_CYCLIC; } @@ -1666,18 +1666,18 @@ static void delete_feather_points(MaskSplinePoint *point) static int delete_exec(bContext *C, wmOperator *UNUSED(op)) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; int mask_layer_shape_ofs = 0; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - spline = masklay->splines.first; + spline = mask_layer->splines.first; while (spline) { const int tot_point_orig = spline->tot_point; @@ -1695,15 +1695,15 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) if (count == 0) { /* delete the whole spline */ - BLI_remlink(&masklay->splines, spline); + BLI_remlink(&mask_layer->splines, spline); BKE_mask_spline_free(spline); - if (spline == masklay->act_spline) { - masklay->act_spline = NULL; - masklay->act_point = NULL; + if (spline == mask_layer->act_spline) { + mask_layer->act_spline = NULL; + mask_layer->act_point = NULL; } - BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs, tot_point_orig); + BKE_mask_layer_shape_changed_remove(mask_layer, mask_layer_shape_ofs, tot_point_orig); } else { MaskSplinePoint *new_points; @@ -1715,8 +1715,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) MaskSplinePoint *point = &spline->points[i]; if (!MASKPOINT_ISSEL_ANY(point)) { - if (point == masklay->act_point) { - masklay->act_point = &new_points[j]; + if (point == mask_layer->act_point) { + mask_layer->act_point = &new_points[j]; } delete_feather_points(point); @@ -1725,14 +1725,14 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) j++; } else { - if (point == masklay->act_point) { - masklay->act_point = NULL; + if (point == mask_layer->act_point) { + mask_layer->act_point = NULL; } BKE_mask_point_free(point); spline->tot_point--; - BKE_mask_layer_shape_changed_remove(masklay, mask_layer_shape_ofs + j, 1); + BKE_mask_layer_shape_changed_remove(mask_layer, mask_layer_shape_ofs + j, 1); } } @@ -1750,8 +1750,8 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) /* not essential but confuses users when there are keys with no data! * assume if they delete all data from the layer they also dont care about keys */ - if (BLI_listbase_is_empty(&masklay->splines)) { - BKE_mask_layer_free_shapes(masklay); + if (BLI_listbase_is_empty(&mask_layer->splines)) { + BKE_mask_layer_free_shapes(mask_layer); } } @@ -1787,22 +1787,22 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; /* do actual selection */ - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; bool changed_layer = false; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { if (ED_mask_spline_select_check(spline)) { - BKE_mask_spline_direction_switch(masklay, spline); + BKE_mask_spline_direction_switch(mask_layer, spline); changed = true; changed_layer = true; } @@ -1810,7 +1810,7 @@ static int mask_switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) if (changed_layer) { if (IS_AUTOKEY_ON(scene)) { - ED_mask_layer_shape_auto_key(masklay, CFRA); + ED_mask_layer_shape_auto_key(mask_layer, CFRA); } } } @@ -1847,21 +1847,21 @@ 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 *masklay; + MaskLayer *mask_layer; int i; bool changed = false; /* do actual selection */ - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; bool changed_layer = false; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -1875,7 +1875,7 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op) if (changed_layer) { if (IS_AUTOKEY_ON(scene)) { - ED_mask_layer_shape_auto_key(masklay, CFRA); + ED_mask_layer_shape_auto_key(mask_layer, CFRA); } } } @@ -1913,20 +1913,20 @@ 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 *masklay; + MaskLayer *mask_layer; int handle_type = RNA_enum_get(op->ptr, "type"); bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; int i; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -1999,15 +1999,15 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; const bool select = RNA_boolean_get(op->ptr, "select"); - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (masklay->restrictflag & OB_RESTRICT_VIEWPORT) { - ED_mask_layer_select_set(masklay, select); - masklay->restrictflag &= ~OB_RESTRICT_VIEWPORT; + if (mask_layer->restrictflag & OB_RESTRICT_VIEWPORT) { + ED_mask_layer_select_set(mask_layer, select); + mask_layer->restrictflag &= ~OB_RESTRICT_VIEWPORT; changed = true; } } @@ -2044,32 +2044,32 @@ 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 *masklay; + MaskLayer *mask_layer; const bool unselected = RNA_boolean_get(op->ptr, "unselected"); bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (masklay->restrictflag & MASK_RESTRICT_SELECT) { + if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) { continue; } if (!unselected) { - if (ED_mask_layer_select_check(masklay)) { - ED_mask_layer_select_set(masklay, false); + if (ED_mask_layer_select_check(mask_layer)) { + ED_mask_layer_select_set(mask_layer, false); - masklay->restrictflag |= OB_RESTRICT_VIEWPORT; + mask_layer->restrictflag |= OB_RESTRICT_VIEWPORT; changed = true; - if (masklay == BKE_mask_layer_active(mask)) { + if (mask_layer == BKE_mask_layer_active(mask)) { BKE_mask_layer_active_set(mask, NULL); } } } else { - if (!ED_mask_layer_select_check(masklay)) { - masklay->restrictflag |= OB_RESTRICT_VIEWPORT; + if (!ED_mask_layer_select_check(mask_layer)) { + mask_layer->restrictflag |= OB_RESTRICT_VIEWPORT; changed = true; - if (masklay == BKE_mask_layer_active(mask)) { + if (mask_layer == BKE_mask_layer_active(mask)) { BKE_mask_layer_active_set(mask, NULL); } } @@ -2108,18 +2108,18 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; int i; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_SELECT | MASK_RESTRICT_VIEW)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_SELECT | MASK_RESTRICT_VIEW)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 75b2aee3570..b72edd3977b 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -43,17 +43,17 @@ static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; int i; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -89,7 +89,7 @@ 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 *masklay; + MaskLayer *mask_layer; /* parent info */ SpaceClip *sc = CTX_wm_space_clip(C); @@ -141,15 +141,15 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; int i; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 2b3bd1b72c9..17bf8df7236 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -68,15 +68,15 @@ bool ED_mask_spline_select_check(MaskSpline *spline) return false; } -bool ED_mask_layer_select_check(MaskLayer *masklay) +bool ED_mask_layer_select_check(MaskLayer *mask_layer) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { return false; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { if (ED_mask_spline_select_check(spline)) { return true; } @@ -87,10 +87,10 @@ bool ED_mask_layer_select_check(MaskLayer *masklay) bool ED_mask_select_check(Mask *mask) { - MaskLayer *masklay; + MaskLayer *mask_layer; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - if (ED_mask_layer_select_check(masklay)) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { + if (ED_mask_layer_select_check(mask_layer)) { return true; } } @@ -117,24 +117,24 @@ void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select) } } -void ED_mask_layer_select_set(MaskLayer *masklay, const bool do_select) +void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select) { MaskSpline *spline; - if (masklay->restrictflag & MASK_RESTRICT_SELECT) { + if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) { if (do_select == true) { return; } } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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 *masklay; + MaskLayer *mask_layer; if (action == SEL_TOGGLE) { if (ED_mask_select_check(mask)) { @@ -145,9 +145,9 @@ void ED_mask_select_toggle_all(Mask *mask, int action) } } - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (masklay->restrictflag & MASK_RESTRICT_VIEW) { + if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) { continue; } @@ -156,10 +156,10 @@ void ED_mask_select_toggle_all(Mask *mask, int action) * if one day we need to re-use such functionality, they can be split out */ MaskSpline *spline; - if (masklay->restrictflag & MASK_RESTRICT_SELECT) { + if (mask_layer->restrictflag & MASK_RESTRICT_SELECT) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { int i; for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -168,26 +168,26 @@ void ED_mask_select_toggle_all(Mask *mask, int action) } } else { - ED_mask_layer_select_set(masklay, (action == SEL_SELECT) ? true : false); + ED_mask_layer_select_set(mask_layer, (action == SEL_SELECT) ? true : false); } } } void ED_mask_select_flush_all(Mask *mask) { - MaskLayer *masklay; + MaskLayer *mask_layer; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { int i; spline->flag &= ~SELECT; - /* intentionally _dont_ do this in the masklay loop + /* intentionally _dont_ do this in the mask layer loop * so we clear flags on all splines */ - if (masklay->restrictflag & MASK_RESTRICT_VIEW) { + if (mask_layer->restrictflag & MASK_RESTRICT_VIEW) { continue; } @@ -270,7 +270,7 @@ void MASK_OT_select_all(wmOperatorType *ot) static int select_exec(bContext *C, wmOperator *op) { Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; MaskSpline *spline; MaskSplinePoint *point = NULL; float co[2]; @@ -284,7 +284,7 @@ static int select_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "location", co); point = ED_mask_point_find_nearest( - C, mask, co, threshold, &masklay, &spline, &which_handle, NULL); + C, mask, co, threshold, &mask_layer, &spline, &which_handle, NULL); if (extend == false && deselect == false && toggle == false) { ED_mask_select_toggle_all(mask, SEL_DESELECT); @@ -293,8 +293,8 @@ static int select_exec(bContext *C, wmOperator *op) if (point) { if (which_handle != MASK_WHICH_HANDLE_NONE) { if (extend) { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; BKE_mask_point_select_set_handle(point, which_handle, true); } @@ -302,8 +302,8 @@ static int select_exec(bContext *C, wmOperator *op) BKE_mask_point_select_set_handle(point, which_handle, false); } else { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; if (!MASKPOINT_ISSEL_HANDLE(point, which_handle)) { BKE_mask_point_select_set_handle(point, which_handle, true); @@ -315,8 +315,8 @@ static int select_exec(bContext *C, wmOperator *op) } else { if (extend) { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; BKE_mask_point_select_set(point, true); } @@ -324,8 +324,8 @@ static int select_exec(bContext *C, wmOperator *op) BKE_mask_point_select_set(point, false); } else { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; if (!MASKPOINT_ISSEL_ANY(point)) { BKE_mask_point_select_set(point, true); @@ -336,8 +336,8 @@ static int select_exec(bContext *C, wmOperator *op) } } - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; ED_mask_select_flush_all(mask); @@ -350,11 +350,11 @@ static int select_exec(bContext *C, wmOperator *op) MaskSplinePointUW *uw; if (ED_mask_feather_find_nearest( - C, mask, co, threshold, &masklay, &spline, &point, &uw, NULL)) { + C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) { if (extend) { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; if (uw) { uw->flag |= SELECT; @@ -366,8 +366,8 @@ static int select_exec(bContext *C, wmOperator *op) } } else { - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; if (uw) { if (!(uw->flag & SELECT)) { @@ -454,7 +454,7 @@ static int box_select_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; int i; rcti rect; @@ -475,14 +475,14 @@ 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 (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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++) { @@ -548,7 +548,7 @@ static bool do_lasso_select_mask(bContext *C, ARegion *ar = CTX_wm_region(C); Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; int i; rcti rect; @@ -564,14 +564,14 @@ static bool do_lasso_select_mask(bContext *C, BLI_lasso_boundbox(&rect, mcords, moves); /* do actual selection */ - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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++) { @@ -678,7 +678,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; int i; float zoomx, zoomy, offset[2], ellipse[2]; @@ -709,14 +709,14 @@ static int circle_select_exec(bContext *C, wmOperator *op) } /* do actual selection */ - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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++) { @@ -778,7 +778,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE ARegion *ar = CTX_wm_region(C); Mask *mask = CTX_data_edit_mask(C); - MaskLayer *masklay; + MaskLayer *mask_layer; MaskSpline *spline; MaskSplinePoint *point = NULL; float co[2]; @@ -788,12 +788,12 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE ED_mask_mouse_pos(sa, ar, event->mval, co); - point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, NULL, NULL); + point = ED_mask_point_find_nearest(C, mask, co, threshold, &mask_layer, &spline, NULL, NULL); if (point) { ED_mask_spline_select_set(spline, do_select); - masklay->act_spline = spline; - masklay->act_point = point; + mask_layer->act_spline = spline; + mask_layer->act_point = point; changed = true; } @@ -836,19 +836,19 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; /* do actual selection */ - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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 +892,16 @@ 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 *masklay; + MaskLayer *mask_layer; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { MaskSpline *spline; - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (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 1abe805192d..886f7efb1c5 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -51,18 +51,18 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskLayerShape *masklay_shape; + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { + MaskLayerShape *mask_layer_shape; - if (!ED_mask_layer_select_check(masklay)) { + if (!ED_mask_layer_select_check(mask_layer)) { continue; } - masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame); - BKE_mask_layer_shape_from_mask(masklay, masklay_shape); + mask_layer_shape = BKE_mask_layer_shape_verify_frame(mask_layer, frame); + BKE_mask_layer_shape_from_mask(mask_layer, mask_layer_shape); changed = true; } @@ -97,20 +97,20 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - MaskLayerShape *masklay_shape; + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { + MaskLayerShape *mask_layer_shape; - if (!ED_mask_layer_select_check(masklay)) { + if (!ED_mask_layer_select_check(mask_layer)) { continue; } - masklay_shape = BKE_mask_layer_shape_find_frame(masklay, frame); + mask_layer_shape = BKE_mask_layer_shape_find_frame(mask_layer, frame); - if (masklay_shape) { - BKE_mask_layer_shape_unlink(masklay, masklay_shape); + if (mask_layer_shape) { + BKE_mask_layer_shape_unlink(mask_layer, mask_layer_shape); changed = true; } } @@ -146,38 +146,38 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } - if (masklay->splines_shapes.first) { - MaskLayerShape *masklay_shape_reset; - MaskLayerShape *masklay_shape; + if (mask_layer->splines_shapes.first) { + MaskLayerShape *mask_layer_shape_reset; + MaskLayerShape *mask_layer_shape; /* get the shapekey of the current state */ - masklay_shape_reset = BKE_mask_layer_shape_alloc(masklay, frame); + mask_layer_shape_reset = BKE_mask_layer_shape_alloc(mask_layer, frame); /* initialize from mask - as if inseting a keyframe */ - BKE_mask_layer_shape_from_mask(masklay, masklay_shape_reset); + BKE_mask_layer_shape_from_mask(mask_layer, mask_layer_shape_reset); - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape->next) { + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape->next) { - if (masklay_shape_reset->tot_vert == masklay_shape->tot_vert) { + 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 *)masklay_shape_reset->data; - shape_ele_dst = (MaskLayerShapeElem *)masklay_shape->data; + shape_ele_src = (MaskLayerShapeElem *)mask_layer_shape_reset->data; + shape_ele_dst = (MaskLayerShapeElem *)mask_layer_shape->data; - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -200,7 +200,7 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op) changed = true; } - BKE_mask_layer_shape_free(masklay_shape_reset); + BKE_mask_layer_shape_free(mask_layer_shape_reset); } } @@ -243,80 +243,80 @@ 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 *masklay; + 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 (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { continue; } /* we need at least one point selected here to bother re-interpolating */ - if (!ED_mask_layer_select_check(masklay)) { + if (!ED_mask_layer_select_check(mask_layer)) { continue; } - if (masklay->splines_shapes.first) { - MaskLayerShape *masklay_shape, *masklay_shape_next; - MaskLayerShape *masklay_shape_lastsel = NULL; + if (mask_layer->splines_shapes.first) { + MaskLayerShape *mask_layer_shape, *mask_layer_shape_next; + MaskLayerShape *mask_layer_shape_lastsel = NULL; - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; - masklay_shape = masklay_shape_next) { - MaskLayerShape *masklay_shape_a = NULL; - MaskLayerShape *masklay_shape_b = NULL; + for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; + mask_layer_shape = mask_layer_shape_next) { + MaskLayerShape *mask_layer_shape_a = NULL; + MaskLayerShape *mask_layer_shape_b = NULL; - masklay_shape_next = masklay_shape->next; + mask_layer_shape_next = mask_layer_shape->next; /* find contiguous selections */ - if (masklay_shape->flag & MASK_SHAPE_SELECT) { - if (masklay_shape_lastsel == NULL) { - masklay_shape_lastsel = masklay_shape; + if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { + if (mask_layer_shape_lastsel == NULL) { + mask_layer_shape_lastsel = mask_layer_shape; } - if ((masklay_shape->next == NULL) || - (((MaskLayerShape *)masklay_shape->next)->flag & MASK_SHAPE_SELECT) == 0) { - masklay_shape_a = masklay_shape_lastsel; - masklay_shape_b = masklay_shape; - masklay_shape_lastsel = NULL; + if ((mask_layer_shape->next == NULL) || + (((MaskLayerShape *)mask_layer_shape->next)->flag & MASK_SHAPE_SELECT) == 0) { + mask_layer_shape_a = mask_layer_shape_lastsel; + mask_layer_shape_b = mask_layer_shape; + mask_layer_shape_lastsel = NULL; /* this will be freed below, step over selection */ - masklay_shape_next = masklay_shape->next; + mask_layer_shape_next = mask_layer_shape->next; } } /* we have a from<>to? - re-interpolate! */ - if (masklay_shape_a && masklay_shape_b) { + if (mask_layer_shape_a && mask_layer_shape_b) { ListBase shapes_tmp = {NULL, NULL}; - MaskLayerShape *masklay_shape_tmp; - MaskLayerShape *masklay_shape_tmp_next; - MaskLayerShape *masklay_shape_tmp_last = masklay_shape_b->next; - MaskLayerShape *masklay_shape_tmp_rekey; + MaskLayerShape *mask_layer_shape_tmp; + MaskLayerShape *mask_layer_shape_tmp_next; + MaskLayerShape *mask_layer_shape_tmp_last = mask_layer_shape_b->next; + MaskLayerShape *mask_layer_shape_tmp_rekey; /* move keys */ - for (masklay_shape_tmp = masklay_shape_a; - masklay_shape_tmp && (masklay_shape_tmp != masklay_shape_tmp_last); - masklay_shape_tmp = masklay_shape_tmp_next) { - masklay_shape_tmp_next = masklay_shape_tmp->next; - BLI_remlink(&masklay->splines_shapes, masklay_shape_tmp); - BLI_addtail(&shapes_tmp, masklay_shape_tmp); + for (mask_layer_shape_tmp = mask_layer_shape_a; + mask_layer_shape_tmp && (mask_layer_shape_tmp != mask_layer_shape_tmp_last); + mask_layer_shape_tmp = mask_layer_shape_tmp_next) { + mask_layer_shape_tmp_next = mask_layer_shape_tmp->next; + BLI_remlink(&mask_layer->splines_shapes, mask_layer_shape_tmp); + BLI_addtail(&shapes_tmp, mask_layer_shape_tmp); } /* re-key, note: cant modify the keys here since it messes uop */ - for (masklay_shape_tmp = shapes_tmp.first; masklay_shape_tmp; - masklay_shape_tmp = masklay_shape_tmp->next) { - BKE_mask_layer_evaluate(masklay, masklay_shape_tmp->frame, true); - masklay_shape_tmp_rekey = BKE_mask_layer_shape_verify_frame(masklay, - masklay_shape_tmp->frame); - BKE_mask_layer_shape_from_mask(masklay, masklay_shape_tmp_rekey); - masklay_shape_tmp_rekey->flag = masklay_shape_tmp->flag & MASK_SHAPE_SELECT; + for (mask_layer_shape_tmp = shapes_tmp.first; mask_layer_shape_tmp; + mask_layer_shape_tmp = mask_layer_shape_tmp->next) { + BKE_mask_layer_evaluate(mask_layer, mask_layer_shape_tmp->frame, true); + mask_layer_shape_tmp_rekey = BKE_mask_layer_shape_verify_frame( + mask_layer, mask_layer_shape_tmp->frame); + BKE_mask_layer_shape_from_mask(mask_layer, mask_layer_shape_tmp_rekey); + mask_layer_shape_tmp_rekey->flag = mask_layer_shape_tmp->flag & MASK_SHAPE_SELECT; } /* restore unselected points and free copies */ - for (masklay_shape_tmp = shapes_tmp.first; masklay_shape_tmp; - masklay_shape_tmp = masklay_shape_tmp_next) { + for (mask_layer_shape_tmp = shapes_tmp.first; mask_layer_shape_tmp; + mask_layer_shape_tmp = mask_layer_shape_tmp_next) { /* restore */ int i_abs = 0; int i; @@ -324,16 +324,16 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op) MaskLayerShapeElem *shape_ele_src; MaskLayerShapeElem *shape_ele_dst; - masklay_shape_tmp_next = masklay_shape_tmp->next; + mask_layer_shape_tmp_next = mask_layer_shape_tmp->next; /* we know this exists, added above */ - masklay_shape_tmp_rekey = BKE_mask_layer_shape_find_frame(masklay, - masklay_shape_tmp->frame); + mask_layer_shape_tmp_rekey = BKE_mask_layer_shape_find_frame( + mask_layer, mask_layer_shape_tmp->frame); - shape_ele_src = (MaskLayerShapeElem *)masklay_shape_tmp->data; - shape_ele_dst = (MaskLayerShapeElem *)masklay_shape_tmp_rekey->data; + shape_ele_src = (MaskLayerShapeElem *)mask_layer_shape_tmp->data; + shape_ele_dst = (MaskLayerShapeElem *)mask_layer_shape_tmp_rekey->data; - for (spline = masklay->splines.first; spline; spline = spline->next) { + for (spline = mask_layer->splines.first; spline; spline = spline->next) { for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; @@ -356,7 +356,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op) } } - BKE_mask_layer_shape_free(masklay_shape_tmp); + BKE_mask_layer_shape_free(mask_layer_shape_tmp); } changed = true; @@ -364,7 +364,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op) } /* re-evaluate */ - BKE_mask_layer_evaluate(masklay, frame, true); + BKE_mask_layer_evaluate(mask_layer, frame, true); } } @@ -401,21 +401,21 @@ void MASK_OT_shape_key_rekey(wmOperatorType *ot) /* *** Shape Key Utils *** */ -void ED_mask_layer_shape_auto_key(MaskLayer *masklay, const int frame) +void ED_mask_layer_shape_auto_key(MaskLayer *mask_layer, const int frame) { - MaskLayerShape *masklay_shape; + MaskLayerShape *mask_layer_shape; - masklay_shape = BKE_mask_layer_shape_verify_frame(masklay, frame); - BKE_mask_layer_shape_from_mask(masklay, masklay_shape); + mask_layer_shape = BKE_mask_layer_shape_verify_frame(mask_layer, frame); + BKE_mask_layer_shape_from_mask(mask_layer, mask_layer_shape); } bool ED_mask_layer_shape_auto_key_all(Mask *mask, const int frame) { - MaskLayer *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - ED_mask_layer_shape_auto_key(masklay, frame); + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { + ED_mask_layer_shape_auto_key(mask_layer, frame); changed = true; } @@ -424,16 +424,16 @@ 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 *masklay; + MaskLayer *mask_layer; bool changed = false; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) { - if (!ED_mask_layer_select_check(masklay)) { + if (!ED_mask_layer_select_check(mask_layer)) { continue; } - ED_mask_layer_shape_auto_key(masklay, frame); + ED_mask_layer_shape_auto_key(mask_layer, frame); changed = true; } |