diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-28 21:03:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-28 21:03:04 +0300 |
commit | 8177f343a0303a66e36f2b78566045c0dea0b406 (patch) | |
tree | b1b63d0aac8df1cfb349895fceeff1047cecc43e /source/blender/blenkernel/intern/key.c | |
parent | 32656ad4ba6af89fcbd8247bc219e55be802ebdc (diff) |
- object.add_shape_key(name="Key", from_mix=True)
- ensure new shape key names are unique
- Transfer ShapeKey now can have its settings changes (redo operator)
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 825dd7d441b..1f5e0ca1624 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -32,6 +32,7 @@ #include <math.h> #include <string.h> +#include <stddef.h> #include "MEM_guardedalloc.h" @@ -1395,7 +1396,7 @@ Key *ob_get_key(Object *ob) return NULL; } -KeyBlock *add_keyblock(Key *key) +KeyBlock *add_keyblock(Key *key, char *name) { KeyBlock *kb; float curpos= -0.1; @@ -1409,9 +1410,15 @@ KeyBlock *add_keyblock(Key *key) kb->type= KEY_CARDINAL; tot= BLI_countlist(&key->block); - if(tot==1) strcpy(kb->name, "Basis"); - else sprintf(kb->name, "Key %d", tot-1); - + if(name) { + strncpy(kb->name, name, sizeof(kb->name)); + } else { + if(tot==1) strcpy(kb->name, "Basis"); + else sprintf(kb->name, "Key %d", tot-1); + } + + BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name)); + // XXX this is old anim system stuff? (i.e. the 'index' of the shapekey) kb->adrcode= tot-1; |