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:
authorAntonioya <blendergit@gmail.com>2018-11-20 22:05:13 +0300
committerAntonioya <blendergit@gmail.com>2018-11-20 22:05:37 +0300
commita4a9123c33c822d13822a312cf2064ef2aca7a32 (patch)
treedccbd186328c3e4dbd041d96b0b1fea7d77415be /source/blender/editors/gpencil
parente63c9472049f64221b34c4d2dd3101086b61520e (diff)
GP: Refactor target weight paint
Now, the target weight is defined as the final maximum value with a new property and all fields have be moved to brush struct.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 1710bd6be88..84a05025cd7 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -903,21 +903,16 @@ static bool gp_brush_weight_apply(
if (gp_brush_invert_check(gso)) {
/* reduce weight */
- if (gso->settings->flag & GP_SCULPT_SETT_FLAG_PAINT_WEIGHT) {
- curweight = 0.0f;
- }
- else {
- curweight -= inf;
- }
+ curweight -= inf;
}
else {
/* increase weight */
- if (gso->settings->flag & GP_SCULPT_SETT_FLAG_PAINT_WEIGHT) {
- curweight = gso->gp_brush->strength;
- }
- else {
- curweight += inf;
- }
+ curweight += inf;
+ }
+
+ /* verify target weight */
+ if (gso->gp_brush->flag & GP_SCULPT_FLAG_TARGET_WEIGHT) {
+ CLAMP_MAX(curweight, gso->gp_brush->target_weight);
}
CLAMP(curweight, 0.0f, 1.0f);