[Bf-blender-cvs] [c4251110a97] blender-v3.4-release: Fix T102992: GPencil Array doesn't respect restriction in Offset
frogstomp
noreply at git.blender.org
Wed Dec 14 22:23:26 CET 2022
Commit: c4251110a973b5458ef7bf13ca88927ab1391ff9
Author: frogstomp
Date: Fri Dec 9 16:27:52 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBc4251110a973b5458ef7bf13ca88927ab1391ff9
Fix T102992: GPencil Array doesn't respect restriction in Offset
The problem was the bounding box was calculated using
all strokes, but if a filter is added, the bounding box must
include only selected strokes.
Fix by @frogstomp
===================================================================
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 e51fe8832f0..37e28268829 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -113,7 +113,45 @@ static void BKE_gpencil_instance_modifier_instance_tfm(Object *ob,
zero_v3(r_mat[3]);
}
}
+static bool gpencil_data_selected_minmax(ArrayGpencilModifierData *mmd,
+ Object *ob,
+ float r_min[3],
+ float r_max[3])
+{
+ bGPdata *gpd = (bGPdata *)ob->data;
+ bool changed = false;
+
+ INIT_MINMAX(r_min, r_max);
+
+ if (gpd == NULL) {
+ return changed;
+ }
+
+ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+ bGPDframe *gpf = gpl->actframe;
+
+ if (gpf != NULL) {
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ if (is_stroke_affected_by_modifier(ob,
+ mmd->layername,
+ mmd->material,
+ mmd->pass_index,
+ mmd->layer_pass,
+ 1,
+ gpl,
+ gps,
+ mmd->flag & GP_ARRAY_INVERT_LAYER,
+ mmd->flag & GP_ARRAY_INVERT_PASS,
+ mmd->flag & GP_ARRAY_INVERT_LAYERPASS,
+ mmd->flag & GP_ARRAY_INVERT_MATERIAL)) {
+ changed |= BKE_gpencil_stroke_minmax(gps, false, r_min, r_max);
+ }
+ }
+ }
+ }
+ return changed;
+}
/* array modifier - generate geometry callback (for viewport/rendering) */
static void generate_geometry(GpencilModifierData *md,
Depsgraph *depsgraph,
@@ -131,7 +169,7 @@ static void generate_geometry(GpencilModifierData *md,
if (mmd->flag & GP_ARRAY_USE_RELATIVE) {
float min[3];
float max[3];
- if (BKE_gpencil_data_minmax(gpd, min, max)) {
+ if (gpencil_data_selected_minmax(mmd, ob, min, max)) {
sub_v3_v3v3(size, max, min);
/* Need a minimum size (for flat drawings). */
CLAMP3_MIN(size, 0.01f);
More information about the Bf-blender-cvs
mailing list