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
This commit is contained in:
Falk David 2021-01-26 18:04:52 +01:00
parent abd6b1d7b2
commit 23e108c5b6
Notes: blender-bot 2023-02-14 05:36:11 +01:00
Referenced by issue #85082, Panning the viewport should not rotate grease pencil view aligned canvas orientation
3 changed files with 8 additions and 8 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}