[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57635] branches/soc-2013-paint: Yet another painter oriented commit: Add explicit way to deactivate

Antony Riakiotakis kalast at gmail.com
Fri Jun 21 14:57:26 CEST 2013


Revision: 57635
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57635
Author:   psy-fi
Date:     2013-06-21 12:57:25 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
Yet another painter oriented commit: Add explicit way to deactivate
masking if user wants to based on artist feedback. This allows to
accumulate dabs on top of each other even in space or dab stroke mode.

The checkbox is located under the imagepaint colour settings and is
called "accumulate"

Modified Paths:
--------------
    branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py
    branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c
    branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c

Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py	2013-06-21 12:34:34 UTC (rev 57634)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/space_image.py	2013-06-21 12:57:25 UTC (rev 57635)
@@ -695,6 +695,8 @@
         col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=2, cols=6)
 
         if brush:
+            capabilities = brush.imapaint_capabilities
+
             col = layout.column()
 
             if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'):
@@ -718,8 +720,15 @@
                 col.separator()
                 col.prop(brush, "clone_image", text="Image")
                 col.prop(brush, "clone_alpha", text="Alpha")
+            
+            # use_accumulate
+            if capabilities.has_accumulate:
+                col.separator()
 
+                col.prop(brush, "use_accumulate")
 
+
+
 class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
     bl_label = "Texture"
     bl_options = {'DEFAULT_CLOSED'}
@@ -882,7 +891,11 @@
         row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
 
+        sub = row.row()
+        sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
+        sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
+
 class IMAGE_PT_tools_brush_appearance(BrushButtonsPanel, Panel):
     bl_label = "Appearance"
     bl_options = {'DEFAULT_CLOSED'}

Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-06-21 12:34:34 UTC (rev 57634)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-06-21 12:57:25 UTC (rev 57635)
@@ -681,14 +681,12 @@
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
             else:
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
-        
-            sub = row.row()
-            sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
-            sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
         # Texture Paint Mode #
 
         elif context.image_paint_object and brush:
+            capabilities = brush.imapaint_capabilities
+
             col = layout.column()
 
             if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'):
@@ -712,6 +710,12 @@
             col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
             col.prop(brush, "use_alpha")
 
+            # use_accumulate
+            if capabilities.has_accumulate:
+                col.separator()
+
+                col.prop(brush, "use_accumulate")
+
             col = layout.column(align=True)
             col.label(text="Overlay:")
 
@@ -720,10 +724,6 @@
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
             else:
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
-        
-            sub = row.row()
-            sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
-            sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
 
         # Weight Paint Mode #
