Fix #25483: Brush appearance color

Set special brush flag when inversion stroke was started, not wery nice, but
we can't make better with current events system implementation.
This commit is contained in:
Sergey Sharybin 2011-01-04 14:46:29 +00:00
parent 8b1bfbcfea
commit df29715498
3 changed files with 16 additions and 4 deletions

@ -591,7 +591,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
brush_set_size(brush, pixel_radius);
// XXX: no way currently to know state of pen flip or invert key modifier without starting a stroke
flip = 1;
flip = brush->flag & BRUSH_INVERTED ? -1 : 1;
sign = flip * ((brush->flag & BRUSH_DIR_IN)? -1 : 1);

@ -2904,6 +2904,11 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->invert = mode == WM_BRUSHSTROKE_INVERT;
cache->alt_smooth = mode == WM_BRUSHSTROKE_SMOOTH;
/* not very nice, but with current events system implementation
we can't handle brush appearance inversion hotkey separately (sergey) */
if(cache->invert) brush->flag |= BRUSH_INVERTED;
else brush->flag &= ~BRUSH_INVERTED;
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p= &sd->paint;
@ -3452,14 +3457,17 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *unused)
/* Finished */
if(ss->cache) {
Brush *brush= paint_brush(&sd->paint);
brush->flag &= ~BRUSH_INVERTED;
sculpt_stroke_modifiers_check(C, ss);
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p= &sd->paint;
Brush *br= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
if(br) {
paint_brush_set(p, br);
brush= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
if(brush) {
paint_brush_set(p, brush);
}
}

@ -130,6 +130,10 @@ typedef struct Brush {
#define BRUSH_FRONTFACE (1<<27)
#define BRUSH_CUSTOM_ICON (1<<28)
/* temporary flag which sets up autmatically for correct
brush drawing when inverted modal operator is running */
#define BRUSH_INVERTED (1<<29)
/* Brush.sculpt_tool */
#define SCULPT_TOOL_DRAW 1
#define SCULPT_TOOL_SMOOTH 2