GP: Fix error drawing on Camera view for Surface/Stroke
authorAntonioya <blendergit@gmail.com>
Wed, 19 Dec 2018 18:50:07 +0000 (19:50 +0100)
committerAntonioya <blendergit@gmail.com>
Wed, 19 Dec 2018 18:50:28 +0000 (19:50 +0100)
This bug was introduced fixing task T59595

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

index 0e1a5e613b2623191555779e010c8c663a22b3eb..e4e71339560d055f62671205c8339af6b856f403 100644 (file)
@@ -820,7 +820,10 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
        const int cfra_eval = (int)DEG_get_ctime(tgpf->depsgraph);
 
        ToolSettings *ts = tgpf->scene->toolsettings;
-       const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) && (tgpf->rv3d->persp == RV3D_CAMOB);
+       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);
        Brush *brush = BKE_paint_brush(&ts->gp_paint->paint);
        if (brush == NULL) {
                return;
index ce15b2ba6b07509e61649979bec293af6e012625..6e79afc747e11e2dbb4a15e306a1f6b55dd69a3e 100644 (file)
@@ -848,7 +848,10 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
        RegionView3D *rv3d = p->ar->regiondata;
        const int def_nr = obact->actdef - 1;
        const bool have_weight = (bool)BLI_findlink(&obact->defbase, def_nr);
-       const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) && (rv3d->persp == RV3D_CAMOB);
+       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);
        int i, totelem;
 
        /* since strokes are so fine, when using their depth we need a margin otherwise they might get missed */
index e1c3561ff76feab32540e1e38977e16bbfbc5ecf..efdcb263ec517f266259bade6ce0e321a4e3243b 100644 (file)
@@ -639,9 +639,10 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
        bGPDstroke *gps = tgpi->gpf->strokes.first;
        GP_Sculpt_Settings *gset = &ts->gp_sculpt;
        int depth_margin = (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 4 : 0;
-       char *align_flag = &ts->gpencil_v3d_align;
+       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);
+       const bool is_camera = (bool)(ts->gp_sculpt.lock_axis == 0) &&
+               (tgpi->rv3d->persp == RV3D_CAMOB) && (!is_depth);
 
        if (tgpi->type == GP_STROKE_BOX)
                gps->totpoints = (tgpi->tot_edges * 4 + tgpi->tot_stored_edges);