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
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2019-10-30 18:57:11 +0300
committerPablo Dobarro <pablodp606@gmail.com>2019-10-31 16:45:26 +0300
commitcd827194f7cc771e9947d474ba0e7c4ae2a2aa9a (patch)
tree2040eabed0a939853a08a30d0b930ad1f1458424
parentbe2bdaf6aab672feb1961e2b6a2fd09f979bba2e (diff)
Paint: Option to disable antialiasing
You may want to disable antialiasing if you are working with pixel art or low resolution textures. It is enabled by default. Reviewed By: jbakker, campbellbarton Differential Revision: https://developer.blender.org/D6044
-rw-r--r--release/scripts/startup/bl_ui/properties_paint_common.py2
-rw-r--r--source/blender/blenkernel/intern/brush.c1
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c7
-rw-r--r--source/blender/makesdna/DNA_brush_defaults.h1
-rw-r--r--source/blender/makesdna/DNA_brush_types.h10
-rw-r--r--source/blender/makesrna/intern/rna_brush.c5
7 files changed, 26 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 6720c2cd24d..609eb0184c4 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -199,6 +199,8 @@ def brush_texpaint_common_options(_panel, _context, layout, brush, _settings, *,
if projpaint:
col.prop(brush, "use_alpha")
+ else:
+ col.prop(brush, "use_paint_antialiasing")
# Used in both the View3D toolbar and texture properties
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index fe740f4898e..73b7b1e2858 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -84,6 +84,7 @@ static void brush_defaults(Brush *brush)
FROM_DEFAULT(normal_weight);
FROM_DEFAULT(fill_threshold);
FROM_DEFAULT(flag);
+ FROM_DEFAULT(sampling_flag);
FROM_DEFAULT_PTR(rgb);
FROM_DEFAULT_PTR(secondary_rgb);
FROM_DEFAULT(spacing);
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index c9fb8b6990b..9fce89558b6 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -435,6 +435,9 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
* Note that sculpt is an exception,
* it's values are overwritten by #BKE_brush_sculpt_reset below. */
brush->alpha = 1.0;
+
+ /* Enable antialiasing by default */
+ brush->sampling_flag |= BRUSH_PAINT_ANTIALIASING;
}
{
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 9c95a3cee4d..a1e67e78a10 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -387,7 +387,12 @@ static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter,
m = mask;
int aa_samples = 1.0f / (radius * 0.20f);
- aa_samples = clamp_i(aa_samples, 3, 16);
+ if (brush->sampling_flag & BRUSH_PAINT_ANTIALIASING) {
+ aa_samples = clamp_i(aa_samples, 3, 16);
+ }
+ else {
+ aa_samples = 1;
+ }
/* Temporal until we have the brush properties */
const float hardness = 1.0f;
diff --git a/source/blender/makesdna/DNA_brush_defaults.h b/source/blender/makesdna/DNA_brush_defaults.h
index 714c205cda2..b2d4124a348 100644
--- a/source/blender/makesdna/DNA_brush_defaults.h
+++ b/source/blender/makesdna/DNA_brush_defaults.h
@@ -34,6 +34,7 @@
{ \
.blend = 0, \
.flag = (BRUSH_ALPHA_PRESSURE | BRUSH_SPACE | BRUSH_SPACE_ATTEN), \
+ .sampling_flag = (BRUSH_PAINT_ANTIALIASING), \
\
.ob_mode = OB_MODE_ALL_PAINT, \
\
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index fc8763f1519..63fbf576bba 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -245,8 +245,9 @@ typedef struct Brush {
float weight;
/** Brush diameter. */
int size;
- /** General purpose flag. */
+ /** General purpose flags. */
int flag;
+ int sampling_flag;
/** Pressure influence for mask. */
int mask_pressure;
/** Jitter the position of the brush. */
@@ -283,7 +284,7 @@ typedef struct Brush {
/** Source for fill tool color gradient application. */
char gradient_fill_mode;
- char _pad;
+ char _pad[5];
/** Projection shape (sphere, circle). */
char falloff_shape;
float falloff_angle;
@@ -435,6 +436,11 @@ typedef enum eBrushFlags {
BRUSH_CURVE = (1u << 31),
} eBrushFlags;
+/* Brush.sampling_flag */
+typedef enum eBrushSamplingFlags {
+ BRUSH_PAINT_ANTIALIASING = (1 << 0),
+} eBrushSamplingFlags;
+
typedef enum {
BRUSH_MASK_PRESSURE_RAMP = (1 << 1),
BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2),
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 99c1bdfdbee..a392e4c080f 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -2007,6 +2007,11 @@ static void rna_def_brush(BlenderRNA *brna)
"Apply the maximum grab strength to the active vertex instead of the cursor location");
RNA_def_property_update(prop, 0, "rna_Brush_update");
+ prop = RNA_def_property(srna, "use_paint_antialiasing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "sampling_flag", BRUSH_PAINT_ANTIALIASING);
+ RNA_def_property_ui_text(prop, "Antialasing", "Smooths the edges of the strokes");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);