From 4c43fcf791c3c26fe5f729ffe5e96bae2957e88a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Oct 2014 14:33:50 +0200 Subject: Fix T41983: Array regression with center-verts Array with rotation and a central pivot would fail. Thanks to Bastien Montagne for the initial fix. --- source/blender/modifiers/intern/MOD_array.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source/blender/modifiers') diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 66796480542..bae75d8693f 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -406,6 +406,9 @@ static DerivedMesh *arrayModifier_doArray( const bool use_merge = amd->flags & MOD_ARR_MERGE; const bool use_recalc_normals = (dm->dirty & DM_DIRTY_NORMALS) || use_merge; + const bool use_offset_ob = ((amd->offset_type & MOD_ARR_OFF_OBJ) && amd->offset_ob); + /* allow pole vertices to be used by many faces */ + const bool with_follow = use_offset_ob; int start_cap_nverts = 0, start_cap_nedges = 0, start_cap_npolys = 0, start_cap_nloops = 0; int end_cap_nverts = 0, end_cap_nedges = 0, end_cap_npolys = 0, end_cap_nloops = 0; @@ -454,7 +457,7 @@ static DerivedMesh *arrayModifier_doArray( offset[3][j] += amd->scale[j] * vertarray_size(src_mvert, chunk_nverts, j); } - if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) { + if (use_offset_ob) { float obinv[4][4]; float result_mat[4][4]; @@ -606,10 +609,12 @@ static DerivedMesh *arrayModifier_doArray( int target = full_doubles_map[prev_chunk_index]; if (target != -1) { target += chunk_nverts; /* translate mapping */ - /* The rule here is to not follow mapping to chunk N-2, which could be too far - * so if target vertex was itself mapped, then this vertex is not mapped */ - if (full_doubles_map[target] != -1) { - target = -1; + if (!with_follow) { + /* The rule here is to not follow mapping to chunk N-2, which could be too far + * so if target vertex was itself mapped, then this vertex is not mapped */ + if (full_doubles_map[target] != -1) { + target = -1; + } } } full_doubles_map[this_chunk_index] = target; @@ -624,7 +629,7 @@ static DerivedMesh *arrayModifier_doArray( c * chunk_nverts, chunk_nverts, amd->merge_dist, - false); + with_follow); } } } @@ -644,7 +649,7 @@ static DerivedMesh *arrayModifier_doArray( first_chunk_start, first_chunk_nverts, amd->merge_dist, - false); + with_follow); } /* start capping */ @@ -711,7 +716,12 @@ static DerivedMesh *arrayModifier_doArray( if (use_merge) { for (i = 0; i < result_nverts; i++) { if (full_doubles_map[i] != -1) { - tot_doubles++; + if (i == full_doubles_map[i]) { + full_doubles_map[i] = -1; + } + else { + tot_doubles++; + } } } if (tot_doubles > 0) { -- cgit v1.2.3