diff options
author | Ton Roosendaal <ton@blender.org> | 2006-04-17 21:35:20 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-04-17 21:35:20 +0400 |
commit | 5768e9a9dda8ec941195f0e978549a0e31b0caf4 (patch) | |
tree | 127cbbfb3b9fd982bbc6ae3f0acfec25c370304a | |
parent | 420b6ba5e471fa224f30d1c254b2e4733a3c0e32 (diff) |
Bugfix #3683
When the 'reference shape key' (drawn yellow) was not the first key, the
channels as drawn in IpoWindow didn't match the actual shape keys.
This was caused by an exception in code that skips drawing the reference
shape when 'relative' was used.
Now I've added a rule that the first shape in a list always becomes the
reference, that way you can also edit it. To keep backwards compatibility,
this is only activated on translating the shape key lines.
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawipo.c | 14 | ||||
-rw-r--r-- | source/blender/src/editipo.c | 14 |
3 files changed, 12 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e0006c854cf..2bd7993e626 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -208,6 +208,8 @@ void sort_keys(Key *key) } } + /* new rule; first key is refkey, this to match drawing channels... */ + key->refkey= key->block.first; } /**************** do the key ****************/ diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index 11a49790580..642a7a0602e 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -93,7 +93,6 @@ #define ISPOIN3(a, b, c, d) ( (a->b) && (a->c) && (a->d) ) #define ISPOIN4(a, b, c, d, e) ( (a->b) && (a->c) && (a->d) && (a->e) ) -#define IPOBUTX 65 /* minimum pixels per gridstep */ #define IPOSTEP 35 @@ -685,6 +684,7 @@ void test_view2d(View2D *v2d, int winx, int winy) } } +#define IPOBUTX 65 static int calc_ipobuttonswidth(ScrArea *sa) { SpaceIpo *sipo= sa->spacedata.first; @@ -692,13 +692,15 @@ static int calc_ipobuttonswidth(ScrArea *sa) int ipowidth = IPOBUTX; int a; + /* default width when no space ipo or no channels */ if (sipo == NULL) return IPOBUTX; - if ((sipo->totipo==0) || (sipo->editipo==0)) return IPOBUTX; - + if ((sipo->totipo==0) || (sipo->editipo==NULL)) return IPOBUTX; + ei= sipo->editipo; for(a=0; a<sipo->totipo; a++, ei++) { - if (BMF_GetStringWidth(G.font, ei->name) + 18 > ipowidth) ipowidth = BMF_GetStringWidth(G.font, ei->name) + 18; + if (BMF_GetStringWidth(G.font, ei->name) + 18 > ipowidth) + ipowidth = BMF_GetStringWidth(G.font, ei->name) + 18; } return ipowidth; @@ -2016,6 +2018,8 @@ void drawipospace(ScrArea *sa, void *spacedata) uiFreeBlocksWin(&sa->uiblocks, sa->win); /* for panel handler to work */ + test_editipo(0); /* test if current editipo is correct, make_editipo sets v2d->cur, call here because of calc_ipobuttonswidth() */ + v2d->hor.xmax+=calc_ipobuttonswidth(sa); calc_scrollrcts(sa, G.v2d, sa->winx, sa->winy); @@ -2038,8 +2042,6 @@ void drawipospace(ScrArea *sa, void *spacedata) } } - test_editipo(0); /* test if current editipo is correct, make_editipo sets v2d->cur */ - myortho2(v2d->cur.xmin, v2d->cur.xmax, v2d->cur.ymin, v2d->cur.ymax); if(sipo->editipo) { diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index c119f1a5e06..52734faa99c 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -527,18 +527,8 @@ static void make_key_editipo(SpaceIpo *si) si->totipo= BLI_countlist(&key->block); ei= si->editipo= MEM_callocN(si->totipo*sizeof(EditIpo), "editipo"); - for(a=0; a<si->totipo; a++, ei++) { - /* we put refkey first, the rest in order of list */ - if(a==0) kb= key->refkey; - else { - if(a==1) - kb= key->block.first; - else - kb= kb->next; - if(kb==key->refkey) - kb= kb->next; - } - + for(a=0, kb= key->block.first; a<si->totipo; a++, ei++, kb= kb->next) { + if(kb->name[0] != 0) strncpy(ei->name, kb->name, 31); // length both same ei->adrcode= kb->adrcode; |