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.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user