Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-08-22 14:07:42 +0400
committerJoshua Leung <aligorith@gmail.com>2007-08-22 14:07:42 +0400
commitf237a466c111b439a278ff78a959bc4c63cacfd0 (patch)
tree4455b2cf3e1607d6e2bf30631767c42b1eca0642 /source/blender/src
parent59016f9f5da298568f0d7c1a9af98b03aa6477ad (diff)
Minor Code Cleanup (ShapeKeys):
Added a new API method for ShapeKeys, which is useful for finding a certain KeyBlock from a Key.
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/drawaction.c4
-rw-r--r--source/blender/src/editaction.c18
-rw-r--r--source/blender/src/editipo_lib.c26
3 files changed, 20 insertions, 28 deletions
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c
index 8d525b88472..5b65295d212 100644
--- a/source/blender/src/drawaction.c
+++ b/source/blender/src/drawaction.c
@@ -160,14 +160,14 @@ static void meshactionbuts(SpaceAction *saction, Object *ob, Key *key)
glRects(NAMEWIDTH, 0, NAMEWIDTH+SLIDERWIDTH, curarea->winy);
uiBlockSetEmboss(block, UI_EMBOSS);
- for (i=1 ; i < key->totkey ; ++ i) {
+ for (i=1; i < key->totkey; i++) {
make_rvk_slider(block, ob, i,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-1, "Slider to control Shape Keys");
y-=CHANNELHEIGHT+CHANNELSKIP;
/* see sliderval array in editkey.c */
- if(i>=255) break;
+ if(i >= 255) break;
}
}
uiDrawBlock(block);
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 9ecb958b567..f7a5d5f40d3 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -1652,20 +1652,20 @@ static void clever_keyblock_names (Key *key, short *mval)
* an invalid key number (and we don't deal
* with the speed ipo).
*/
-
+
keynum = get_nearest_key_num(key, mval, &x);
if ( (keynum < 1) || (keynum >= key->totkey) )
return;
-
- kb= key->block.first;
- for (i=0; i<keynum; ++i) kb = kb->next;
-
- if (kb->name[0] == '\0') {
+
+ kb= key_get_keyblock(key, keynum);
+ if (kb == NULL)
+ return;
+
+
+ if (kb->name[0] == '\0')
sprintf(str, "Key %d", keynum);
- }
- else {
+ else
strcpy(str, kb->name);
- }
if ( (kb->slidermin >= kb->slidermax) ) {
kb->slidermin = 0.0;
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 */