[Bf-blender-cvs] [4aa147a9668] asset-greasepencil: GPencil: Rotate around transform center instead of cage center

Antonio Vazquez noreply at git.blender.org
Tue Jul 20 19:32:46 CEST 2021


Commit: 4aa147a9668362beb1a87b38c31ea2bc2502db2b
Author: Antonio Vazquez
Date:   Tue Jul 20 18:43:04 2021 +0200
Branches: asset-greasepencil
https://developer.blender.org/rB4aa147a9668362beb1a87b38c31ea2bc2502db2b

GPencil: Rotate around transform center instead of cage center

The cage center can change during transformation

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

M	source/blender/editors/gpencil/gpencil_asset.c

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

diff --git a/source/blender/editors/gpencil/gpencil_asset.c b/source/blender/editors/gpencil/gpencil_asset.c
index 96fc91f6a0d..8d74f271939 100644
--- a/source/blender/editors/gpencil/gpencil_asset.c
+++ b/source/blender/editors/gpencil/gpencil_asset.c
@@ -655,25 +655,22 @@ static void gpencil_asset_transform_strokes(tGPDasset *tgpa,
 
   /* Determine pivot point. */
   float pivot[3];
-  copy_v3_v3(pivot, tgpa->asset_center);
+  gpencil_point_xy_to_3d(&tgpa->gsc, tgpa->scene, tgpa->transform_center, pivot);
   if (!shift_key) {
     if (tgpa->manipulator_index == CAGE_CORNER_N) {
       gpencil_point_xy_to_3d(&tgpa->gsc, tgpa->scene, tgpa->manipulator[CAGE_CORNER_S], pivot);
-      sub_v3_v3v3(pivot, pivot, tgpa->ob->loc);
     }
     else if (tgpa->manipulator_index == CAGE_CORNER_E) {
       gpencil_point_xy_to_3d(&tgpa->gsc, tgpa->scene, tgpa->manipulator[CAGE_CORNER_W], pivot);
-      sub_v3_v3v3(pivot, pivot, tgpa->ob->loc);
     }
     else if (tgpa->manipulator_index == CAGE_CORNER_S) {
       gpencil_point_xy_to_3d(&tgpa->gsc, tgpa->scene, tgpa->manipulator[CAGE_CORNER_N], pivot);
-      sub_v3_v3v3(pivot, pivot, tgpa->ob->loc);
     }
     else if (tgpa->manipulator_index == CAGE_CORNER_W) {
       gpencil_point_xy_to_3d(&tgpa->gsc, tgpa->scene, tgpa->manipulator[CAGE_CORNER_E], pivot);
-      sub_v3_v3v3(pivot, pivot, tgpa->ob->loc);
     }
   }
+  sub_v3_v3v3(pivot, pivot, tgpa->ob->loc);
 
   /* Create rotation matrix. */
   float rot_matrix[4][4];



More information about the Bf-blender-cvs mailing list