diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-03 07:47:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-03 07:50:59 +0300 |
commit | 073ae9c572b64717be254d49688a1bdf8bae8f75 (patch) | |
tree | 4685fd83cf9d1cf66be6969c32b4d88c3ccac6b9 /source/blender/bmesh | |
parent | 5f0f861b1d0d7cc3733f4f3652af1068c7465c8b (diff) |
Fix flip normals w/ multires
Needs Z axis flip to maintain the shape.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index de8539b137a..858d91027ba 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -926,12 +926,25 @@ static bool bm_loop_reverse_loop(BMesh *bm, BMFace *f co = md->disps; for (x = 0; x < sides; x++) { + float *co_a, *co_b; + for (y = 0; y < x; y++) { - swap_v3_v3(co[y * sides + x], co[sides * x + y]); - SWAP(float, co[y * sides + x][0], co[y * sides + x][1]); - SWAP(float, co[x * sides + y][0], co[x * sides + y][1]); + co_a = co[y * sides + x]; + co_b = co[x * sides + y]; + + swap_v3_v3(co_a, co_b); + SWAP(float, co_a[0], co_a[1]); + SWAP(float, co_b[0], co_b[1]); + + co_a[2] *= -1.0f; + co_b[2] *= -1.0f; } - SWAP(float, co[x * sides + x][0], co[x * sides + x][1]); + + co_a = co[x * sides + x]; + + SWAP(float, co_a[0], co_a[1]); + + co_a[2] *= -1.0f; } } } |