diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-04-30 00:04:25 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-04-30 00:04:25 +0400 |
commit | f7ec94cbc6c7dc761f127c50081b3383a58a1c2e (patch) | |
tree | 715ceee7a26b754890954cc38672ae5cfe334a3e /source/blender/blenkernel | |
parent | 44d81faa432b3b778da10139b652371cfdc7cbb3 (diff) |
Add per-brush weight field.
Patch from Jaggz H, thanks!
[#31096] Weight-painting: Brush-specific weights
http://projects.blender.org/tracker/?func=detail&atid=127&aid=31096&group_id=9
Each brush's weight can now be set individually, can also enable
unified setting (same as size and strength have.)
Added readfile code to the patch: subversion bumped to 1, brushes get
default weight of 0.5, unified weight enabled by default and value
from old vgroup_weight field.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_blender.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 8 |
3 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 14f5c27c3df..51daac87138 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 1ff9bc46638..2a62d204e78 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -99,6 +99,7 @@ float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush); void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value); float brush_alpha(const struct Scene *scene, struct Brush *brush); +float brush_weight(const Scene *scene, struct Brush *brush); int brush_use_locked_size(const struct Scene *scene, struct Brush *brush); int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 3df6de2fd24..917c59b35a1 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -75,6 +75,7 @@ static void brush_set_defaults(Brush *brush) brush->ob_mode = OB_MODE_ALL_PAINT; /* BRUSH SCULPT TOOL SETTINGS */ + brush->weight= 1.0f; /* weight of brush 0 - 1.0 */ brush->size= 35; /* radius of the brush in pixels */ brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */ brush->autosmooth_factor= 0.0f; @@ -710,6 +711,13 @@ float brush_alpha(const Scene *scene, Brush *brush) return (ups->flag & UNIFIED_PAINT_ALPHA) ? ups->alpha : brush->alpha; } +float brush_weight(const Scene *scene, Brush *brush) +{ + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + + return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight; +} + /* 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, |