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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-01-15 03:54:51 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-01-15 03:54:51 +0400
commit30e759c75ba9625fe46bc6b7710358282a61d4c1 (patch)
tree872469d64544c09a9155d871d4429f701df6172b /source/blender/blenkernel/intern/brush.c
parent046bf80881b4c7ea2fb108b5588070a6ffa14c20 (diff)
Fix all remaining unified paint settings uses of current Scene.
Things like brush size and strength accessors now take a scene parameter rather than guessing about which Scene's unified paint settings to use. Setting the size/strength through RNA can now be done separately for the brush or the UnifiedPaintSettings. The UI python code required updating to check whether the size/strength controls should use brush or UnifiedPaintSettings RNA. Radial control also required some updates to switch between the two RNA sources.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r--source/blender/blenkernel/intern/brush.c412
1 files changed, 155 insertions, 257 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index b78b15c9a6a..362fa6e5e9a 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -487,14 +487,14 @@ int brush_clone_image_delete(Brush *brush)
}
/* Brush Sampling */
-void brush_sample_tex(Brush *brush, const float xy[2], float rgba[4], const int thread)
+void brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread)
{
MTex *mtex= &brush->mtex;
if (mtex && mtex->tex) {
float co[3], tin, tr, tg, tb, ta;
int hasrgb;
- const int radius= brush_size(brush);
+ const int radius= brush_size(scene, brush);
co[0]= xy[0]/radius;
co[1]= xy[1]/radius;
@@ -521,14 +521,14 @@ void brush_sample_tex(Brush *brush, const float xy[2], float rgba[4], const int
}
/* TODO, use define for 'texfall' arg */
-void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction)
+void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction)
{
ImBuf *ibuf;
float xy[2], rgba[4], *dstf;
int x, y, rowbytes, xoff, yoff, imbflag;
- const int radius= brush_size(brush);
+ const int radius= brush_size(scene, brush);
char *dst, crgb[3];
- const float alpha= brush_alpha(brush);
+ const float alpha= brush_alpha(scene, brush);
float brush_rgb[3];
imbflag= (flt)? IB_rectfloat: IB_rect;
@@ -559,10 +559,10 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
dstf[3]= alpha*brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
else if (texfall == 1) {
- brush_sample_tex(brush, xy, dstf, 0);
+ brush_sample_tex(scene, brush, xy, dstf, 0);
}
else {
- brush_sample_tex(brush, xy, rgba, 0);
+ brush_sample_tex(scene, brush, xy, rgba, 0);
mul_v3_v3v3(dstf, rgba, brush_rgb);
dstf[3] = rgba[3]*alpha*brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
@@ -589,14 +589,14 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
dst[3] = FTOCHAR(alpha_f);
}
else if (texfall == 1) {
- brush_sample_tex(brush, xy, rgba, 0);
+ brush_sample_tex(scene, brush, xy, rgba, 0);
dst[0] = FTOCHAR(rgba[0]);
dst[1] = FTOCHAR(rgba[1]);
dst[2] = FTOCHAR(rgba[2]);
dst[3] = FTOCHAR(rgba[3]);
}
else if (texfall == 2) {
- brush_sample_tex(brush, xy, rgba, 0);
+ brush_sample_tex(scene, brush, xy, rgba, 0);
mul_v3_v3(rgba, brush->rgb);
alpha_f = rgba[3] * alpha * brush_curve_strength_clamp(brush, len_v2(xy), radius);
@@ -606,7 +606,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
dst[3] = FTOCHAR(alpha_f);
}
else {
- brush_sample_tex(brush, xy, rgba, 0);
+ brush_sample_tex(scene, brush, xy, rgba, 0);
alpha_f = rgba[3] * alpha * brush_curve_strength_clamp(brush, len_v2(xy), radius);
dst[0] = crgb[0];
@@ -621,6 +621,125 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf
*outbuf= ibuf;
}
+/* Unified Size and Strength */
+
+// XXX: be careful about setting size and unprojected radius
+// because they depend on one another
+// these functions do not set the other corresponding value
+// this can lead to odd behavior if size and unprojected
+// radius become inconsistent.
+// the biggest problem is that it isn't possible to change
+// unprojected radius because a view context is not
+// available. my ussual solution to this is to use the
+// ratio of change of the size to change the unprojected
+// radius. Not completely convinced that is correct.
+// In anycase, a better solution is needed to prevent
+// inconsistency.
+
+void brush_set_size(Scene *scene, Brush *brush, int size)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ if (ups->flag & UNIFIED_PAINT_SIZE)
+ ups->size= size;
+ else
+ brush->size= size;
+}
+
+int brush_size(const Scene *scene, Brush *brush)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ return (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size;
+}
+
+int brush_use_locked_size(const Scene *scene, Brush *brush)
+{
+ const short us_flag = scene->toolsettings->unified_paint_settings.flag;
+
+ return (us_flag & UNIFIED_PAINT_SIZE) ?
+ (us_flag & UNIFIED_PAINT_BRUSH_LOCK_SIZE) :
+ (brush->flag & BRUSH_LOCK_SIZE);
+}
+
+int brush_use_size_pressure(const Scene *scene, Brush *brush)
+{
+ const short us_flag = scene->toolsettings->unified_paint_settings.flag;
+
+ return (us_flag & UNIFIED_PAINT_SIZE) ?
+ (us_flag & UNIFIED_PAINT_BRUSH_SIZE_PRESSURE) :
+ (brush->flag & BRUSH_SIZE_PRESSURE);
+}
+
+int brush_use_alpha_pressure(const Scene *scene, Brush *brush)
+{
+ const short us_flag = scene->toolsettings->unified_paint_settings.flag;
+
+ return (us_flag & UNIFIED_PAINT_ALPHA) ?
+ (us_flag & UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE) :
+ (brush->flag & BRUSH_ALPHA_PRESSURE);
+}
+
+void brush_set_unprojected_radius(Scene *scene, Brush *brush, float unprojected_radius)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ if (ups->flag & UNIFIED_PAINT_SIZE)
+ ups->unprojected_radius= unprojected_radius;
+ else
+ brush->unprojected_radius= unprojected_radius;
+}
+
+float brush_unprojected_radius(const Scene *scene, Brush *brush)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ return (ups->flag & UNIFIED_PAINT_SIZE) ?
+ ups->unprojected_radius :
+ brush->unprojected_radius;
+}
+
+static void brush_set_alpha(Scene *scene, Brush *brush, float alpha)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ if (ups->flag & UNIFIED_PAINT_ALPHA)
+ ups->alpha= alpha;
+ else
+ brush->alpha= alpha;
+}
+
+float brush_alpha(const Scene *scene, Brush *brush)
+{
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+
+ return (ups->flag & UNIFIED_PAINT_ALPHA) ? ups->alpha : brush->alpha;
+}
+
+/* scale unprojected radius to reflect a change in the brush's 2D size */
+void brush_scale_unprojected_radius(float *unprojected_radius,
+ int new_brush_size,
+ int old_brush_size)
+{
+ float scale = new_brush_size;
+ /* avoid division by zero */
+ if(old_brush_size != 0)
+ scale /= (float)old_brush_size;
+ (*unprojected_radius) *= scale;
+}
+
+/* scale brush size to reflect a change in the brush's unprojected radius */
+void brush_scale_size(int *brush_size,
+ float new_unprojected_radius,
+ float old_unprojected_radius)
+{
+ float scale = new_unprojected_radius;
+ /* avoid division by zero */
+ if(old_unprojected_radius != 0)
+ scale /= new_unprojected_radius;
+ (*brush_size)= (int)((float)(*brush_size) * scale);
+}
+
/* Brush Painting */
typedef struct BrushPainterCache {
@@ -673,8 +792,8 @@ BrushPainter *brush_painter_new(Scene *scene, Brush *brush)
painter->firsttouch= 1;
painter->cache.lastsize= -1; /* force ibuf create in refresh */
- painter->startsize = brush_size(brush);
- painter->startalpha = brush_alpha(brush);
+ painter->startsize = brush_size(scene, brush);
+ painter->startalpha = brush_alpha(scene, brush);
painter->startjitter = brush->jitter;
painter->startspacing = brush->spacing;
@@ -707,8 +826,8 @@ void brush_painter_free(BrushPainter *painter)
{
Brush *brush = painter->brush;
- brush_set_size(brush, painter->startsize);
- brush_set_alpha(brush, painter->startalpha);
+ brush_set_size(painter->scene, brush, painter->startsize);
+ brush_set_alpha(painter->scene, brush, painter->startalpha);
brush->jitter = painter->startjitter;
brush->spacing = painter->startspacing;
@@ -720,12 +839,13 @@ void brush_painter_free(BrushPainter *painter)
static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, int x, int y, int w, int h, int xt, int yt, float *pos)
{
+ Scene *scene= painter->scene;
Brush *brush= painter->brush;
ImBuf *ibuf, *maskibuf, *texibuf;
float *bf, *mf, *tf, *otf=NULL, xoff, yoff, xy[2], rgba[4];
char *b, *m, *t, *ot= NULL;
int dotexold, origx= x, origy= y;
- const int radius= brush_size(brush);
+ const int radius= brush_size(painter->scene, brush);
xoff = -radius + 0.5f;
yoff = -radius + 0.5f;
@@ -763,7 +883,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
xy[0] = x + xoff;
xy[1] = y + yoff;
- brush_sample_tex(brush, xy, tf, 0);
+ brush_sample_tex(scene, brush, xy, tf, 0);
}
bf[0] = tf[0]*mf[0];
@@ -794,7 +914,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
xy[0] = x + xoff;
xy[1] = y + yoff;
- brush_sample_tex(brush, xy, rgba, 0);
+ brush_sample_tex(scene, brush, xy, rgba, 0);
t[0]= FTOCHAR(rgba[0]);
t[1]= FTOCHAR(rgba[1]);
t[2]= FTOCHAR(rgba[2]);
@@ -812,11 +932,12 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float *pos)
{
+ const Scene *scene= painter->scene;
Brush *brush= painter->brush;
BrushPainterCache *cache= &painter->cache;
ImBuf *oldtexibuf, *ibuf;
int imbflag, destx, desty, srcx, srcy, w, h, x1, y1, x2, y2;
- const int diameter= 2*brush_size(brush);
+ const int diameter= 2*brush_size(scene, brush);
imbflag= (cache->flt)? IB_rectfloat: IB_rect;
if (!cache->ibuf)
@@ -866,13 +987,14 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float
static void brush_painter_refresh_cache(BrushPainter *painter, float *pos, int use_color_correction)
{
+ const Scene *scene= painter->scene;
Brush *brush= painter->brush;
BrushPainterCache *cache= &painter->cache;
MTex *mtex= &brush->mtex;
int size;
short flt;
- const int diameter= 2*brush_size(brush);
- const float alpha= brush_alpha(brush);
+ const int diameter= 2*brush_size(scene, brush);
+ const float alpha= brush_alpha(scene, brush);
if (diameter != cache->lastsize ||
alpha != cache->lastalpha ||
@@ -891,11 +1013,11 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos, int u
size= (cache->size)? cache->size: diameter;
if (brush->flag & BRUSH_FIXED_TEX) {
- brush_imbuf_new(brush, flt, 3, size, &cache->maskibuf, use_color_correction);
+ brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction);
brush_painter_fixed_tex_partial_update(painter, pos);
}
else
- brush_imbuf_new(brush, flt, 2, size, &cache->ibuf, use_color_correction);
+ brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction);
cache->lastsize= diameter;
cache->lastalpha= alpha;
@@ -918,16 +1040,16 @@ void brush_painter_break_stroke(BrushPainter *painter)
static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pressure)
{
if (brush_use_alpha_pressure(painter->scene, brush))
- brush_set_alpha(brush, MAX2(0.0f, painter->startalpha*pressure));
+ brush_set_alpha(painter->scene, brush, MAX2(0.0f, painter->startalpha*pressure));
if (brush_use_size_pressure(painter->scene, brush))
- brush_set_size(brush, MAX2(1.0f, painter->startsize*pressure));
+ brush_set_size(painter->scene, brush, MAX2(1.0f, painter->startsize*pressure));
if (brush->flag & BRUSH_JITTER_PRESSURE)
brush->jitter = MAX2(0.0f, painter->startjitter*pressure);
if (brush->flag & BRUSH_SPACING_PRESSURE)
brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure));
}
-void brush_jitter_pos(Brush *brush, float pos[2], float jitterpos[2])
+void brush_jitter_pos(const Scene *scene, Brush *brush, float pos[2], float jitterpos[2])
{
int use_jitter= brush->jitter != 0;
@@ -937,7 +1059,7 @@ void brush_jitter_pos(Brush *brush, float pos[2], float jitterpos[2])
if(use_jitter){
float rand_pos[2];
- const int radius= brush_size(brush);
+ const int radius= brush_size(scene, brush);
const int diameter= 2*radius;
// find random position within a circle of diameter 1
@@ -956,6 +1078,7 @@ void brush_jitter_pos(Brush *brush, float pos[2], float jitterpos[2])
int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user, int use_color_correction)
{
+ Scene *scene= painter->scene;
Brush *brush= painter->brush;
int totpaintops= 0;
@@ -1017,7 +1140,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
else {
float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2];
float t, len, press;
- const int radius= brush_size(brush);
+ const int radius= brush_size(scene, brush);
/* compute brush spacing adapted to brush radius, spacing may depend
on pressure, so update it */
@@ -1042,7 +1165,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
brush_apply_pressure(painter, brush, press);
spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
- brush_jitter_pos(brush, paintpos, finalpos);
+ brush_jitter_pos(scene, brush, paintpos, finalpos);
if (painter->cache.enabled)
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
@@ -1056,7 +1179,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
startdistance -= spacing;
}
} else {
- brush_jitter_pos(brush, pos, finalpos);
+ brush_jitter_pos(scene, brush, pos, finalpos);
if (painter->cache.enabled)
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
@@ -1084,7 +1207,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
while (painter->accumtime >= (double)brush->rate) {
brush_apply_pressure(painter, brush, pressure);
- brush_jitter_pos(brush, pos, finalpos);
+ brush_jitter_pos(scene, brush, pos, finalpos);
if (painter->cache.enabled)
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
@@ -1102,8 +1225,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
painter->lastmousepos[1]= pos[1];
painter->lastpressure= pressure;
- brush_set_alpha(brush, painter->startalpha);
- brush_set_size(brush, painter->startsize);
+ brush_set_alpha(scene, brush, painter->startalpha);
+ brush_set_size(scene, brush, painter->startsize);
brush->jitter = painter->startjitter;
brush->spacing = painter->startspacing;
@@ -1213,228 +1336,3 @@ struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
return im;
}
-
-/* Unified Size and Strength */
-
-/* XXX, wouldnt it be better to only pass the active scene?
- * this can return any old scene! - campbell*/
-
-static short unified_settings(Brush *brush)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- return sce->toolsettings->unified_paint_settings.flag;
- }
- }
-
- return 0;
-}
-
-// XXX: be careful about setting size and unprojected radius
-// because they depend on one another
-// these functions do not set the other corresponding value
-// this can lead to odd behavior if size and unprojected
-// radius become inconsistent.
-// the biggest problem is that it isn't possible to change
-// unprojected radius because a view context is not
-// available. my ussual solution to this is to use the
-// ratio of change of the size to change the unprojected
-// radius. Not completely convinced that is correct.
-// In anycase, a better solution is needed to prevent
-// inconsistency.
-
-static void set_unified_size(Brush *brush, int value)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- sce->toolsettings->unified_paint_settings.size= value;
- }
- }
-}
-
-static int unified_size(Brush *brush)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- return sce->toolsettings->unified_paint_settings.size;
- }
- }
-
- return 35; // XXX magic number
-}
-
-static void set_unified_alpha(Brush *brush, float value)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- sce->toolsettings->unified_paint_settings.alpha= value;
- }
- }
-}
-
-static float unified_alpha(Brush *brush)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- return sce->toolsettings->unified_paint_settings.alpha;
- }
- }
-
- return 0.5f; // XXX magic number
-}
-
-static void set_unified_unprojected_radius(Brush *brush, float value)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- sce->toolsettings->unified_paint_settings.unprojected_radius= value;
- }
- }
-}
-
-static float unified_unprojected_radius(Brush *brush)
-{
- Scene *sce;
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings &&
- ELEM4(brush,
- paint_brush(&(sce->toolsettings->imapaint.paint)),
- paint_brush(&(sce->toolsettings->vpaint->paint)),
- paint_brush(&(sce->toolsettings->wpaint->paint)),
- paint_brush(&(sce->toolsettings->sculpt->paint))))
- {
- return sce->toolsettings->unified_paint_settings.unprojected_radius;
- }
- }
-
- return 0.125f; // XXX magic number
-}
-void brush_set_size(Brush *brush, int size)
-{
- const short us_flag = unified_settings(brush);
-
- if (us_flag & UNIFIED_PAINT_SIZE)
- set_unified_size(brush, size);
- else
- brush->size= size;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
-}
-
-int brush_size(Brush *brush)
-{
- const short us_flag = unified_settings(brush);
-
- return (us_flag & UNIFIED_PAINT_SIZE) ? unified_size(brush) : brush->size;
-}
-
-int brush_use_locked_size(const Scene *scene, Brush *brush)
-{
- const short us_flag = scene->toolsettings->unified_paint_settings.flag;
-
- return (us_flag & UNIFIED_PAINT_SIZE) ?
- (us_flag & UNIFIED_PAINT_BRUSH_LOCK_SIZE) :
- (brush->flag & BRUSH_LOCK_SIZE);
-}
-
-int brush_use_size_pressure(const Scene *scene, Brush *brush)
-{
- const short us_flag = scene->toolsettings->unified_paint_settings.flag;
-
- return (us_flag & UNIFIED_PAINT_SIZE) ?
- (us_flag & UNIFIED_PAINT_BRUSH_SIZE_PRESSURE) :
- (brush->flag & BRUSH_SIZE_PRESSURE);
-}
-
-int brush_use_alpha_pressure(const Scene *scene, Brush *brush)
-{
- const short us_flag = scene->toolsettings->unified_paint_settings.flag;
-
- return (us_flag & UNIFIED_PAINT_ALPHA) ?
- (us_flag & UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE) :
- (brush->flag & BRUSH_ALPHA_PRESSURE);
-}
-
-void brush_set_unprojected_radius(Brush *brush, float unprojected_radius)
-{
- const short us_flag = unified_settings(brush);
-
- if (us_flag & UNIFIED_PAINT_SIZE)
- set_unified_unprojected_radius(brush, unprojected_radius);
- else
- brush->unprojected_radius= unprojected_radius;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
-}
-
-float brush_unprojected_radius(Brush *brush)
-{
- const short us_flag = unified_settings(brush);
-
- return (us_flag & UNIFIED_PAINT_SIZE) ?
- unified_unprojected_radius(brush) :
- brush->unprojected_radius;
-}
-
-void brush_set_alpha(Brush *brush, float alpha)
-{
- const short us_flag = unified_settings(brush);
-
- if (us_flag & UNIFIED_PAINT_ALPHA)
- set_unified_alpha(brush, alpha);
- else
- brush->alpha= alpha;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
-}
-
-float brush_alpha(Brush *brush)
-{
- const short us_flag = unified_settings(brush);
-
- return (us_flag & UNIFIED_PAINT_ALPHA) ?
- unified_alpha(brush) :
- brush->alpha;
-}