Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_gpencil.c')
-rw-r--r--source/blender/draw/engines/overlay/overlay_gpencil.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index 0dbb0542b18..b79d5753686 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -201,7 +201,9 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
}
const bool show_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0;
- const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0;
+ const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0 &&
+ ((ts->gpencil_v3d_align &
+ (GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)) == 0);
if (show_grid && show_overlays) {
const char *grid_unit = NULL;
@@ -238,6 +240,15 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
break;
}
+ /* Move the grid to the right location depending of the align type.
+ * This is required only for 3D Cursor or Origin. */
+ if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) {
+ copy_v3_v3(mat[3], cursor->location);
+ }
+ else if (ts->gpencil_v3d_align & GP_PROJECT_VIEWSPACE) {
+ copy_v3_v3(mat[3], ob->obmat[3]);
+ }
+
translate_m4(mat, gpd->grid.offset[0], gpd->grid.offset[1], 0.0f);
mul_v2_v2fl(size, gpd->grid.scale, 2.0f * ED_scene_grid_scale(scene, &grid_unit));
rescale_m4(mat, (float[3]){size[0], size[1], 0.0f});