@@ -777,10 +777,6 @@
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
             else:
                 row.prop(brush, "use_cursor_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
-        
-            sub = row.row()
-            sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
-            sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
 
 class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
@@ -977,6 +973,10 @@
         row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
         row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
         row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
+        
+        sub = row.row()
+        sub.prop(brush, "cursor_overlay_alpha", text="Alpha")
+        sub.prop(brush, "use_cursor_overlay_override", toggle=True, text="", icon='BRUSH_DATA')
 
 
 class VIEW3D_PT_sculpt_topology(Panel, View3DPaintPanel):

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-06-21 12:34:34 UTC (rev 57634)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-06-21 12:57:25 UTC (rev 57635)
@@ -995,7 +995,8 @@
 	/* set masking */
 	s->do_masking = (s->brush->flag & BRUSH_AIRBRUSH ||
 	                 (s->brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
-	                 (s->brush->mtex.tex && !ELEM3(s->brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)))
+	                 (s->brush->mtex.tex && !ELEM3(s->brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ||
+	                 s->brush->flag & BRUSH_ACCUMULATE)
 	                 ? false : true;
 	
 	return 1;

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-06-21 12:34:34 UTC (rev 57634)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-06-21 12:57:25 UTC (rev 57635)
@@ -4109,7 +4109,8 @@
 		/* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
 		ps->do_masking = (brush->flag & BRUSH_AIRBRUSH ||
 		                  (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
-		                  (brush->mtex.tex && !ELEM3(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)))
+		                  (brush->mtex.tex && !ELEM3(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ||
+		                  brush->flag & BRUSH_ACCUMULATE)
 		                 ? false : true;
 		ps->is_texbrush = (brush->mtex.tex && brush->imagepaint_tool == PAINT_TOOL_DRAW) ? true : false;
 		ps->is_maskbrush = (brush->mask_mtex.tex)? true : false;

Modified: branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c	2013-06-21 12:34:34 UTC (rev 57634)
+++ branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c	2013-06-21 12:57:25 UTC (rev 57635)
@@ -256,11 +256,28 @@
 	            MTEX_MAP_MODE_RANDOM);
 }
 
-static PointerRNA rna_Sculpt_sculpt_tool_capabilities_get(PointerRNA *ptr)
+static int rna_ImapaintToolCapabilities_has_accumulate_get(PointerRNA *ptr)
 {
+	/* only support for draw tool */
+	Brush *br = (Brush *)ptr->data;
+	return (br->imagepaint_tool == PAINT_TOOL_DRAW)
+	        && !ELEM3(br->flag,
+	        BRUSH_AIRBRUSH,
+	        BRUSH_ANCHORED,
+	        BRUSH_RESTORE_MESH);
+}
+
+
+static PointerRNA rna_Sculpt_tool_capabilities_get(PointerRNA *ptr)
+{
 	return rna_pointer_inherit_refine(ptr, &RNA_SculptToolCapabilities, ptr->id.data);
 }
 
+static PointerRNA rna_Imapaint_tool_capabilities_get(PointerRNA *ptr)
+{
+	return rna_pointer_inherit_refine(ptr, &RNA_ImapaintToolCapabilities, ptr->id.data);
+}
+
 static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr)
 {
 	return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data);
@@ -588,6 +605,31 @@
 #undef BRUSH_CAPABILITY
 }
 
+static void rna_def_imapaint_capabilities(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "ImapaintToolCapabilities", NULL);
+	RNA_def_struct_sdna(srna, "Brush");
+	RNA_def_struct_nested(brna, srna, "Brush");
+	RNA_def_struct_ui_text(srna, "Image Paint Capabilities",
+	                       "Read-only indications of which brush operations "
+	                       "are supported by the current image paint brush");
+
+#define IMAPAINT_TOOL_CAPABILITY(prop_name_, ui_name_)                          \
+	prop = RNA_def_property(srna, #prop_name_,                          \
+	                        PROP_BOOLEAN, PROP_NONE);                   \
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);                   \
+	RNA_def_property_boolean_funcs(prop, "rna_ImapaintToolCapabilities_"      \
+	                               #prop_name_ "_get", NULL);           \
+	RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+	IMAPAINT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
+
+#undef IMAPAINT_TOOL_CAPABILITY
+}
+
 static void rna_def_brush(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -1186,8 +1228,14 @@
 	prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "SculptToolCapabilities");
-	RNA_def_property_pointer_funcs(prop, "rna_Sculpt_sculpt_tool_capabilities_get", NULL, NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Sculpt_tool_capabilities_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode");
+
+	prop = RNA_def_property(srna, "imapaint_capabilities", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_NEVER_NULL);
+	RNA_def_property_struct_type(prop, "ImapaintToolCapabilities");
+	RNA_def_property_pointer_funcs(prop, "rna_Imapaint_tool_capabilities_get", NULL, NULL, NULL);
+	RNA_def_property_ui_text(prop, "Image Painting Capabilities", "Brush's capabilities in image paint mode");
 }
 
 
@@ -1250,6 +1298,7 @@
 	rna_def_brush(brna);
 	rna_def_brush_capabilities(brna);
 	rna_def_sculpt_capabilities(brna);
+	rna_def_imapaint_capabilities(brna);
 	rna_def_brush_texture_slot(brna);

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list