From cb6e795a47db6f86c6592480a0743eaae33900d4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 10 Oct 2013 20:23:24 +0000 Subject: [PATCH] fix [#37031] bones are not selectable in weight paint mode anymore --- source/blender/editors/sculpt_paint/paint_intern.h | 1 + source/blender/editors/sculpt_paint/paint_ops.c | 11 +++++++++-- source/blender/editors/sculpt_paint/paint_stroke.c | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 607edcab9f8..2545328ec65 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -74,6 +74,7 @@ bool paint_space_stroke_enabled(struct Brush *br, enum PaintMode mode); bool paint_supports_dynamic_size(struct Brush *br, enum PaintMode mode); bool paint_supports_dynamic_tex_coords(struct Brush *br, enum PaintMode mode); bool paint_supports_smooth_stroke(struct Brush *br, enum PaintMode mode); +bool paint_supports_texture(enum PaintMode mode); bool paint_supports_jitter(enum PaintMode mode); struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 0b0607babc1..8b038973831 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -728,9 +728,16 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve static int stencil_control_poll(bContext *C) { - Paint *paint = BKE_paint_get_active_from_context(C); - Brush *br = BKE_paint_brush(paint); + PaintMode mode = BKE_paintmode_get_active_from_context(C); + Paint *paint; + Brush *br; + + if (!paint_supports_texture(mode)) + return false; + + paint = BKE_paint_get_active_from_context(C); + br = BKE_paint_brush(paint); return (br && (br->mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL || br->mask_mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL)); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 973f6555deb..b00b1c3ecff 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -572,6 +572,12 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) return true; } +bool paint_supports_texture(PaintMode mode) +{ + /* ommit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */ + return ELEM4(mode, PAINT_SCULPT, PAINT_VERTEX, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D); +} + /* return true if the brush size can change during paint (normally used for pressure) */ bool paint_supports_dynamic_tex_coords(Brush *br, PaintMode mode) {