[Bf-blender-cvs] [55b0f37d4b9] asset-greasepencil: GPencil: Fix error for Pivot when object not in origin

Antonio Vazquez noreply at git.blender.org
Tue Jul 20 16:53:11 CEST 2021


Commit: 55b0f37d4b9dba06a41eaeb3204475452474a902
Author: Antonio Vazquez
Date:   Tue Jul 20 16:53:01 2021 +0200
Branches: asset-greasepencil
https://developer.blender.org/rB55b0f37d4b9dba06a41eaeb3204475452474a902

GPencil: Fix error for Pivot when object not in origin

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

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 de9b28ba743..a7baccab2c9 100644
--- a/source/blender/editors/gpencil/gpencil_asset.c
+++ b/source/blender/editors/gpencil/gpencil_asset.c
@@ -745,15 +745,19 @@ static void gpencil_asset_transform_strokes(tGPDasset *tgpa,
   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);
     }
   }
 
@@ -1005,11 +1009,6 @@ static void gpencil_draw_cage(tGPDasset *tgpa)
                          tgpa->manipulator[CAGE_CORNER_ROT_NW + i][1] + gap);
   }
 
-  // immBegin(GPU_PRIM_LINES, 2);
-  // immVertex2f(pos, tgpa->manipulator[CAGE_CORNER_NE][0], tgpa->manipulator[CAGE_CORNER_NE][1]);
-  // immVertex2f(pos, tgpa->manipulator[CAGE_CORNER_ROT][0],
-  // tgpa->manipulator[CAGE_CORNER_ROT][1]); immEnd();
-
   /* Draw a line while is doing a transform. */
   if ((tgpa->flag & GP_ASSET_FLAG_TRANSFORMING) && (tgpa->mode == GP_ASSET_TRANSFORM_ROT)) {
     const float line_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};



More information about the Bf-blender-cvs mailing list