Allow hiding separate hiding of overlays on stroke.
authorAntony Riakiotakis <kalast@gmail.com>
Tue, 23 Apr 2013 00:32:51 +0000 (00:32 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Tue, 23 Apr 2013 00:32:51 +0000 (00:32 +0000)
release/scripts/startup/bl_ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/paint.c
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/makesdna/DNA_brush_types.h
source/blender/makesrna/intern/rna_brush.c

index c0c84c4449f6ba9187f39354a8db60ce9b87a9ef..8aae19e8bb06337c5dcd0af0ee2e2bc14feed16b 100644 (file)
@@ -814,7 +814,7 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
         
         sub = row.row()
         sub.prop(brush, "texture_overlay_alpha", text="Alpha")
-        sub.prop(brush, "cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
+        sub.prop(brush, "primary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
 
 class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
@@ -852,7 +852,7 @@ class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
         
         sub = row.row()
         sub.prop(brush, "mask_overlay_alpha", text="Alpha")
-        sub.prop(brush, "cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
+        sub.prop(brush, "secondary_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
 
 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
index c62261809580755f33526710b310566c99ab4df7..a8e61fc09b9fc9bee496d00a30ae172af8e927c2 100644 (file)
@@ -52,6 +52,8 @@ struct Tex;
 struct ImagePool;
 struct UnifiedPaintSettings;
 
+enum OverlayFlags;
+
 extern const char PAINT_CURSOR_SCULPT[3];
 extern const char PAINT_CURSOR_VERTEX_PAINT[3];
 extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
@@ -72,17 +74,21 @@ typedef enum OverlayControlFlags {
        PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY = 1,
        PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY = (1 << 2),
        PAINT_INVALID_OVERLAY_CURVE = (1 << 3),
-       PAINT_OVERLAY_OVERRIDE = (1 << 4)
+       PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4),
+       PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5),
+       PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6)
 } OverlayControlFlags;
 
+#define PAINT_OVERRIDE_MASK (PAINT_OVERLAY_OVERRIDE_SECONDARY | \
+                                                    PAINT_OVERLAY_OVERRIDE_PRIMARY | \
+                                                    PAINT_OVERLAY_OVERRIDE_CURSOR)
+
 void BKE_paint_invalidate_overlay_tex(struct Scene *scene, const struct Tex *tex);
 void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct CurveMapping *curve);
 void BKE_paint_invalidate_overlay_all(void);
 OverlayControlFlags BKE_paint_get_overlay_flags(void);
 void BKE_paint_reset_overlay_invalid(OverlayControlFlags flag);
-void BKE_paint_set_overlay_override(bool flag);
-bool BKE_paint_get_overlay_override(void);
-
+void BKE_paint_set_overlay_override(enum OverlayFlags flag);
 
 void BKE_paint_init(struct Paint *p, const char col[3]);
 void BKE_paint_free(struct Paint *p);
index e52d1d3b6833b269556578800623c3be699c9707..e3709143277d6c98f0b2c163e0c125ac838ea0bb 100644 (file)
@@ -320,7 +320,9 @@ void BKE_brush_debug_print_state(Brush *br)
        BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_CURSOR);
        BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_PRIMARY);
        BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_SECONDARY);
-       BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_OVERRIDE_ON_STROKE);
+       BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE);
+       BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE);
+       BR_TEST_FLAG_OVERLAY(BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE);
 
        BR_TEST(jitter, f);
        BR_TEST(spacing, d);
index ef751d130db857e52645512f2c0d79199de84812..3912a79e70300aaee13c1bc862839a8f1a19ed83 100644 (file)
@@ -94,20 +94,21 @@ OverlayControlFlags BKE_paint_get_overlay_flags(void)
        return overlay_flags;
 }
 
-void BKE_paint_set_overlay_override(bool flag)
+void BKE_paint_set_overlay_override(OverlayFlags flags)
 {
-       if (flag)
-               overlay_flags |= PAINT_OVERLAY_OVERRIDE;
-       else
-               overlay_flags &= ~PAINT_OVERLAY_OVERRIDE;
-}
-
-bool BKE_paint_get_overlay_override(void)
-{
-       return ((overlay_flags & PAINT_OVERLAY_OVERRIDE) != 0 );
+       if (flags & BRUSH_OVERLAY_OVERRIDE_MASK) {
+               if (flags & BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE)
+                       overlay_flags |= PAINT_OVERLAY_OVERRIDE_CURSOR;
+               if (flags & BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE)
+                       overlay_flags |= PAINT_OVERLAY_OVERRIDE_PRIMARY;
+               if (flags & BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE)
+                       overlay_flags |= PAINT_OVERLAY_OVERRIDE_SECONDARY;
+       }
+       else {
+               overlay_flags &= ~(PAINT_OVERRIDE_MASK);
+       }
 }
 
