From 27ffd37c15593d4581b8462de435a08766477a4b Mon Sep 17 00:00:00 2001 From: Charlie Jolly Date: Sat, 4 Aug 2018 09:49:15 +0200 Subject: Fix GP mirror modifier axis --- .../gpencil_modifiers/intern/MOD_gpencilmirror.c | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c index afecdd34a5c..d4e8e8d3cff 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c @@ -138,17 +138,18 @@ static void generateStrokes( int tot_strokes; int i; - /* count strokes to avoid infinite loop after adding new strokes to tail of listbase */ - tot_strokes = BLI_listbase_count(&gpf->strokes); - - for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) { - if (is_stroke_affected_by_modifier( - ob, mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_MIRROR_INVERT_LAYER, mmd->flag & GP_MIRROR_INVERT_PASS)) - { - /* check each axis for mirroring */ - for (int xi = 0; xi < 3; ++xi) { - if (mmd->flag & (GP_MIRROR_AXIS_X << xi)) { + /* check each axis for mirroring */ + for (int xi = 0; xi < 3; ++xi) { + if (mmd->flag & (GP_MIRROR_AXIS_X << xi)) { + + /* count strokes to avoid infinite loop after adding new strokes to tail of listbase */ + tot_strokes = BLI_listbase_count(&gpf->strokes); + + for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) { + if (is_stroke_affected_by_modifier( + ob, mmd->layername, mmd->pass_index, 1, gpl, gps, + mmd->flag & GP_MIRROR_INVERT_LAYER, mmd->flag & GP_MIRROR_INVERT_PASS)) + { /* clip before duplicate */ clip_stroke(mmd, gps); -- cgit v1.2.3