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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-06-09 15:32:50 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-06-09 15:32:50 +0300
commitea3895558d7b174347d1ba1f03fdb22c90e67a79 (patch)
tree1aba609c0dfccf77e7226d3ad4be7de840f87637 /source/blender/editors/gpencil/gpencil_utils.c
parente4c6da29b2297cbf331bb3ac891959dbcc00ee73 (diff)
Fix T88998: GPencil not projecting to the most front surface
It was projecting from the stroke position. The behavior has changed in {rB5400be9ffee2}.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_utils.c')
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 04764587ebe..c9ef340b9d3 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1276,6 +1276,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
}
else {
/* Geometry - Snap to surfaces of visible geometry */
+ float ray_start[3];
float ray_normal[3];
/* magic value for initial depth copied from the default
* value of Python's Scene.ray_cast function
@@ -1284,14 +1285,17 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
float location[3] = {0.0f, 0.0f, 0.0f};
float normal[3] = {0.0f, 0.0f, 0.0f};
- ED_view3d_win_to_vector(region, xy, &ray_normal[0]);
BLI_assert(gps->flag & GP_STROKE_3DSPACE);
+ BLI_assert(gsc->area && gsc->area->spacetype == SPACE_VIEW3D);
+ const View3D *v3d = gsc->area->spacedata.first;
+ ED_view3d_win_to_ray_clipped(
+ depsgraph, region, v3d, xy, &ray_start[0], &ray_normal[0], true);
if (ED_transform_snap_object_project_ray(sctx,
depsgraph,
&(const struct SnapObjectParams){
.snap_select = SNAP_ALL,
},
- &pt2.x,
+ &ray_start[0],
&ray_normal[0],
&depth,
&location[0],