Faces split: Don't leave CD_NORMAL after split

This is supposed to be a temporary layer.

If someone needs loop normals after split it should explicitly
ask for that.
This commit is contained in:
Sergey Sharybin 2017-02-16 11:00:17 +01:00
parent 5cbaf56b26
commit 6468cb5f9c
2 changed files with 4 additions and 4 deletions

@ -80,6 +80,7 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
} }
else { else {
me.split_faces(); me.split_faces();
me.calc_normals_split();
} }
} }
if(subdivision_type == Mesh::SUBDIVISION_NONE) { if(subdivision_type == Mesh::SUBDIVISION_NONE) {

@ -2376,11 +2376,10 @@ void BKE_mesh_split_faces(Mesh *mesh)
/* Perform actual split of vertices and adjacent edges. */ /* Perform actual split of vertices and adjacent edges. */
split_faces_split_verts(mesh, num_new_verts, vert_flags); split_faces_split_verts(mesh, num_new_verts, vert_flags);
split_faces_split_edges(mesh, num_new_edges, edge_flags); split_faces_split_edges(mesh, num_new_edges, edge_flags);
/* Adding new vertices will change loop normals. /* CD_NORMAL is expected to be temporary only, and it's invalid at
* Since we ensured there is CD_NORMAL layer for loops we must bring it * this point anyway.
* it back to a consistent state.
*/ */
BKE_mesh_calc_normals_split(mesh); CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop);
MEM_freeN(vert_flags); MEM_freeN(vert_flags);
MEM_freeN(edge_flags); MEM_freeN(edge_flags);
#ifdef VALIDATE_MESH #ifdef VALIDATE_MESH