[Bf-blender-cvs] [187c696caee] master: Fix T66030: [CRASH] Modifying Normals with Skin Modifier.
Bastien Montagne
noreply at git.blender.org
Mon Jun 24 16:33:52 CEST 2019
Commit: 187c696caee13aaa27ecd03a9c17a0d2af28a938
Author: Bastien Montagne
Date: Mon Jun 24 16:29:37 2019 +0200
Branches: master
https://developer.blender.org/rB187c696caee13aaa27ecd03a9c17a0d2af28a938
Fix T66030: [CRASH] Modifying Normals with Skin Modifier.
clnor editing code was simply not checking at all whether it has
something to work on... Guess nobody had idea to edit custom normals on
a mesh that has no normals before! :P
This should probably be handled in a poll function too, to completely
disable those tools when there are no faces/loops, but let's keep it to
minimal changes at that point.
===================================================================
M source/blender/bmesh/intern/bmesh_mesh.c
M source/blender/editors/mesh/editmesh_tools.c
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 09a39c05565..c796bdea688 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -1582,7 +1582,7 @@ BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm,
BLI_assert(bm->spacearr_dirty == 0);
- BMLoopNorEditDataArray *lnors_ed_arr = MEM_mallocN(sizeof(*lnors_ed_arr), __func__);
+ BMLoopNorEditDataArray *lnors_ed_arr = MEM_callocN(sizeof(*lnors_ed_arr), __func__);
lnors_ed_arr->lidx_to_lnor_editdata = MEM_callocN(
sizeof(*lnors_ed_arr->lidx_to_lnor_editdata) * bm->totloop, __func__);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 48cc46f5060..26d830ccaec 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -8571,6 +8571,10 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
+ if (bm->totloop == 0) {
+ return OPERATOR_CANCELLED;
+ }
+
const int mode = RNA_enum_get(op->ptr, "mode");
const bool absolute = RNA_boolean_get(op->ptr, "absolute");
More information about the Bf-blender-cvs
mailing list