Fix #35671: automatic armature weights assignment crashed with an empty mesh.
This commit is contained in:
@@ -659,6 +659,17 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
|
||||
|
||||
*err_str = NULL;
|
||||
|
||||
/* bone heat needs triangulated faces */
|
||||
BKE_mesh_tessface_ensure(me);
|
||||
|
||||
for (tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
|
||||
tottri++;
|
||||
if (mf->v4) tottri++;
|
||||
}
|
||||
|
||||
if (tottri == 0)
|
||||
return;
|
||||
|
||||
/* count triangles and create mask */
|
||||
if ((use_face_sel = ((me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0)) ||
|
||||
(use_vert_sel = ((me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0)))
|
||||
@@ -686,14 +697,6 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
|
||||
}
|
||||
}
|
||||
|
||||
/* bone heat needs triangulated faces */
|
||||
BKE_mesh_tessface_ensure(me);
|
||||
|
||||
for (tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
|
||||
tottri++;
|
||||
if (mf->v4) tottri++;
|
||||
}
|
||||
|
||||
/* create laplacian */
|
||||
sys = laplacian_system_construct_begin(me->totvert, tottri, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user