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:
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 8aed92df3af..f1ee8f522d9 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -846,20 +846,22 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
static float calc_vp_strength_dl(VPaint *vp, ViewContext *vc, const float vert_nor[3],
const float mval[2], const float brush_size_pressure)
{
- Brush *brush = paint_brush(&vp->paint);
- float dist_squared;
- float vertco[2], delta[2];
+ float vertco[2];
- ED_view3d_project_float_noclip(vc->ar, vert_nor, vertco);
- sub_v2_v2v2(delta, mval, vertco);
- dist_squared = dot_v2v2(delta, delta); /* len squared */
- if (dist_squared > brush_size_pressure * brush_size_pressure) {
- return 0.0f;
- }
- else {
- const float dist = sqrtf(dist_squared);
- return BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure);
+ if (ED_view3d_project_float_global(vc->ar, vert_nor, vertco, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ float delta[2];
+ float dist_squared;
+
+ sub_v2_v2v2(delta, mval, vertco);
+ dist_squared = dot_v2v2(delta, delta); /* len squared */
+ if (dist_squared <= brush_size_pressure * brush_size_pressure) {
+ Brush *brush = paint_brush(&vp->paint);
+ const float dist = sqrtf(dist_squared);
+ return BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure);
+ }
}
+
+ return 0.0f;
}
static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc,