diff options
author | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-06-19 23:15:59 +0400 |
---|---|---|
committer | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-06-19 23:15:59 +0400 |
commit | 370901890ac1177a4619b18613096391914204f8 (patch) | |
tree | 2bd8ae584d52fd5a060819e8a51ddbbc9ae4caf0 /source/blender/editors/object/object_vgroup.c | |
parent | 622ae0a1ca9ff9dae0670d4bc8fcd134110a8572 (diff) |
Its now overwriting properly by clearing weights when using replace_mode all.
Reason for not going for suggested "else" on copy in each case is that it would present a paradox.
(it would delete weights that got created in some instances)
Diffstat (limited to 'source/blender/editors/object/object_vgroup.c')
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 7ca9e697229..5648a06f540 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -490,6 +490,14 @@ int ED_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGroup *dg_s invert_m4_m4(ob_src->imat, ob_src->obmat); mult_m4_m4m4(tmp_mat, ob_src->imat, ob_dst->obmat); + /* clear weights */ + if (replace_mode == REPLACE_ALL_WEIGHTS) { + for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++) { + dw_dst = defvert_verify_index(*dv_dst, index_dst); + if (dw_dst) (*dw_dst).weight = 0; + } + } + switch (method) { case BY_INDEX: @@ -514,10 +522,6 @@ int ED_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGroup *dg_s dw_dst = defvert_verify_index(*dv_dst, index_dst); vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode); } - /* why? - ideasman42 2012/06/19 07:27:34 - there should be an 'else {' ... here, which checks if 'dv_dst' has any weights and clears them (at least when overwrite is enabled). This will depend on the options selected, but you see the issue I hope. - */ } break; @@ -545,10 +549,6 @@ int ED_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGroup *dg_s if(dw_src && dw_src->weight) { dw_dst = defvert_verify_index(*dv_dst, index_dst); vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode); - /* why? - ideasman42 2012/06/19 07:27:34 - there should be an 'else {' ... here, which checks if 'dv_dst' has any weights and clears them (at least when overwrite is enabled). This will depend on the options selected, but you see the issue I hope. - */ } } @@ -660,10 +660,6 @@ int ED_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGroup *dg_s dw_dst = defvert_verify_index(*dv_dst, index_dst); vgroup_transfer_weight(mv_dst, &dw_dst->weight, dw_src->weight, replace_mode); } - /* -ideasman42 2012/06/19 07:27:34 why? -there should be an 'else {' ... here, which checks if 'dv_dst' has any weights and clears them (at least when overwrite is enabled). This will depend on the options selected, but you see the issue I hope. - */ } /* free memory */ |