[Bf-blender-cvs] [5400be9ffee] master: Fix T88313: GPencil reproject operator projecting on the wrong surface

Germano Cavalcante noreply at git.blender.org
Tue May 18 22:32:42 CEST 2021


Commit: 5400be9ffee2b4f2174461a04a2834d6bbfeeaea
Author: Germano Cavalcante
Date:   Tue May 18 17:31:10 2021 -0300
Branches: master
https://developer.blender.org/rB5400be9ffee2b4f2174461a04a2834d6bbfeeaea

Fix T88313: GPencil reproject operator projecting on the wrong surface

`ray_start` must start at the position of the gpencil point.

===================================================================

M	source/blender/editors/gpencil/gpencil_utils.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 9fba2ce5902..04764587ebe 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1276,7 +1276,6 @@ 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
@@ -1285,13 +1284,14 @@ 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_ray(region, xy, &ray_start[0], &ray_normal[0]);
+      ED_view3d_win_to_vector(region, xy, &ray_normal[0]);
+      BLI_assert(gps->flag & GP_STROKE_3DSPACE);
       if (ED_transform_snap_object_project_ray(sctx,
                                                depsgraph,
                                                &(const struct SnapObjectParams){
                                                    .snap_select = SNAP_ALL,
                                                },
-                                               &ray_start[0],
+                                               &pt2.x,
                                                &ray_normal[0],
                                                &depth,
                                                &location[0],



More information about the Bf-blender-cvs mailing list