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>2010-03-30 16:01:17 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-03-30 16:01:17 +0400
commit253de0ed86f273d0032acbbd0b8237a358b35cbd (patch)
treec75b539afcc64851d3b0a13de21e5dd02c41bb4c /source/blender/editors/armature
parent052cb2afd22b9f54fdb1528066e6e3cba6db6e99 (diff)
* Assign weight from bones in weight paint mode now respects paint face
mask, also avoid making vertex groups if they will not be filled. * Add back image pin option in image editor header. * Fix deep shadow not respecting Cast Buffer Shadows option. * Tangent space normal map baking should work again now. * Fix a problem with particle duplis, due to own bugfix for #20350, the problem for that seems to be in dupliverts, not particles. * Fix external multires data link getting lost on exiting editmode. (commits 27776,27777,27830,27840,27841,27862 by Brecht from render25 branch)
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/editarmature.c17
-rw-r--r--source/blender/editors/armature/meshlaplacian.c25
2 files changed, 33 insertions, 9 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 478a711aedd..5f0c2e3d4be 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4573,19 +4573,22 @@ static int dgroup_skinnable(Object *ob, Bone *bone, void *datap)
* pointers to bDeformGroups, all with names
* of skinnable bones.
*/
- bDeformGroup ***hgroup, *defgroup;
+ bDeformGroup ***hgroup, *defgroup= NULL;
int a, segments;
struct { Object *armob; void *list; int heat; } *data= datap;
+ int wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT);
+ bArmature *arm= data->armob->data;
- if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+ if (!wpmode || !(bone->flag & BONE_HIDDEN_P)) {
if (!(bone->flag & BONE_NO_DEFORM)) {
if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
segments = bone->segments;
else
segments = 1;
-
- if (!(defgroup = defgroup_find_name(ob, bone->name)))
- defgroup = ED_vgroup_add_name(ob, bone->name);
+
+ if(!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
+ if (!(defgroup = defgroup_find_name(ob, bone->name)))
+ defgroup = ED_vgroup_add_name(ob, bone->name);
if (data->list != NULL) {
hgroup = (bDeformGroup ***) &data->list;
@@ -4711,7 +4714,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
selected = MEM_callocN(numbones*sizeof(int), "selected");
for (j=0; j < numbones; ++j) {
- bone = bonelist[j];
+ bone = bonelist[j];
dgroup = dgrouplist[j];
/* handle bbone */
@@ -4759,7 +4762,7 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m
selected[j] = 1;
/* find flipped group */
- if (mirror) {
+ if (dgroup && mirror) {
char name[32];
BLI_strncpy(name, dgroup->name, 32);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 136027b1504..3190d8ad576 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -618,13 +618,24 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
LaplacianSystem *sys;
MFace *mface;
float solution, weight;
- int *vertsflipped = NULL;
+ int *vertsflipped = NULL, *mask= NULL;
int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0;
- /* count triangles */
+ /* count triangles and create mask */
+ if(me->editflag & ME_EDIT_PAINT_MASK)
+ mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
+
for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
totface++;
if(mface->v4) totface++;
+
+ if(mask && (mface->flag & ME_FACE_SEL)) {
+ mask[mface->v1]= 1;
+ mask[mface->v2]= 1;
+ mask[mface->v3]= 1;
+ if(mface->v4)
+ mask[mface->v4]= 1;
+ }
}
/* create laplacian */
@@ -661,6 +672,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* clear weights */
if(bbone && firstsegment) {
for(a=0; a<me->totvert; a++) {
+ if(mask && !mask[a])
+ continue;
+
ED_vgroup_vert_remove(ob, dgrouplist[j], a);
if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
@@ -679,6 +693,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
if(laplacian_system_solve(sys)) {
/* load solution into vertex groups */
for(a=0; a<me->totvert; a++) {
+ if(mask && !mask[a])
+ continue;
+
solution= laplacian_system_get_solution(a);
if(bbone) {
@@ -723,6 +740,9 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* remove too small vertex weights */
if(bbone && lastsegment) {
for(a=0; a<me->totvert; a++) {
+ if(mask && !mask[a])
+ continue;
+
weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
weight= heat_limit_weight(weight);
if(weight <= 0.0f)
@@ -740,6 +760,7 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
/* free */
if(vertsflipped) MEM_freeN(vertsflipped);
+ if(mask) MEM_freeN(mask);
heat_system_free(sys);