[Bf-blender-cvs] [23e108c5b60] blender-v2.92-release: Fix T85082: Perspective distortion while drawing

Falk David noreply at git.blender.org
Tue Jan 26 18:37:20 CET 2021


Commit: 23e108c5b608e58ae46f11a0f2badde6710b7495
Author: Falk David
Date:   Tue Jan 26 18:04:52 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB23e108c5b608e58ae46f11a0f2badde6710b7495

Fix T85082: Perspective distortion while drawing

When the drawing plane was set to view and the user would pan their
camera sideways, the drawing would be more and more distorted and
projected further back.

The fix projects the strokes to view when the user is looking through
the camera or has the drawing plane set to view.

Reviewed By: antoniov

Maniphest Tasks: T85082

Differential Revision: https://developer.blender.org/D10213

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

M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c

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

diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 622556943c9..d3616909415 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1283,8 +1283,8 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
     gpencil_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt);
   }
 
-  /* if camera view, reproject flat to view to avoid perspective effect */
-  if (is_camera) {
+  /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
+  if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
     ED_gpencil_project_stroke_to_view(tgpf->C, tgpf->gpl, gps);
   }
 
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 14313a50118..fcdada1e673 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1084,8 +1084,8 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
       gpencil_apply_parent_point(depsgraph, obact, gpl, pt);
     }
 
-    /* if camera view, reproject flat to view to avoid perspective effect */
-    if (is_camera) {
+    /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
+    if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
       ED_gpencil_project_stroke_to_view(p->C, p->gpl, gps);
     }
   }
@@ -1233,8 +1233,8 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
     gpencil_reproject_toplane(p, gps);
     /* change position relative to parent object */
     gpencil_apply_parent(depsgraph, obact, gpl, gps);
-    /* if camera view, reproject flat to view to avoid perspective effect */
-    if (is_camera) {
+    /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
+    if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
       ED_gpencil_project_stroke_to_view(p->C, p->gpl, gps);
     }
 
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 33497429331..cf2f8d51d74 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1077,8 +1077,8 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
     gpencil_apply_parent_point(tgpi->depsgraph, tgpi->ob, tgpi->gpl, pt);
   }
 
-  /* if camera view, reproject flat to view to avoid perspective effect */
-  if (is_camera) {
+  /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
+  if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
     ED_gpencil_project_stroke_to_view(C, tgpi->gpl, gps);
   }



More information about the Bf-blender-cvs mailing list