Fix T65408: GPencil Weight Paint, strength and falloff are ignored when painting a lesser vertexweight

The value was clamped to minimum value before checking the influence.
This commit is contained in:
Antonio Vazquez 2019-06-03 09:58:48 +02:00
parent 3041705c51
commit ccc7ebf7b1
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #65408, In Grease Pencil Weight Paint, strength and falloff are ignored when painting a lesser vertex weight
1 changed files with 9 additions and 5 deletions

View File

@ -922,17 +922,21 @@ static bool gp_brush_weight_apply(
float curweight = dw ? dw->weight : 0.0f;
if (gp_brush_invert_check(gso)) {
/* reduce weight */
curweight -= inf;
/* reduce weight (verify mainimum target) */
if (curweight - inf < gso->gp_brush->weight) {
curweight = gso->gp_brush->weight;
}
else {
curweight -= inf;
}
}
else {
/* increase weight */
curweight += inf;
/* verify maximum target weight */
CLAMP_MAX(curweight, gso->gp_brush->weight);
}
/* verify target weight */
CLAMP_MAX(curweight, gso->gp_brush->weight);
CLAMP(curweight, 0.0f, 1.0f);
if (dw) {
dw->weight = curweight;