-
 void BKE_paint_reset_overlay_invalid(OverlayControlFlags flag)
 {
        overlay_flags &= ~(flag);
index 2f49433d5bb6d71afe3e4365841c90a3df745aab..f6b706ba067f2debe264002251243ce1df57d288 100644 (file)
@@ -706,7 +706,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush,
 {
        /* color means that primary brush texture is colured and secondary is used for alpha/mask control */
        bool col = ELEM3(mode, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D, PAINT_VERTEX) ? true: false;
-
+       OverlayControlFlags flags = BKE_paint_get_overlay_flags();
        /* save lots of GL state
         * TODO: check on whether all of these are needed? */
        glPushAttrib(GL_COLOR_BUFFER_BIT |
@@ -723,12 +723,17 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush,
 
        /* coloured overlay should be drawn separately */
        if (col) {
-               paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, true, true);
-               paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, false);
-               paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
+               if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY))
+                       paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, true, true);
+               if (!(flags & PAINT_OVERLAY_OVERRIDE_SECONDARY))
+                       paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, false);
+               if (!(flags & PAINT_OVERLAY_OVERRIDE_CURSOR))
+                       paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
        } else {
-               paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, true);
-               paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
+               if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY))
+                       paint_draw_tex_overlay(ups, brush, vc, x, y, zoom, false, true);
+               if (!(flags & PAINT_OVERLAY_OVERRIDE_CURSOR))
+                       paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
        }
 
        glPopAttrib();
@@ -805,8 +810,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
                ups->brush_rotation = 0.0;
 
        /* draw overlay */
-       if (!BKE_paint_get_overlay_override())
-               paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode);
+       paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode);
 
        /* TODO: as sculpt and other paint modes are unified, this
         * special mode of drawing will go away */
index d754567bd992a1cf516ec194fdde295c60c3fccc..7133585f41d6430d9ffbf8e924f0b18988689da4 100644 (file)
@@ -434,15 +434,14 @@ PaintStroke *paint_stroke_new(bContext *C,
        stroke->done = done;
        stroke->event_type = event_type; /* for modal, return event */
        
-       if (br->overlay_flags & BRUSH_OVERLAY_OVERRIDE_ON_STROKE)
-               BKE_paint_set_overlay_override(true);
+       BKE_paint_set_overlay_override(br->overlay_flags);
 
        return stroke;
 }
 
 void paint_stroke_data_free(struct wmOperator *op)
 {
-       BKE_paint_set_overlay_override(false);
+       BKE_paint_set_overlay_override(0);
        MEM_freeN(op->customdata);
        op->customdata = NULL;
 }
index c37758fb940fd7da35f34a27ce000fb03b3abee9..824091dab329aff358b4fd0ddc2abde75db982f4 100644 (file)
@@ -158,9 +158,15 @@ typedef enum OverlayFlags {
        BRUSH_OVERLAY_CURSOR = (1),
        BRUSH_OVERLAY_PRIMARY = (1 << 1),
        BRUSH_OVERLAY_SECONDARY = (1 << 2),
-       BRUSH_OVERLAY_OVERRIDE_ON_STROKE = (1 << 3)
+       BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE = (1 << 3),
+       BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE = (1 << 4),
+       BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE = (1 << 5)
 } OverlayFlags;
 
+#define BRUSH_OVERLAY_OVERRIDE_MASK (BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE | \
+                                                                        BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE | \
+                                                                        BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE)
+
 /* Brush.sculpt_tool */
 typedef enum BrushSculptTool {
        SCULPT_TOOL_DRAW = 1,
index 66a5ed947d72da294c0bc3ca6e7a8e1d6f7de177..409fc72126c7137b0c47be48d2dbf17b930785b8 100644 (file)
@@ -1028,7 +1028,17 @@ static void rna_def_brush(BlenderRNA *brna)
        RNA_def_property_update(prop, 0, "rna_Brush_update");
 
        prop = RNA_def_property(srna, "cursor_overlay_override", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_OVERRIDE_ON_STROKE);
+       RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE);
+       RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
+       RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+       prop = RNA_def_property(srna, "primary_overlay_override", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE);
+       RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
+       RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+       prop = RNA_def_property(srna, "secondary_overlay_override", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE);
        RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
        RNA_def_property_update(prop, 0, "rna_Brush_update");