[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14649] trunk/blender/source/blender/src: deleting a vertex group didn' t update the buttons window when the 3d view wasnt open.

Campbell Barton ideasman42 at gmail.com
Thu May 1 21:46:05 CEST 2008


Revision: 14649
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14649
Author:   campbellbarton
Date:     2008-05-01 21:46:05 +0200 (Thu, 01 May 2008)

Log Message:
-----------
deleting a vertex group didn't update the buttons window when the 3d view wasnt open. it also didn't update the 3dview weight paint colors.
copying a group kept appending "_copy" and rose an error when the string was too long. now just add one _copy prefix and number uniquely.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/editdeform.c

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2008-05-01 18:52:26 UTC (rev 14648)
+++ trunk/blender/source/blender/src/buttons_editing.c	2008-05-01 19:46:05 UTC (rev 14649)
@@ -4585,16 +4585,21 @@
 	switch(event) {
 		case B_NEWVGROUP:
 			add_defgroup (ob);
+			DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 			scrarea_queue_winredraw(curarea);
 			allqueue(REDRAWOOPS, 0);
+			
 			break;
 		case B_DELVGROUP:
-			if ((G.obedit) && (G.obedit == ob))
+			if ((G.obedit) && (G.obedit == ob)) {
 				del_defgroup (ob);
-			else
+			} else {
 				del_defgroup_in_object_mode (ob);
+				DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+			}
 			allqueue (REDRAWVIEW3D, 1);
 			allqueue(REDRAWOOPS, 0);
+			allqueue(REDRAWBUTSEDIT, 1);
 			BIF_undo_push("Delete vertex group");
 			break;
 		case B_ASSIGNVGROUP:
@@ -4616,6 +4621,7 @@
 			break;
 		case B_DESELVGROUP:
 			sel_verts_defgroup(0);
+			DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
 			allqueue (REDRAWVIEW3D, 1);
 			allqueue(REDRAWOOPS, 0);
 			countall();

Modified: trunk/blender/source/blender/src/editdeform.c
===================================================================
--- trunk/blender/source/blender/src/editdeform.c	2008-05-01 18:52:26 UTC (rev 14648)
+++ trunk/blender/source/blender/src/editdeform.c	2008-05-01 19:46:05 UTC (rev 14649)
@@ -217,19 +217,25 @@
 	dg = BLI_findlink (&ob->defbase, (ob->actdef-1));
 	if (!dg)
 		return;
-
-	BLI_snprintf (name, 32, "%s_copy", dg->name);
-	while (get_named_vertexgroup (ob, name)) {
-		if ((strlen (name) + 6) > 32) {
-			error ("Error: the name for the new group is > 32 characters");
-			return;
+	
+	if (strstr(dg->name, "_copy")) {
+		BLI_strncpy (name, dg->name, 32); /* will be renamed _copy.001... etc */
+	} else {
+		BLI_snprintf (name, 32, "%s_copy", dg->name);
+		while (get_named_vertexgroup (ob, name)) {
+			if ((strlen (name) + 6) > 32) {
+				error ("Error: the name for the new group is > 32 characters");
+				return;
+			}
+			strcpy (s, name);
+			BLI_snprintf (name, 32, "%s_copy", s);
 		}
-		strcpy (s, name);
-		BLI_snprintf (name, 32, "%s_copy", s);
-	}
+	}		
 
 	cdg = copy_defgroup (dg);
 	strcpy (cdg->name, name);
+	unique_vertexgroup_name(cdg, ob);
+	
 	BLI_addtail (&ob->defbase, cdg);
 
 	idg = (ob->actdef-1);





More information about the Bf-blender-cvs mailing list