Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-01-04 17:46:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2011-01-04 17:46:29 +0300
commitdf29715498a2e601f1c57ff68b168e5984ef6491 (patch)
treeae805a7abcffd1bddbe4542146c3bdcfff7f4318 /source
parent8b1bfbcfea8af306dbf42743b5f67d46159015c5 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c14
-rw-r--r--source/blender/makesdna/DNA_brush_types.h4
3 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index ea99844bfac..ccbaa3f5b57 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -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);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 55c7247650a..15d940cc8a3 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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);
}
}
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 8fca829101b..37c6200b91f 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -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