diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-11 04:15:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-11 04:15:49 +0400 |
commit | 4ad2e4a3830535d62aadd035bd5a714bca20a816 (patch) | |
tree | 399ec3bb21823f74311926e97595fec020a70da6 /source/blender/editors/armature/editarmature.c | |
parent | 159cf6e5ddf27f37f0e56d172a16b018d9c037ab (diff) |
[#24045] heat weight fails on specific geometry.
The error for heat weighting was only being printed in the console, while the problem remains at least a warning is now given that there was a problem calculating the heat weight.
also fixed a memory leak from the mesh octree not being freed after assigning vertex groups. (ModNode error)
Diffstat (limited to 'source/blender/editors/armature/editarmature.c')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 26a89c4de02..49c3ac06b94 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4723,7 +4723,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i } } -void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int mirror) +void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror) { /* This functions implements the automatic computation of vertex group * weights, either through envelopes or using a heat equilibrium. @@ -4870,14 +4870,22 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* compute the weights based on gathered vertices and bones */ if (heat) { + const char *error= NULL; heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip, - root, tip, selected); + root, tip, selected, &error); + + if(error) { + BKE_report(reports, RPT_WARNING, error); + } } else { envelope_bone_weighting(ob, mesh, verts, numbones, bonelist, dgrouplist, dgroupflip, root, tip, selected, mat4_to_scale(par->obmat)); } - + + /* only generated in some cases but can call anyway */ + mesh_octree_table(ob, NULL, NULL, 'e'); + /* free the memory allocated */ MEM_freeN(bonelist); MEM_freeN(dgrouplist); @@ -4888,7 +4896,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m MEM_freeN(verts); } -void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mode, int mirror) +void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par, int mode, int mirror) { /* Lets try to create some vertex groups * based on the bones of the parent armature. @@ -4909,7 +4917,7 @@ void create_vgroups_from_armature(Scene *scene, Object *ob, Object *par, int mod * that are populated with the vertices for which the * bone is closest. */ - add_verts_to_dgroups(scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); + add_verts_to_dgroups(reports, scene, ob, par, (mode == ARM_GROUPS_AUTO), mirror); } } /* ************* Clear Pose *****************************/ |