[Bf-blender-cvs] [ef28da26234] master: Fix T85082: Perspective distortion while drawing

Falk David noreply at git.blender.org
Tue Jan 26 18:32:57 CET 2021


Commit: ef28da262342447bd3a666f5069d6012d71e1781
Author: Falk David
Date:   Tue Jan 26 18:04:52 2021 +0100
Branches: master
https://developer.blender.org/rBef28da262342447bd3a666f5069d6012d71e1781

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 84447059884..b8af8552a0d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1284,8 +1284,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 7571f7cded8..b55e47d74f3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1086,8 +1086,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);
     }
   }
@@ -1235,8 +1235,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 ef86b19cc66..363d5d7ec17 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -1081,8 +1081,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