From 401eaa448b7437c55aeec46b26f8c0e751f421ac Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 11 Jun 2013 08:06:59 +0000 Subject: [PATCH] Fix for distortion happens when flipping mesh normals Issue was caused by missing X/Y displacement components flip when flipping the normals (flipping the normals changes the tangent space apparently and displacement vectors need to be modified to correspond to new space). Reported by Jonathan Williamson in IRC. --- source/blender/bmesh/intern/bmesh_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 56ac6c379c2..b7eeceae494 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -791,7 +791,10 @@ static bool bm_loop_reverse_loop(BMesh *bm, BMFace *f for (x = 0; x < sides; x++) { 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]); } + SWAP(float, co[x * sides + x][0], co[x * sides + x][1]); } } }