[Bf-blender-cvs] [5e4f789] master: Code cleanup: use false/true/bool for masking
Sergey Sharybin
noreply at git.blender.org
Mon Mar 31 11:24:58 CEST 2014
Commit: 5e4f789173bb998f85a942a6a02cd30cb42f7660
Author: Sergey Sharybin
Date: Mon Mar 31 15:23:27 2014 +0600
https://developer.blender.org/rB5e4f789173bb998f85a942a6a02cd30cb42f7660
Code cleanup: use false/true/bool for masking
===================================================================
M source/blender/blenkernel/BKE_mask.h
M source/blender/blenkernel/intern/mask.c
M source/blender/editors/include/ED_mask.h
M source/blender/editors/mask/mask_add.c
M source/blender/editors/mask/mask_draw.c
M source/blender/editors/mask/mask_editaction.c
M source/blender/editors/mask/mask_intern.h
M source/blender/editors/mask/mask_ops.c
M source/blender/editors/mask/mask_select.c
M source/blender/editors/mask/mask_shapekey.c
M source/blender/makesrna/intern/rna_mask.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 5dd0b14..3db4d9e 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 8ea035e..b303243 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 d8fe142..97fd553 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 2e1d522..ecaa737 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 bCo
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list