diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-05-03 21:34:48 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-05-03 21:34:48 +0300 |
commit | a577291b03e49a8c5d0f56232fbaec18acb199d4 (patch) | |
tree | e209dfba71f16d12248285c10e669dfe98563f1b /source/blender/draw/engines/overlay/overlay_gpencil.c | |
parent | 1a6119c8e467f23ae83be12c66b30c5e785700aa (diff) |
Fix T76364: GPencil grid is not located in the right place
During the refactor, the location of the grid was broken. Now, the grid is in Object origin or 3D cursor origin as it was in 2.82.
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_gpencil.c')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_gpencil.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c index 0dbb0542b18..05c159359ff 100644 --- a/source/blender/draw/engines/overlay/overlay_gpencil.c +++ b/source/blender/draw/engines/overlay/overlay_gpencil.c @@ -238,6 +238,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}); |