From f237a466c111b439a278ff78a959bc4c63cacfd0 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 22 Aug 2007 10:07:42 +0000 Subject: Minor Code Cleanup (ShapeKeys): Added a new API method for ShapeKeys, which is useful for finding a certain KeyBlock from a Key. --- source/blender/src/editipo_lib.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'source/blender/src/editipo_lib.c') diff --git a/source/blender/src/editipo_lib.c b/source/blender/src/editipo_lib.c index 15840614d2a..47bd06664c2 100644 --- a/source/blender/src/editipo_lib.c +++ b/source/blender/src/editipo_lib.c @@ -148,24 +148,16 @@ char *getname_ipocurve(IpoCurve *icu, Object *ob) { static char name[32]; Key *key= ob_get_key(ob); + KeyBlock *kb= key_get_keyblock(key, icu->adrcode); - if (key) { - KeyBlock *kb= key->block.first; - int i; - - for (i= 1; i < key->totkey; i++) { - kb= kb->next; - - if (icu->adrcode == i) { - /* only return name if it has been set, otherwise use - * default method using static string (Key #) - */ - if (kb->name[0] == '\0') - break; /* stop looping through keyblocks */ - else - return kb->name; /* return keyblock's name */ - } - } + if (kb) { + /* only return name if it has been set, otherwise use + * default method using static string (Key #) + */ + if (kb->name[0] == '\0') + break; /* stop looping through keyblocks */ + else + return kb->name; /* return keyblock's name */ } /* in case keyblock is not named or no key/keyblock was found */ -- cgit v1.2.3