Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2020-08-27 16:47:13 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-08-27 23:12:12 +0300
commit2a0e996d772b780b67c3b3d72586f9ddae754f34 (patch)
treef5183b12028b41eb360a8510ef73de5998499409
parent770cc66f75628d832fc3c3bff62057c7e9bd751a (diff)
Fix T80159: Custom Normals Averaging crash after clearing
custom split normals data Clearing custom split normals would get rid of the CD_CUSTOMLOOPNORMAL layer - but editing data `lnor_spacearr` would be kept. Adding a CD_CUSTOMLOOPNORMAL layer (if none exists yet) should be done in `edbm_average_normals_exec` / `BKE_editmesh_lnorspace_update` / `BM_lnorspace_update` / `BM_lnorspacearr_store`. The thing is that if the editing data `lnor_spacearr` would still be valid after `Clear Custom Split Normals Data`, blender would happily call `BM_lnorspace_rebuild` instead. Doing that without a CD_CUSTOMLOOPNORMAL layer is asking for trouble. Now clear lnor_spacearr on `Clear Custom Split Normals Data` as well. Thx @mont29 for feedback here. Maniphest Tasks: T80159 Differential Revision: https://developer.blender.org/D8730
-rw-r--r--source/blender/editors/mesh/mesh_data.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index f608e5ce6a5..22ea222cf01 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -1014,6 +1014,10 @@ static int mesh_customdata_custom_splitnormals_clear_exec(bContext *C, wmOperato
Mesh *me = ED_mesh_context(C);
if (BKE_mesh_has_custom_loop_normals(me)) {
+ BMEditMesh *em = me->edit_mesh;
+ if (em != NULL && em->bm->lnor_spacearr != NULL) {
+ BKE_lnor_spacearr_clear(em->bm->lnor_spacearr);
+ }
return mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_CUSTOMLOOPNORMAL);
}
return OPERATOR_CANCELLED;