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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-08 21:56:45 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-08 21:56:45 +0400
commit8421bc85733c3c4b5d9aa329bf54dc3e979f0607 (patch)
tree4d34e6e2211f77001e52ba7d74e36c0d6942c52d /source/blender/editors/armature/meshlaplacian.c
parentbcfff4f190622b9128a7ff37d55a75e8d9cf9a91 (diff)
Fix #35671: automatic armature weights assignment crashed with an empty mesh.
Diffstat (limited to 'source/blender/editors/armature/meshlaplacian.c')
-rw-r--r--source/blender/editors/armature/meshlaplacian.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 3ac514f1465..25a7eedfb8c 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -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);