[Bf-blender-cvs] [9c64a07] soc-2013-paint: Fix potential bug in loop normals code.

Bastien Montagne noreply at git.blender.org
Sat Jul 12 12:45:05 CEST 2014


Commit: 9c64a070f33195df272934c9e84ae27a44f24609
Author: Bastien Montagne
Date:   Fri Jul 11 19:52:43 2014 +0200
https://developer.blender.org/rB9c64a070f33195df272934c9e84ae27a44f24609

Fix potential bug in loop normals code.

Even if we cannot use computed lnor, we still have to empty the fan stack of lnors!

===================================================================

M	source/blender/blenkernel/intern/mesh_evaluate.c
M	source/blender/bmesh/intern/bmesh_mesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 7e547ec..a9462ae 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -567,6 +567,10 @@ void BKE_mesh_normals_loop_split(MVert *mverts, const int UNUSED(numVerts), MEdg
 						copy_v3_v3(nor, lnor);
 					}
 				}
+				else {
+					/* We still have to clear the stack! */
+					while (BLI_SMALLSTACK_POP(normal));
+				}
 			}
 
 			ml_prev = ml_curr;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index e66d126..c996a5b 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -641,6 +641,10 @@ static void bm_mesh_loops_calc_normals(BMesh *bm, const float (*vcos)[3], const
 						copy_v3_v3(nor, lnor);
 					}
 				}
+				else {
+					/* We still have to clear the stack! */
+					while (BLI_SMALLSTACK_POP(normal));
+				}
 			}
 		} while ((l_curr = l_curr->next) != l_first);
 	}




More information about the Bf-blender-cvs mailing list