[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41027] trunk/blender/source/blender: ensure BoneGroup names are kept unique.

Campbell Barton ideasman42 at gmail.com
Sat Oct 15 13:07:19 CEST 2011


Revision: 41027
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41027
Author:   campbellbarton
Date:     2011-10-15 11:07:18 +0000 (Sat, 15 Oct 2011)
Log Message:
-----------
ensure BoneGroup names are kept unique.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesrna/intern/rna_pose.c

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-10-15 10:03:21 UTC (rev 41026)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-10-15 11:07:18 UTC (rev 41027)
@@ -341,7 +341,7 @@
 	void *ikparam;				/* IK solver parameters, structure depends on iksolver */ 
 	
 	bAnimVizSettings avs;		/* settings for visualisation of bone animation */
-	char proxy_act_bone[32];           /*proxy active bone name*/
+	char proxy_act_bone[32];    /* proxy active bone name*/
 } bPose;
 
 
@@ -423,6 +423,8 @@
  * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used 
  * primarily to color bones in the 3d-view. There are other benefits too, but those are mostly related
  * to Action-Groups.
+ *
+ * Note that these two uses each have their own RNA 'ActionGroup' and 'BoneGroup'.
  */
 typedef struct bActionGroup {
 	struct bActionGroup *next, *prev;

Modified: trunk/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_pose.c	2011-10-15 10:03:21 UTC (rev 41026)
+++ trunk/blender/source/blender/makesrna/intern/rna_pose.c	2011-10-15 11:07:18 UTC (rev 41027)
@@ -139,6 +139,17 @@
 	}
 }
 
+void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
+{
+	Object *ob= ptr->id.data;
+	bActionGroup *agrp= ptr->data;
+
+	/* copy the new name into the name slot */
+	BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name));
+
+	BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
+}
+
 static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create)
 {
 	bPoseChannel *pchan= ptr->data;
@@ -657,6 +668,7 @@
 	/* name */
 	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set");
 	RNA_def_struct_name_property(srna, prop);
 	
 	// TODO: add some runtime-collections stuff to access grouped bones 




More information about the Bf-blender-cvs mailing list