[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57622] branches/soc-2013-paint: Add first version of pressure influence for mask textures based on
Antony Riakiotakis
kalast at gmail.com
Fri Jun 21 00:06:25 CEST 2013
Revision: 57622
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57622
Author: psy-fi
Date: 2013-06-20 22:06:25 +0000 (Thu, 20 Jun 2013)
Log Message:
-----------
Add first version of pressure influence for mask textures based on
feedback from David Revoy:
http://www.davidrevoy.com/article107/textured-brush-in-floss-digital-
There are two methods, cutoff and ramp.
Cutoff simply selects between 0 and 1 based on stylus pressure while
ramp distributes the mask effect above the pressure value.
Too many words, here is a screenshot with the effect:
http://www.pasteall.org/pic/show.php?id=53865
>From top to bottom:
* Strength pressure influence ON:
- No mask influence
- Cutoff mask influence
- Ramp mask influence
* Strength pressure influence OFF:
- No mask influence
- Cutoff mask influence
- Ramp mask influence
The brush masking is still in need of attention because it behaves
erratically, still it's nice for an zero.alpha commit ;)
Modified Paths:
--------------
branches/soc-2013-paint/release/scripts/startup/bl_ui/properties_paint_common.py
branches/soc-2013-paint/source/blender/blenkernel/intern/brush.c
branches/soc-2013-paint/source/blender/makesdna/DNA_brush_types.h
branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c
Modified: branches/soc-2013-paint/release/scripts/startup/bl_ui/properties_paint_common.py
===================================================================
--- branches/soc-2013-paint/release/scripts/startup/bl_ui/properties_paint_common.py 2013-06-20 21:36:30 UTC (rev 57621)
+++ branches/soc-2013-paint/release/scripts/startup/bl_ui/properties_paint_common.py 2013-06-20 22:06:25 UTC (rev 57622)
@@ -135,6 +135,7 @@
if brush.mask_texture:
col = layout.column()
+ col.prop(brush, "use_pressure_masking", text="");
col.label(text="Angle:")
col.active = brush.brush_capabilities.has_texture_angle
col.prop(mask_tex_slot, "angle", text="")
Modified: branches/soc-2013-paint/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2013-paint/source/blender/blenkernel/intern/brush.c 2013-06-20 21:36:30 UTC (rev 57621)
+++ branches/soc-2013-paint/source/blender/blenkernel/intern/brush.c 2013-06-20 22:06:25 UTC (rev 57622)
@@ -759,6 +759,17 @@
rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
}
+ switch(br->mask_pressure) {
+ case BRUSH_MASK_PRESSURE_CUTOFF:
+ intensity = (intensity < ups->pressure_value)? 1.0 : 0.0;
+ break;
+ case BRUSH_MASK_PRESSURE_RAMP:
+ intensity = ups->pressure_value + intensity*(1.0 - ups->pressure_value);
+ break;
+ default:
+ break;
+ }
+
return intensity;
}
Modified: branches/soc-2013-paint/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2013-paint/source/blender/makesdna/DNA_brush_types.h 2013-06-20 21:36:30 UTC (rev 57621)
+++ branches/soc-2013-paint/source/blender/makesdna/DNA_brush_types.h 2013-06-20 22:06:25 UTC (rev 57622)
@@ -71,6 +71,7 @@
float weight; /* brush weight */
int size; /* brush diameter */
int flag; /* general purpose flag */
+ int mask_pressure; /* pressure influence for mask */
float jitter; /* jitter the position of the brush */
int jitter_absolute; /* absolute jitter in pixels */
int overlay_flags;
@@ -83,7 +84,6 @@
float alpha; /* opacity */
float secondary_rgb[3]; /* background color */
- float pad;
int sculpt_plane; /* the direction of movement for sculpt vertices */
@@ -156,6 +156,11 @@
BRUSH_ABSOLUTE_JITTER = (1 << 30)
} BrushFlags;
+typedef enum {
+ BRUSH_MASK_PRESSURE_RAMP = (1 << 1),
+ BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2)
+} BrushMaskPressureFlags;
+
/* Brush.overlay_flags */
typedef enum OverlayFlags {
BRUSH_OVERLAY_CURSOR = (1),
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-20 21:36:30 UTC (rev 57621)
+++ branches/soc-2013-paint/source/blender/makesrna/intern/rna_brush.c 2013-06-20 22:06:25 UTC (rev 57622)
@@ -657,6 +657,13 @@
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem brush_mask_pressure_items[] = {
+ {0, "NONE", 0, "Off", ""},
+ {BRUSH_MASK_PRESSURE_RAMP, "RAMP", ICON_STYLUS_PRESSURE, "Ramp", ""},
+ {BRUSH_MASK_PRESSURE_CUTOFF, "CUTOFF", ICON_STYLUS_PRESSURE, "Cutoff", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "Brush", "ID");
RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting");
RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
@@ -934,6 +941,12 @@
RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "use_pressure_masking", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_pressure");
+ RNA_def_property_enum_items(prop, brush_mask_pressure_items);
+ RNA_def_property_ui_text(prop, "Mask Pressure Mode", "Pen pressure makes texture influence smaller");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERSE_SMOOTH_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
More information about the Bf-blender-cvs
mailing list