From 36fc4e15f69f4150812408b32a9052017590eb8b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 5 Feb 2014 22:18:33 +1100 Subject: Fix for vpaint_stroke_test_start returning operator flags, not bool also use bools for paint callbacks --- source/blender/editors/sculpt_paint/paint_image.c | 2 +- source/blender/editors/sculpt_paint/paint_intern.h | 4 ++-- source/blender/editors/sculpt_paint/paint_stroke.c | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 8 ++++---- source/blender/editors/sculpt_paint/sculpt.c | 6 +++--- source/blender/editors/sculpt_paint/sculpt_intern.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index adcbc721e80..463efedf957 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -599,7 +599,7 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke) } } -static int paint_stroke_test_start(bContext *UNUSED(C), wmOperator *UNUSED(op), const float UNUSED(mouse[2])) +static bool paint_stroke_test_start(bContext *UNUSED(C), wmOperator *UNUSED(op), const float UNUSED(mouse[2])) { return true; } diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 8d3efd0003a..6dd42380a11 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -58,8 +58,8 @@ struct DMCoNo; enum PaintMode; /* paint_stroke.c */ -typedef int (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]); -typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]); +typedef bool (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]); +typedef bool (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]); typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr); typedef void (*StrokeRedraw)(const struct bContext *C, struct PaintStroke *stroke, bool final); typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 0c28081723f..f96f0edf672 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -89,7 +89,7 @@ typedef struct PaintStroke { /* Set whether any stroke step has yet occurred * e.g. in sculpt mode, stroke doesn't start until cursor * passes over the mesh */ - int stroke_started; + bool stroke_started; /* event that started stroke, for modal() return */ int event_type; /* check if stroke variables have been initialized */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index a1ce39a4833..d97eb223c3d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2196,7 +2196,7 @@ static bool wpaint_ensure_data(bContext *C, wmOperator *op) return TRUE; } -static int wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNUSED(mouse[2])) +static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UNUSED(mouse[2])) { Scene *scene = CTX_data_scene(C); struct PaintStroke *stroke = op->customdata; @@ -2779,7 +2779,7 @@ static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me) tessface_origindex, me->totface); } -static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const float UNUSED(mouse[2])) +static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const float UNUSED(mouse[2])) { ToolSettings *ts = CTX_data_tool_settings(C); struct PaintStroke *stroke = op->customdata; @@ -2793,12 +2793,12 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const fl /* context checks could be a poll() */ me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) - return OPERATOR_PASS_THROUGH; + return false; if (me->mloopcol == NULL) make_vertexcol(ob); if (me->mloopcol == NULL) - return OPERATOR_CANCELLED; + return false; /* Update tessface data if needed * Added here too because e.g. switching to/from edit mode would remove tessface data, diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index eb40cb00b41..74792d19607 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4261,7 +4261,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin) * (This allows us to ignore the GL depth buffer) * Returns 0 if the ray doesn't hit the mesh, non-zero otherwise */ -int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]) +bool sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]) { ViewContext vc; Object *ob; @@ -4430,7 +4430,7 @@ static void sculpt_flush_update(bContext *C) /* Returns whether the mouse/stylus is over the mesh (1) * or over the background (0) */ -static int over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float y) +static bool over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float y) { float mouse[2], co[3]; @@ -4440,7 +4440,7 @@ static int over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float return sculpt_stroke_get_location(C, co, mouse); } -static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op, +static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const float mouse[2]) { /* Don't start the stroke until mouse goes over the mesh. diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index a69271463cf..6e8be18bea9 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -63,7 +63,7 @@ void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct int need_pmap, int need_mask); /* Stroke */ -int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]); +bool sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2]); /* Dynamic topology */ void sculpt_pbvh_clear(Object *ob); -- cgit v1.2.3