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>2012-03-20 01:09:16 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-03-20 01:09:16 +0400
commitf18dab65ad4af5e96ac439b68a773ddbb9c0074c (patch)
tree3cf2b887fdfc3458a2ebc3b0b9448457bc9f0f16 /source/blender/blenkernel/intern/deform.c
parent82979d5ab57217502b34977b5e5e82895bd66dbb (diff)
Fix #30531: mirror modifier with vertex groups did not add both the left and
right groups to merged vertices, only one. This made the result asymmetric, now merged vertices will be part of both groups with half weight.
Diffstat (limited to 'source/blender/blenkernel/intern/deform.c')
-rw-r--r--source/blender/blenkernel/intern/deform.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index e5f2d152edf..37c551a05b7 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -260,6 +260,29 @@ void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_le
}
}
+void defvert_flip_merged(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
+{
+ MDeformWeight *dw, *copydw;
+ float weight;
+ int i, totweight = dvert->totweight;
+
+ /* copy weights */
+ for (dw= dvert->dw, i=0; i<totweight; dw++, i++) {
+ if (dw->def_nr < flip_map_len) {
+ if (flip_map[dw->def_nr] >= 0) {
+ copydw= defvert_verify_index(dvert, flip_map[dw->def_nr]);
+ dw= &dvert->dw[i]; /* in case array got realloced */
+
+ /* distribute weights: if only one of the vertex groups was
+ assigned this will halve the weights, otherwise it gets
+ evened out. this keeps it proportional to other groups */
+ weight = 0.5f*(copydw->weight + dw->weight);
+ copydw->weight= weight;
+ dw->weight= weight;
+ }
+ }
+ }
+}
bDeformGroup *defgroup_find_name(Object *ob, const char *name)
{