[Bf-blender-cvs] [5d51439600b] greasepencil-object: GPencil: Fix problem with Fallof curve for non Custom mode
Antonio Vazquez
noreply at git.blender.org
Fri Nov 22 23:51:27 CET 2019
Commit: 5d51439600b91a5a41d2e787fdf5688f245cf565
Author: Antonio Vazquez
Date: Fri Nov 22 23:32:52 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5d51439600b91a5a41d2e787fdf5688f245cf565
GPencil: Fix problem with Fallof curve for non Custom mode
===================================================================
M source/blender/editors/gpencil/gpencil_sculpt_paint.c
M source/blender/editors/gpencil/gpencil_vertex_paint.c
M source/blender/editors/gpencil/gpencil_weight_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 5309e68b09b..7421afe4bba 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -48,6 +48,7 @@
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
+#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
@@ -269,15 +270,10 @@ static float gp_brush_influence_calc(tGP_BrushEditData *gso, const int radius, c
int mval_i[2];
round_v2i_v2fl(mval_i, gso->mval);
float distance = (float)len_v2v2_int(mval_i, co);
- float fac;
- CLAMP(distance, 0.0f, (float)radius);
- fac = 1.0f - (distance / (float)radius);
/* Apply Brush curve. */
- if (brush->curve) {
- float brush_fallof = BKE_curvemapping_evaluateF(brush->curve, 0, 1.0f - fac);
- influence *= brush_fallof;
- }
+ float brush_fallof = BKE_brush_curve_strength(brush, distance, (float)radius);
+ influence *= brush_fallof;
/* apply multiframe falloff */
influence *= gso->mf_falloff;
diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c
index 1778ac16870..3180c297be1 100644
--- a/source/blender/editors/gpencil/gpencil_vertex_paint.c
+++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c
@@ -32,6 +32,7 @@
#include "DNA_brush_types.h"
#include "DNA_gpencil_types.h"
+#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_gpencil.h"
@@ -228,18 +229,11 @@ static float brush_influence_calc(tGP_BrushVertexpaintData *gso, const int radiu
int mval_i[2];
round_v2i_v2fl(mval_i, gso->mval);
float distance = (float)len_v2v2_int(mval_i, co);
- float fac;
-
- CLAMP(distance, 0.0f, (float)radius);
- fac = 1.0f - (distance / (float)radius);
-
- influence *= fac;
/* Apply Brush curve. */
- if (brush->curve) {
- float brush_fallof = BKE_curvemapping_evaluateF(brush->curve, 0, 1.0f - fac);
- influence *= brush_fallof;
- }
+ float brush_fallof = BKE_brush_curve_strength(brush, distance, (float)radius);
+ influence *= brush_fallof;
+
/* apply multiframe falloff */
influence *= gso->mf_falloff;
diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c
index 4aec52677db..16e084e0b44 100644
--- a/source/blender/editors/gpencil/gpencil_weight_paint.c
+++ b/source/blender/editors/gpencil/gpencil_weight_paint.c
@@ -32,6 +32,7 @@
#include "DNA_brush_types.h"
#include "DNA_gpencil_types.h"
+#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
@@ -225,15 +226,10 @@ static float brush_influence_calc(tGP_BrushWeightpaintData *gso, const int radiu
int mval_i[2];
round_v2i_v2fl(mval_i, gso->mval);
float distance = (float)len_v2v2_int(mval_i, co);
- float fac;
- CLAMP(distance, 0.0f, (float)radius);
- fac = 1.0f - (distance / (float)radius);
/* Apply Brush curve. */
- if (brush->curve) {
- float brush_fallof = BKE_curvemapping_evaluateF(brush->curve, 0, 1.0f - fac);
- influence *= brush_fallof;
- }
+ float brush_fallof = BKE_brush_curve_strength(brush, distance, (float)radius);
+ influence *= brush_fallof;
/* apply multiframe falloff */
influence *= gso->mf_falloff;
More information about the Bf-blender-cvs
mailing list