[Bf-blender-cvs] [637fe6f5ff9] master: Fix T97001: Grease pencil array modifier relative offset broken

Hans Goudey noreply at git.blender.org
Sun Apr 3 19:57:48 CEST 2022


Commit: 637fe6f5ff9c8f09bdbd8e37f6d67b29e79b4a39
Author: Hans Goudey
Date:   Sun Apr 3 12:57:37 2022 -0500
Branches: master
https://developer.blender.org/rB637fe6f5ff9c8f09bdbd8e37f6d67b29e79b4a39

Fix T97001: Grease pencil array modifier relative offset broken

This has been broken for two years, since rB29f3af952725,
which retrieved the bounding box from an object and immediately
overwrote it with -1, 1. That commit had another problem though--
the modifier stack shouldn't use object level data, it should use
data from the previous modifier.

Differential Revision: https://developer.blender.org/D14524

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index f3669673094..38866bcd32a 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -132,13 +132,13 @@ static void generate_geometry(GpencilModifierData *md,
   /* Get bounbox for relative offset. */
   float size[3] = {0.0f, 0.0f, 0.0f};
   if (mmd->flag & GP_ARRAY_USE_RELATIVE) {
-    BoundBox bb;
-    const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
-    BKE_boundbox_init_from_minmax(&bb, min, max);
-    BKE_boundbox_calc_size_aabb(&bb, size);
-    mul_v3_fl(size, 2.0f);
-    /* Need a minimum size (for flat drawings). */
-    CLAMP3_MIN(size, 0.01f);
+    float min[3];
+    float max[3];
+    if (BKE_gpencil_data_minmax(gpd, min, max)) {
+      sub_v3_v3v3(size, max, min);
+      /* Need a minimum size (for flat drawings). */
+      CLAMP3_MIN(size, 0.01f);
+    }
   }
 
   int seed = mmd->seed;



More information about the Bf-blender-cvs mailing list