[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48095] branches/meshdata_transfer/source/ blender/editors/object/object_vgroup.c: Its now overwriting properly by clearing weights when using replace_mode all .

Ove Murberg Henriksen sorayasilvermoon at hotmail.com
Tue Jun 19 21:16:02 CEST 2012


Revision: 48095
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48095
Author:   cyborgmuppet
Date:     2012-06-19 19:15:59 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
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) 

Modified Paths:
--------------
    branches/meshdata_transfer/source/blender/editors/object/object_vgroup.c

Modified: branches/meshdata_transfer/source/blender/editors/object/object_vgroup.c
===================================================================
--- branches/meshdata_transfer/source/blender/editors/object/object_vgroup.c	2012-06-19 18:26:55 UTC (rev 48094)
+++ branches/meshdata_transfer/source/blender/editors/object/object_vgroup.c	2012-06-19 19:15:59 UTC (rev 48095)
@@ -490,6 +490,14 @@
 	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 @@
 					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 @@
 				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 @@
 					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 */




More information about the Bf-blender-cvs mailing list