[Bf-blender-cvs] [006e70dbd7e] blender-v2.92-release: Fix T85203: GPencil: Drawing on locked axis plane

Falk David noreply at git.blender.org
Mon Feb 1 16:26:55 CET 2021


Commit: 006e70dbd7e29c105809eded93169754ade03de5
Author: Falk David
Date:   Mon Feb 1 16:25:44 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB006e70dbd7e29c105809eded93169754ade03de5

Fix T85203: GPencil: Drawing on locked axis plane

Drawing on e.g. the X-Z plane was broken due to an earlier
commit (rBef28da262342). This was causing the projection when drawing
on an axis plane to fail.

The fix checks that the user is in view plane projection mode.

Reviewed By: antoniov

Maniphest Tasks: T85203

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

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

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 3c16a6fb028..8bd0b2f86de 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1155,8 +1155,9 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
   ToolSettings *ts = tgpf->scene->toolsettings;
   const char align_flag = ts->gpencil_v3d_align;
   const bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE));
-  const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) &&
-                         (tgpf->rv3d->persp == RV3D_CAMOB) && (!is_depth);
+  const bool is_lock_axis_view = (bool)(ts->gp_sculpt.lock_axis == 0);
+  const bool is_camera = is_lock_axis_view && (tgpf->rv3d->persp == RV3D_CAMOB) && (!is_depth);
+
   Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
   if (brush == NULL) {
     return;
@@ -1284,7 +1285,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
   }
 
   /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
-  if ((align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
+  if (((align_flag & GP_PROJECT_VIEWSPACE) && is_lock_axis_view) || 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 fcdada1e673..ed56f004ca4 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -937,10 +937,10 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
   RegionView3D *rv3d = p->region->regiondata;
   const int def_nr = obact->actdef - 1;
   const bool have_weight = (bool)BLI_findlink(&obact->defbase, def_nr);
-  const char *align_flag = &ts->gpencil_v3d_align;
-  const bool is_depth = (bool)(*align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE));
-  const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) && (rv3d->persp == RV3D_CAMOB) &&
-                         (!is_depth);
+  const char align_flag = ts->gpencil_v3d_align;
+  const bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE));
+  const bool is_lock_axis_view = (bool)(ts->gp_sculpt.lock_axis == 0);
+  const bool is_camera = is_lock_axis_view && (rv3d->persp == RV3D_CAMOB) && (!is_depth);
   int totelem;
 
   /* For very low pressure at the end, truncate stroke. */
@@ -1085,7 +1085,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
     }
 
     /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
-    if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
+    if (((align_flag & GP_PROJECT_VIEWSPACE) && is_lock_axis_view) || is_camera) {
       ED_gpencil_project_stroke_to_view(p->C, p->gpl, gps);
     }
   }
@@ -1234,7 +1234,7 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
     /* change position relative to parent object */
     gpencil_apply_parent(depsgraph, obact, gpl, gps);
     /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
-    if ((*p->align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
+    if (((align_flag & GP_PROJECT_VIEWSPACE) && is_lock_axis_view) || 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 a742d149fce..53e0043df37 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -713,8 +713,8 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
   int depth_margin = (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 4 : 0;
   const char align_flag = ts->gpencil_v3d_align;
   bool is_depth = (bool)(align_flag & (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE));
-  const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) &&
-                         (tgpi->rv3d->persp == RV3D_CAMOB) && (!is_depth);
+  const bool is_lock_axis_view = (bool)(ts->gp_sculpt.lock_axis == 0);
+  const bool is_camera = is_lock_axis_view && (tgpi->rv3d->persp == RV3D_CAMOB) && (!is_depth);
 
   if (tgpi->type == GP_STROKE_BOX) {
     tgpi->tot_edges--;
@@ -1078,7 +1078,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
   }
 
   /* If camera view or view projection, reproject flat to view to avoid perspective effect. */
-  if ((align_flag & GP_PROJECT_VIEWSPACE) || is_camera) {
+  if (((align_flag & GP_PROJECT_VIEWSPACE) && is_lock_axis_view) || is_camera) {
     ED_gpencil_project_stroke_to_view(C, tgpi->gpl, gps);
   }



More information about the Bf-blender-cvs mailing list