diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-11-29 22:35:30 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-11-29 22:35:30 +0300 |
commit | 18e5f7b50b33f1cb1f71ee3d1cc19477310ed87e (patch) | |
tree | 9393392a6b690b5b92d890e41f0f40a30d650bf3 /source/blender | |
parent | 0d8b28e2a39d55e346e0342d6e305a811e0ce05b (diff) |
Shape Keys
==========
- Added a Mute button for shape keys, useful for debugging the influence
of driven shape keys.
- Bugfix for the shape keys relative to others keys, was hanging in
an eternal loop when deleting the other key.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_key_types.h | 5 | ||||
-rw-r--r-- | source/blender/src/buttons_editing.c | 10 | ||||
-rw-r--r-- | source/blender/src/editkey.c | 6 |
4 files changed, 20 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 234a096edce..b57b799001a 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -672,14 +672,12 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, i /* step 2: do it */ - kb= key->block.first; - while(kb) { - + for(kb=key->block.first; kb; kb=kb->next) { if(kb!=key->refkey) { float icuval= kb->curval; /* only with value, and no difference allowed */ - if(icuval!=0.0f && kb->totelem==tot) { + if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) { KeyBlock *refb; float weight, *weights= kb->weights; @@ -738,7 +736,6 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, i } } } - kb= kb->next; } } @@ -1312,6 +1309,9 @@ int do_ob_key(Object *ob) if(ob->shapeflag & (OB_SHAPE_LOCK|OB_SHAPE_TEMPLOCK)) { KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1); + if(kb && (kb->flag & KEYBLOCK_MUTE)) + kb= key->refkey; + if(kb==NULL) { kb= key->block.first; ob->shapenr= 1; diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 785cf515a42..87c09fb0ee4 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -44,7 +44,7 @@ typedef struct KeyBlock { float pos; float curval; - short type, adrcode, relative, pad1; /* relative == 0 means first key is reference */ + short type, adrcode, relative, flag; /* relative == 0 means first key is reference */ int totelem, pad2; void *data; @@ -87,5 +87,8 @@ typedef struct Key { #define KEY_CARDINAL 1 #define KEY_BSPLINE 2 +/* keyblock->flag */ +#define KEYBLOCK_MUTE 1 + #endif diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 701d62d5565..e2debea0750 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -2464,15 +2464,17 @@ static void editing_panel_shapes(Object *ob) uiBlockBeginAlign(block); if(ob->shapeflag & OB_SHAPE_LOCK) icon= ICON_PIN_HLT; else icon= ICON_PIN_DEHLT; uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object"); + if(kb->flag & KEYBLOCK_MUTE) icon= ICON_MUTE_IPO_ON; else icon = ICON_MUTE_IPO_OFF; + uiDefIconButBitS(block, TOG, KEYBLOCK_MUTE, B_MODIFIER_RECALC, icon, 35,150,20,20, &kb->flag, 0, 0, 0, 0, "Mute the current Shape"); uiSetButLock(G.obedit==ob, "Unable to perform in EditMode"); - uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 35,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key"); + uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 55,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key"); strp= make_key_menu(key, 1); - uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices"); + uiDefButS(block, MENU, B_SETKEY, strp, 75,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices"); MEM_freeN(strp); - uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key"); + uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 95,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key"); uiClearButLock(); - uiDefBut(block, TEX, B_NAMEKEY, "", 95, 150, 190, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name"); + uiDefBut(block, TEX, B_NAMEKEY, "", 115, 150, 170, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name"); uiDefIconBut(block, BUT, B_DELKEY, ICON_X, 285,150,25,20, 0, 0, 0, 0, 0, "Deletes current Shape Key"); uiBlockEndAlign(block); diff --git a/source/blender/src/editkey.c b/source/blender/src/editkey.c index 0d861cda5d0..5cc193f8844 100644 --- a/source/blender/src/editkey.c +++ b/source/blender/src/editkey.c @@ -625,7 +625,7 @@ void insert_shapekey(Object *ob) void delete_key(Object *ob) { - KeyBlock *kb; + KeyBlock *kb, *rkb; Key *key; IpoCurve *icu; @@ -635,6 +635,10 @@ void delete_key(Object *ob) kb= BLI_findlink(&key->block, ob->shapenr-1); if(kb) { + for(rkb= key->block.first; rkb; rkb= rkb->next) + if(rkb->relative == ob->shapenr-1) + rkb->relative= 0; + BLI_remlink(&key->block, kb); key->totkey--; if(key->refkey== kb) key->refkey= key->block.first; |