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:
authorAntonio Vazquez <blendergit@gmail.com>2021-01-16 17:33:38 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-01-16 17:46:45 +0300
commite02d84eb3bea710aa4a658629813bd7e4c67ce4c (patch)
tree96411e6b1d1d35d6169f5e903f5f18422e1dbd99 /source/blender/draw/engines/overlay/overlay_gpencil.c
parent0a44c4b5942e9bcad2269bd4a1339bac462728e0 (diff)
GPencil: Add new parameteres to transform layers
When using grease pencil for drawing Storyboards, it's very common to require a transform of the layers. This transform can be done using the offset modifier, but in some cases, the scene requires a lot of modifiers and makes the file hard to work. This new feature adds a transforms Location, Rotation and Scale at Layer level, and allows to transform the layer without using a modifier, keeping the scene more clean. {F9480695} This feature was suggested by @pepeland after receiving feedback from several artists. Also, done some code cleanup and rename some functions to get a better naming. Maniphest Tasks: T83660 Differential Revision: https://developer.blender.org/D9761
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_gpencil.c')
-rw-r--r--source/blender/draw/engines/overlay/overlay_gpencil.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index 7f9290a6c3a..19af3ae7e5d 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -258,6 +258,16 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
copy_m4_m4(mat, ob->obmat);
+ /* Rotate and scale except align to cursor. */
+ bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
+ if (gpl != NULL) {
+ if (ts->gp_sculpt.lock_axis != GP_LOCKAXIS_CURSOR) {
+ float matrot[3][3];
+ copy_m3_m4(matrot, gpl->layer_mat);
+ mul_m4_m4m3(mat, mat, matrot);
+ }
+ }
+
float viewinv[4][4];
/* Set the grid in the selected axis */
switch (ts->gp_sculpt.lock_axis) {
@@ -294,6 +304,11 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
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});
+ /* Apply layer loc transform, except cursor mode. */
+ if ((gpl != NULL) && (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) == 0) {
+ add_v3_v3(mat[3], gpl->layer_mat[3]);
+ }
+
const int gridlines = (gpd->grid.lines <= 0) ? 1 : gpd->grid.lines;
int line_ct = gridlines * 4 + 2;