From 5e4f789173bb998f85a942a6a02cd30cb42f7660 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 31 Mar 2014 15:23:27 +0600 Subject: Code cleanup: use false/true/bool for masking --- source/blender/blenkernel/BKE_mask.h | 14 +++--- source/blender/blenkernel/intern/mask.c | 8 ++-- source/blender/editors/include/ED_mask.h | 6 +-- source/blender/editors/mask/mask_add.c | 62 +++++++++++++-------------- source/blender/editors/mask/mask_draw.c | 20 ++++----- source/blender/editors/mask/mask_editaction.c | 12 +++--- source/blender/editors/mask/mask_intern.h | 4 +- source/blender/editors/mask/mask_ops.c | 28 ++++++------ source/blender/editors/mask/mask_select.c | 44 +++++++++---------- source/blender/editors/mask/mask_shapekey.c | 4 +- source/blender/makesrna/intern/rna_mask.c | 2 +- 11 files changed, 102 insertions(+), 102 deletions(-) diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 5dd0b14be63..3db4d9e7324 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -188,15 +188,15 @@ void BKE_mask_clipboard_copy_from_layer(struct MaskLayer *mask_layer); bool BKE_mask_clipboard_is_empty(void); void BKE_mask_clipboard_paste_to_layer(struct Main *bmain, struct MaskLayer *mask_layer); -#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f3) & SELECT) -#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT) +#define MASKPOINT_ISSEL_ANY(p) (( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f3) & SELECT) != 0) +#define MASKPOINT_ISSEL_KNOT(p) (( (p)->bezt.f2 & SELECT) != 0) #define MASKPOINT_ISSEL_HANDLE(point, which_handle) \ - ((which_handle == MASK_WHICH_HANDLE_STICK) ? \ - ((((point)->bezt.f1 | (point)->bezt.f3) & SELECT)) : \ - ((which_handle == MASK_WHICH_HANDLE_LEFT) ? \ - ((point)->bezt.f1 & SELECT) : \ - ((point)->bezt.f3 & SELECT))) + (((which_handle == MASK_WHICH_HANDLE_STICK) ? \ + ((((point)->bezt.f1 | (point)->bezt.f3) & SELECT)) : \ + ((which_handle == MASK_WHICH_HANDLE_LEFT) ? \ + ((point)->bezt.f1 & SELECT) : \ + ((point)->bezt.f3 & SELECT))) != 0) #define MASKPOINT_SEL_ALL(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f2 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 #define MASKPOINT_DESEL_ALL(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f2 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 8ea035e3249..b303243b66a 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -263,7 +263,7 @@ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay) bool BKE_mask_spline_remove(MaskLayer *mask_layer, MaskSpline *spline) { - if (BLI_remlink_safe(&mask_layer->splines, spline) == FALSE) { + if (BLI_remlink_safe(&mask_layer->splines, spline) == false) { return false; } @@ -1402,7 +1402,7 @@ void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point, point->bezt.h2 = h_back[1]; /* preserve length by applying it back */ - if (do_recalc_length == FALSE) { + if (do_recalc_length == false) { dist_ensure_v2_v2fl(point->bezt.vec[0], point->bezt.vec[1], length_average); dist_ensure_v2_v2fl(point->bezt.vec[2], point->bezt.vec[1], length_average); } @@ -1489,7 +1489,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const bool d for (spline = masklay->splines.first; spline; spline = spline->next) { int i; - int need_handle_recalc = FALSE; + bool need_handle_recalc = false; BKE_mask_spline_ensure_deform(spline); @@ -1505,7 +1505,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const bool d mask_evaluate_apply_point_parent(point_deform, ctime); if (ELEM(point->bezt.h1, HD_AUTO, HD_VECT)) { - need_handle_recalc = TRUE; + need_handle_recalc = true; } } diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index d8fe14282e3..97fd553ea19 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -72,9 +72,9 @@ bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame); bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame); /* ----------- Mask AnimEdit API ------------------ */ -short ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, - short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); -void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, short onlysel); +bool ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, + short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); +void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, bool onlysel); bool ED_masklayer_frame_select_check(struct MaskLayer *masklay); void ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode); diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index 2e1d5221b56..ecaa73754ba 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -54,10 +54,10 @@ #include "mask_intern.h" /* own include */ -static int find_nearest_diff_point(const bContext *C, Mask *mask, const float normal_co[2], int threshold, int feather, - MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r, - float *u_r, float tangent[2], - const short use_deform) +static bool find_nearest_diff_point(const bContext *C, Mask *mask, const float normal_co[2], int threshold, bool feather, + MaskLayer **masklay_r, MaskSpline **spline_r, MaskSplinePoint **point_r, + float *u_r, float tangent[2], + const bool use_deform) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -164,7 +164,7 @@ static int find_nearest_diff_point(const bContext *C, Mask *mask, const float no *u_r = u; } - return TRUE; + return true; } if (masklay_r) @@ -176,14 +176,14 @@ static int find_nearest_diff_point(const bContext *C, Mask *mask, const float no if (point_r) *point_r = NULL; - return FALSE; + return false; } /******************** add vertex *********************/ static void setup_vertex_point(Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point, const float point_co[2], const float u, - MaskSplinePoint *reference_point, const short reference_adjacent) + MaskSplinePoint *reference_point, const bool reference_adjacent) { MaskSplinePoint *prev_point = NULL; MaskSplinePoint *next_point = NULL; @@ -264,7 +264,7 @@ static void setup_vertex_point(Mask *mask, MaskSpline *spline, MaskSplinePoint * /* **** add extrude vertex **** */ -static void finSelectedSplinePoint(MaskLayer *masklay, MaskSpline **spline, MaskSplinePoint **point, short check_active) +static void finSelectedSplinePoint(MaskLayer *masklay, MaskSpline **spline, MaskSplinePoint **point, bool check_active) { MaskSpline *cur_spline = masklay->splines.first; @@ -323,7 +323,7 @@ static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index) spline->tot_point++; } -static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2]) +static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2]) { MaskLayer *masklay; MaskSpline *spline; @@ -332,7 +332,7 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2] float tangent[2]; float u; - if (find_nearest_diff_point(C, mask, co, threshold, FALSE, &masklay, &spline, &point, &u, tangent, TRUE)) { + if (find_nearest_diff_point(C, mask, co, threshold, false, &masklay, &spline, &point, &u, tangent, true)) { MaskSplinePoint *new_point; int point_index = point - spline->points; @@ -342,7 +342,7 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2] new_point = &spline->points[point_index + 1]; - setup_vertex_point(mask, spline, new_point, co, u, NULL, TRUE); + setup_vertex_point(mask, spline, new_point, co, u, NULL, true); /* TODO - we could pass the spline! */ BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, true, true); @@ -352,13 +352,13 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2] WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - return TRUE; + return true; } - return FALSE; + return false; } -static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, const float co[2]) +static bool add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, const float co[2]) { MaskSpline *spline; MaskSplinePoint *point; @@ -372,10 +372,10 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, bool do_prev; /* use prev point rather then next?? */ if (!masklay) { - return FALSE; + return false; } else { - finSelectedSplinePoint(masklay, &spline, &point, TRUE); + finSelectedSplinePoint(masklay, &spline, &point, true); } ED_mask_select_toggle_all(mask, SEL_DESELECT); @@ -391,20 +391,20 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, sub_v2_v2v2(tangent_co, co, point->bezt.vec[1]); if (dot_v2v2(tangent_point, tangent_co) < 0.0f) { - do_prev = TRUE; + do_prev = true; } else { - do_prev = FALSE; + do_prev = false; } } else if (((spline->flag & MASK_SPLINE_CYCLIC) == 0) && (point_index == 0)) { - do_prev = TRUE; + do_prev = true; } else if (((spline->flag & MASK_SPLINE_CYCLIC) == 0) && (point_index == spline->tot_point - 1)) { - do_prev = FALSE; + do_prev = false; } else { - do_prev = FALSE; /* quiet warning */ + do_prev = false; /* quiet warning */ /* should never get here */ BLI_assert(0); } @@ -415,7 +415,7 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, if (point_index < 0) { point_index += spline->tot_point; /* wrap index */ if ((spline->flag & MASK_SPLINE_CYCLIC) == 0) { - do_cyclic_correct = TRUE; + do_cyclic_correct = true; point_index = 0; } } @@ -439,7 +439,7 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, masklay->act_point = new_point; - setup_vertex_point(mask, spline, new_point, co, 0.5f, ref_point, FALSE); + setup_vertex_point(mask, spline, new_point, co, 0.5f, ref_point, false); if (masklay->splines_shapes.first) { point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point); @@ -448,10 +448,10 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay, WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - return TRUE; + return true; } -static int 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 *masklay, const float co[2]) { MaskSpline *spline; MaskSplinePoint *point; @@ -465,7 +465,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con point = NULL; } else { - finSelectedSplinePoint(masklay, &spline, &point, TRUE); + finSelectedSplinePoint(masklay, &spline, &point, true); } ED_mask_select_toggle_all(mask, SEL_DESELECT); @@ -480,7 +480,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con masklay->act_point = new_point; - setup_vertex_point(mask, spline, new_point, co, 0.5f, ref_point, FALSE); + setup_vertex_point(mask, spline, new_point, co, 0.5f, ref_point, false); { int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point); @@ -489,7 +489,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); - return TRUE; + return true; } static int add_vertex_exec(bContext *C, wmOperator *op) @@ -535,8 +535,8 @@ static int add_vertex_exec(bContext *C, wmOperator *op) spline->flag |= MASK_SPLINE_CYCLIC; /* TODO, update keyframes in time */ - BKE_mask_calc_handle_point_auto(spline, point, FALSE); - BKE_mask_calc_handle_point_auto(spline, point_other, FALSE); + BKE_mask_calc_handle_point_auto(spline, point, false); + BKE_mask_calc_handle_point_auto(spline, point_other, false); /* TODO: only update this spline */ BKE_mask_update_display(mask, CFRA); @@ -617,7 +617,7 @@ static int add_feather_vertex_exec(bContext *C, wmOperator *op) if (point) return OPERATOR_FINISHED; - if (find_nearest_diff_point(C, mask, co, threshold, TRUE, &masklay, &spline, &point, &u, NULL, TRUE)) { + if (find_nearest_diff_point(C, mask, co, threshold, true, &masklay, &spline, &point, &u, NULL, true)) { Scene *scene = CTX_data_scene(C); 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 12fcd3c1459..e84bdf12067 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -262,7 +262,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline for (j = 0; j <= point->tot_uw; j++) { float feather_point[2]; - int sel = FALSE; + bool sel = false; copy_v2_v2(feather_point, *fp); @@ -273,7 +273,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline sel = MASKPOINT_ISSEL_ANY(point); } else { - sel = point->uw[j - 1].flag & SELECT; + sel = (point->uw[j - 1].flag & SELECT) != 0; } if (sel) { @@ -366,7 +366,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline /* #define USE_XOR */ -static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char rgb[4], const short is_active) +static void mask_color_active_tint(unsigned char r_rgb[4], const unsigned char rgb[4], const bool is_active) { if (!is_active) { r_rgb[0] = (unsigned char)((((int)(rgb[0])) + 128) / 2); @@ -465,7 +465,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* rgb_tmp[2] = (unsigned char)(((short)rgb_tmp[2] + (short)rgb_spline[2]) / 2); } - if (is_smooth == FALSE && is_feather) { + if (is_smooth == false && is_feather) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -477,7 +477,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* glVertexPointer(2, GL_FLOAT, 0, points); glDrawArrays(draw_method, 0, tot_point); - if (is_smooth == FALSE && is_feather) { + if (is_smooth == false && is_feather) { glDisable(GL_BLEND); } @@ -521,12 +521,12 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } - feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(spline, &tot_feather_point, resol, (is_fill != FALSE)); + feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(spline, &tot_feather_point, resol, (is_fill != false)); /* draw feather */ mask_spline_feather_color_get(masklay, spline, is_spline_sel, rgb_tmp); mask_draw_curve_type(C, spline, feather_points, tot_feather_point, - TRUE, is_smooth, is_active, + true, is_smooth, is_active, rgb_tmp, draw_type); if (!is_fill) { @@ -545,7 +545,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline /* same as above */ mask_draw_curve_type(C, spline, feather_points, tot_feather_point, - TRUE, is_smooth, is_active, + true, is_smooth, is_active, rgb_tmp, draw_type); } @@ -554,7 +554,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline /* draw main curve */ mask_spline_color_get(masklay, spline, is_spline_sel, rgb_tmp); mask_draw_curve_type(C, spline, diff_points, tot_diff_point, - FALSE, is_smooth, is_active, + false, is_smooth, is_active, rgb_tmp, draw_type); MEM_freeN(diff_points); @@ -671,7 +671,7 @@ static float *threaded_mask_rasterize(Mask *mask, const int width, const int hei /* Initialize rasterization handle. */ handle = BKE_maskrasterize_handle_new(); - BKE_maskrasterize_handle_init(handle, mask, width, height, TRUE, TRUE, TRUE); + BKE_maskrasterize_handle_init(handle, mask, width, height, true, true, true); state.handle = handle; state.buffer = buffer; diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index d4ac0338456..547f08653cb 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -61,30 +61,30 @@ /* Generics - Loopers */ /* Loops over the mask-frames for a mask-layer, and applies the given callback */ -short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) +bool ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) { MaskLayerShape *masklay_shape; /* error checker */ if (masklay == NULL) - return 0; + return false; /* do loop */ for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { /* execute callback */ if (masklay_shape_cb(masklay_shape, scene)) - return 1; + return true; } /* nothing to return */ - return 0; + return false; } /* ****************************************** */ /* 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, short onlysel) +void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, bool onlysel) { MaskLayerShape *masklay_shape; CfraElem *ce; @@ -95,7 +95,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short only /* loop through mask-frames, adding */ for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { - if ((onlysel == 0) || (masklay_shape->flag & MASK_SHAPE_SELECT)) { + if ((onlysel == false) || (masklay_shape->flag & MASK_SHAPE_SELECT)) { ce = MEM_callocN(sizeof(CfraElem), "CfraElem"); ce->cfra = (float)masklay_shape->frame; diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index d95e07f043a..369d3aa1c6e 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -102,8 +102,8 @@ bool ED_mask_spline_select_check(struct MaskSpline *spline); bool ED_mask_layer_select_check(struct MaskLayer *masklay); bool ED_mask_select_check(struct Mask *mask); -void ED_mask_spline_select_set(struct MaskSpline *spline, const short do_select); -void ED_mask_layer_select_set(struct MaskLayer *masklay, const short do_select); +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_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 10bcfae7b00..73a95628d17 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -281,7 +281,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor if (score) *score = sqrtf(len); - return TRUE; + return true; } if (masklay_r) @@ -293,7 +293,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor if (point_r) *point_r = NULL; - return FALSE; + return false; } @@ -473,8 +473,8 @@ typedef struct SlidePointData { int width, height; float weight, weight_scalar; - short curvature_only, accurate; - short initial_feather, overall_feather; + bool curvature_only, accurate; + bool initial_feather, overall_feather; bool is_sliding_new_point; } SlidePointData; @@ -487,19 +487,19 @@ static bool slide_point_check_initial_feather(MaskSpline *spline) MaskSplinePoint *point = &spline->points[i]; if (point->bezt.weight != 0.0f) - return FALSE; + return false; /* comment for now. if all bezt weights are zero - this is as good-as initial */ #if 0 int j; for (j = 0; j < point->tot_uw; j++) { if (point->uw[j].w != 0.0f) - return FALSE; + return false; } #endif } - return TRUE; + return true; } static void select_sliding_point(Mask *mask, MaskLayer *mask_layer, MaskSpline *spline, @@ -509,7 +509,7 @@ static void select_sliding_point(Mask *mask, MaskLayer *mask_layer, MaskSpline * switch (which_handle) { case MASK_WHICH_HANDLE_NONE: - BKE_mask_point_select_set(point, TRUE); + BKE_mask_point_select_set(point, true); break; case MASK_WHICH_HANDLE_LEFT: point->bezt.f1 |= SELECT; @@ -682,7 +682,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, const wmEvent *event) else if (!MASKPOINT_ISSEL_ANY(slidedata->point)) { ED_mask_select_toggle_all(mask, SEL_DESELECT); - BKE_mask_point_select_set(slidedata->point, TRUE); + BKE_mask_point_select_set(slidedata->point, true); ED_mask_select_flush_all(mask); } @@ -856,7 +856,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) float vec[2], no[2], p[2], c[2], w, offco[2]; float *weight = NULL; float weight_scalar = 1.0f; - int overall_feather = data->overall_feather || data->initial_feather; + bool overall_feather = data->overall_feather || data->initial_feather; add_v2_v2v2(offco, data->feather, dco); @@ -965,7 +965,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) Scene *scene = CTX_data_scene(C); /* dont key sliding feather uw's */ - if ((data->action == SLIDE_ACTION_FEATHER && data->uw) == FALSE) { + if ((data->action == SLIDE_ACTION_FEATHER && data->uw) == false) { if (IS_AUTOKEY_ON(scene)) { ED_mask_layer_shape_auto_key(data->masklay, CFRA); } @@ -1310,7 +1310,7 @@ static int mask_normals_make_consistent_exec(bContext *C, wmOperator *UNUSED(op) MaskSplinePoint *point = &spline->points[i]; if (MASKPOINT_ISSEL_ANY(point)) { - BKE_mask_calc_handle_point_auto(spline, point, FALSE); + BKE_mask_calc_handle_point_auto(spline, point, false); changed = true; changed_layer = true; } @@ -1452,7 +1452,7 @@ static int mask_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op)) for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { if (masklay->restrictflag & OB_RESTRICT_VIEW) { - ED_mask_layer_select_set(masklay, TRUE); + ED_mask_layer_select_set(masklay, true); masklay->restrictflag &= ~OB_RESTRICT_VIEW; changed = true; } @@ -1500,7 +1500,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op) if (!unselected) { if (ED_mask_layer_select_check(masklay)) { - ED_mask_layer_select_set(masklay, FALSE); + ED_mask_layer_select_set(masklay, false); masklay->restrictflag |= OB_RESTRICT_VIEW; changed = true; diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 29b5714be59..da5fdd37316 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -63,10 +63,10 @@ bool ED_mask_spline_select_check(MaskSpline *spline) MaskSplinePoint *point = &spline->points[i]; if (MASKPOINT_ISSEL_ANY(point)) - return TRUE; + return true; } - return FALSE; + return false; } bool ED_mask_layer_select_check(MaskLayer *masklay) @@ -74,16 +74,16 @@ bool ED_mask_layer_select_check(MaskLayer *masklay) MaskSpline *spline; if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { - return FALSE; + return false; } for (spline = masklay->splines.first; spline; spline = spline->next) { if (ED_mask_spline_select_check(spline)) { - return TRUE; + return true; } } - return FALSE; + return false; } bool ED_mask_select_check(Mask *mask) @@ -92,15 +92,15 @@ bool ED_mask_select_check(Mask *mask) for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { if (ED_mask_layer_select_check(masklay)) { - return TRUE; + return true; } } - return FALSE; + return false; } /* 'sel' select */ -void ED_mask_spline_select_set(MaskSpline *spline, const short do_select) +void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select) { int i; @@ -116,12 +116,12 @@ void ED_mask_spline_select_set(MaskSpline *spline, const short do_select) } } -void ED_mask_layer_select_set(MaskLayer *masklay, const short do_select) +void ED_mask_layer_select_set(MaskLayer *masklay, const bool do_select) { MaskSpline *spline; if (masklay->restrictflag & MASK_RESTRICT_SELECT) { - if (do_select == TRUE) { + if (do_select == true) { return; } } @@ -166,7 +166,7 @@ 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(masklay, (action == SEL_SELECT) ? true : false); } } } @@ -271,20 +271,20 @@ static int select_exec(bContext *C, wmOperator *op) masklay->act_spline = spline; masklay->act_point = point; - BKE_mask_point_select_set_handle(point, which_handle, TRUE); + BKE_mask_point_select_set_handle(point, which_handle, true); } else if (deselect) { - BKE_mask_point_select_set_handle(point, which_handle, FALSE); + BKE_mask_point_select_set_handle(point, which_handle, false); } else { masklay->act_spline = spline; masklay->act_point = point; if (!MASKPOINT_ISSEL_HANDLE(point, which_handle)) { - BKE_mask_point_select_set_handle(point, which_handle, TRUE); + BKE_mask_point_select_set_handle(point, which_handle, true); } else if (toggle) { - BKE_mask_point_select_set_handle(point, which_handle, FALSE); + BKE_mask_point_select_set_handle(point, which_handle, false); } } } @@ -293,20 +293,20 @@ static int select_exec(bContext *C, wmOperator *op) masklay->act_spline = spline; masklay->act_point = point; - BKE_mask_point_select_set(point, TRUE); + BKE_mask_point_select_set(point, true); } else if (deselect) { - BKE_mask_point_select_set(point, FALSE); + BKE_mask_point_select_set(point, false); } else { masklay->act_spline = spline; masklay->act_point = point; if (!MASKPOINT_ISSEL_ANY(point)) { - BKE_mask_point_select_set(point, TRUE); + BKE_mask_point_select_set(point, true); } else if (toggle) { - BKE_mask_point_select_set(point, FALSE); + BKE_mask_point_select_set(point, false); } } } @@ -445,8 +445,8 @@ static int border_select_exec(bContext *C, wmOperator *op) BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, mode == GESTURE_MODAL_SELECT); } else if (!extend) { - BKE_mask_point_select_set(point, FALSE); - BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, FALSE); + BKE_mask_point_select_set(point, false); + BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, false); } changed = true; @@ -760,7 +760,7 @@ static int mask_select_linked_exec(bContext *C, wmOperator *UNUSED(op)) for (spline = masklay->splines.first; spline; spline = spline->next) { if (ED_mask_spline_select_check(spline)) { - ED_mask_spline_select_set(spline, TRUE); + ED_mask_spline_select_set(spline, true); changed = true; } } diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index 30c960bda0f..99b2e1a13ef 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -257,8 +257,8 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op) MaskLayer *masklay; bool changed = false; - const short do_feather = RNA_boolean_get(op->ptr, "feather"); - const short do_location = RNA_boolean_get(op->ptr, "location"); + 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) { diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 29bc15f1dbe..eb94da6c87b 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -513,7 +513,7 @@ static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count) int point_index = spline->tot_point - count + i; MaskSplinePoint *new_point = spline->points + point_index; new_point->bezt.h1 = new_point->bezt.h2 = HD_ALIGN; - BKE_mask_calc_handle_point_auto(spline, new_point, TRUE); + BKE_mask_calc_handle_point_auto(spline, new_point, true); BKE_mask_parent_init(&new_point->parent); /* Not efficient, but there's no other way for now */ -- cgit v1.2.3