diff options
author | Antonioya <blendergit@gmail.com> | 2018-08-30 11:17:29 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-30 11:17:48 +0300 |
commit | edef141d0bf4a9fef986f57fdd7dec43ca6949bd (patch) | |
tree | 5614cb9205ac3ad233eb400cb340d9314caee57e /source/blender/editors/gpencil/gpencil_paint.c | |
parent | e74d7d6f81356b8b3a5a843a4dbb87fe1909fb14 (diff) |
GP: Add small offset to stroke over surface.
This small offset helps to keep the stroke over the surface and avoid the stoke is "inside" the face of the surface.
We could add this as a parameter in the UI, but after doing a lot of test, the valid values are very limited and don't worth the change, so a hardcoded value works fine.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 4bd8c28a85c..ef70608d99c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -369,6 +369,15 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3] /* in 3d-space - pt->x/y/z are 3 side-by-side floats */ if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) { + + /* add small offset to keep stroke over the surface. + * This could be a UI parameter, but the value is too sensitive for + * the user to use it and don't improve the result. + */ + if (depth) { + *depth *= 0.99998f; + } + if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval, out, 0, depth))) { /* projecting onto 3D-Geometry * - nothing more needs to be done here, since view_autodist_simple() has already done it |