[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45724] branches/meshdata_transfer/source/ blender/editors/object/object_vgroup.c: Added mechanics for detecting and reacting on uneven indices.

Ove Murberg Henriksen sorayasilvermoon at hotmail.com
Tue Apr 17 21:10:58 CEST 2012


Revision: 45724
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45724
Author:   cyborgmuppet
Date:     2012-04-17 19:10:57 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
Added mechanics for detecting and reacting on uneven indices.

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-04-17 18:36:29 UTC (rev 45723)
+++ branches/meshdata_transfer/source/blender/editors/object/object_vgroup.c	2012-04-17 19:10:57 UTC (rev 45724)
@@ -405,6 +405,12 @@
 	index_src= BLI_findindex(&ob_src->defbase, dg_src);
 	index_dst= BLI_findindex(&ob_dst->defbase, dg_dst);
 
+	/*Check if indices are matching, delete and return if not*/
+	if (ob_dst==ob_src || dv_tot_dst==0 || (dv_tot_dst != dv_tot_src) || dv_array_src==NULL || dv_array_dst==NULL) {
+		ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_dst->name));
+		return 0;
+	}
+
 	/* Loop through the vertices and copy weight*/
 	for(i=0; i<dv_tot_dst; i++, dv_array_src++, dv_array_dst++) {
 		dw_src = defvert_verify_index(*dv_array_src, index_src);
@@ -2809,6 +2815,12 @@
 		            change, fail);
 	}
 
+	if ((change == 0 && fail == 0) || fail) {
+		BKE_reportf(op->reports, RPT_ERROR,
+		            "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices",
+		            change, fail);
+	}
+
 	return OPERATOR_FINISHED;
 }
 




More information about the Bf-blender-cvs mailing list