diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 15:07:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-15 15:07:18 +0400 |
commit | f5f82924614e9ab712a98bd39801061698bf7b3d (patch) | |
tree | 63e604c3c003895784c0197dfb62548d0038a2aa /source/blender/makesrna | |
parent | d0d16b5ed29c8f209bbeb0dd32a01ae581b5e9f7 (diff) |
ensure BoneGroup names are kept unique.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b61495edc94..e3a3f93b5f3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -139,6 +139,17 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) } } +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 @@ static void rna_def_bone_group(BlenderRNA *brna) /* 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 |