diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-09-20 18:32:09 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-09-20 18:32:09 +0300 |
commit | 5c33704ffa2f90fcabc46edcb4f8215f5ec9c543 (patch) | |
tree | ed4891e04e2df70f66199398a3907033bd52e5d2 /source/blender/editors/gpencil/gpencil_utils.c | |
parent | afe91903af49abafb5796c6d13447b119d37c412 (diff) |
GPencil: Add `offset` parameter to reproject operator Redo Panel
Now it's possible to set an offset in the surface reprojection.
Before, this was only possible while drawing, but not in the
reproject operator.
Differential Revision: https://developer.blender.org/D15610
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_utils.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index e47f16ac466..729e8412684 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1038,7 +1038,8 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, bGPDframe *gpf, bGPDstroke *gps, const eGP_ReprojectModes mode, - const bool keep_original) + const bool keep_original, + const float offset) { ToolSettings *ts = gsc->scene->toolsettings; ARegion *region = gsc->region; @@ -1156,7 +1157,13 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, &depth, &location[0], &normal[0])) { - copy_v3_v3(&pt->x, location); + /* Apply offset over surface. */ + float normal_vector[3]; + sub_v3_v3v3(normal_vector, ray_start, location); + normalize_v3(normal_vector); + mul_v3_fl(normal_vector, offset); + + add_v3_v3v3(&pt->x, location, normal_vector); } else { /* Default to planar */ |