diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-08 18:04:06 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-08 18:04:06 +0400 |
commit | a80b7d612947e1d26b10165a37bb603dae527afd (patch) | |
tree | 7a575b2f99b093e43d50d9322f8d1c50477b0fa6 /source/blender/blenkernel | |
parent | a5f2db9992327764126ee7f275294d1f0699a26a (diff) |
Fixing several issues with keyingsets:
*Add a new idname to keyingsets, keeping name as label-only (using same string for both made lookup fail when using i18n other than english, as it tried to compare an untranslated static string id against a translated RNA name). Also adding a description string (can be helpful with custom keyingsets, imho).
*Fixed a few other bugs related to that area (namely, you can’t deselect current keyingset from the shift-ctrl-alt-I popup menu, and insert/delete key ops were using a rather strange way to get chosen custom keyingset…).
*Fixed UI code so that it always uses (RNA) enum, and simplified menu-creation code.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_animsys.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index fb4a44b2c80..59dc2f2fc70 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -81,7 +81,7 @@ void BKE_relink_animdata(struct AnimData *adt); /* KeyingSets API */ /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */ -struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag); +struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag); /* Add a path to a KeyingSet */ struct KS_Path *BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index db8bd8f2066..3a08120f067 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -941,14 +941,16 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[] /* Defining Tools --------------------------- */ /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */ -KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, short keyingflag) +KeyingSet *BKE_keyingset_add (ListBase *list, const char idname[], const char name[], short flag, short keyingflag) { KeyingSet *ks; /* allocate new KeyingSet */ ks= MEM_callocN(sizeof(KeyingSet), "KeyingSet"); - BLI_strncpy(ks->name, name ? name : "KeyingSet", sizeof(ks->name)); + BLI_strncpy(ks->idname, idname ? idname : name ? name : "KeyingSet", sizeof(ks->idname)); + + BLI_strncpy(ks->name, name ? name : idname ? idname : "Keying Set", sizeof(ks->name)); ks->flag= flag; ks->keyingflag= keyingflag; @@ -956,8 +958,11 @@ KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, sho /* add KeyingSet to list */ BLI_addtail(list, ks); - /* make sure KeyingSet has a unique name (this helps with identification) */ - BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, name), sizeof(ks->name)); + /* Make sure KeyingSet has a unique idname. */ + BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, idname), sizeof(ks->idname)); + + /* Make sure KeyingSet has a unique label (this helps with identification). */ + BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name)); /* return new KeyingSet for further editing */ return ks; |