[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12724] trunk/blender/source/blender:

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Nov 29 20:35:30 CET 2007


Revision: 12724
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12724
Author:   blendix
Date:     2007-11-29 20:35:30 +0100 (Thu, 29 Nov 2007)

Log Message:
-----------

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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/key.c
    trunk/blender/source/blender/makesdna/DNA_key_types.h
    trunk/blender/source/blender/src/buttons_editing.c
    trunk/blender/source/blender/src/editkey.c

Modified: trunk/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/key.c	2007-11-29 16:56:09 UTC (rev 12723)
+++ trunk/blender/source/blender/blenkernel/intern/key.c	2007-11-29 19:35:30 UTC (rev 12724)
@@ -672,14 +672,12 @@
 	
 	/* 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 @@
 				}
 			}
 		}
-		kb= kb->next;
 	}
 }
 
@@ -1312,6 +1309,9 @@
 	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;

Modified: trunk/blender/source/blender/makesdna/DNA_key_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_key_types.h	2007-11-29 16:56:09 UTC (rev 12723)
+++ trunk/blender/source/blender/makesdna/DNA_key_types.h	2007-11-29 19:35:30 UTC (rev 12724)
@@ -44,7 +44,7 @@
 	
 	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 @@
 #define KEY_CARDINAL    1
 #define KEY_BSPLINE     2
 
+/* keyblock->flag */
+#define KEYBLOCK_MUTE	1
+
 #endif
 

Modified: trunk/blender/source/blender/src/buttons_editing.c
===================================================================
--- trunk/blender/source/blender/src/buttons_editing.c	2007-11-29 16:56:09 UTC (rev 12723)
+++ trunk/blender/source/blender/src/buttons_editing.c	2007-11-29 19:35:30 UTC (rev 12724)
@@ -2464,15 +2464,17 @@
 	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);
 

Modified: trunk/blender/source/blender/src/editkey.c
===================================================================
--- trunk/blender/source/blender/src/editkey.c	2007-11-29 16:56:09 UTC (rev 12723)
+++ trunk/blender/source/blender/src/editkey.c	2007-11-29 19:35:30 UTC (rev 12724)
@@ -625,7 +625,7 @@
 
 void delete_key(Object *ob)
 {
-	KeyBlock *kb;
+	KeyBlock *kb, *rkb;
 	Key *key;
 	IpoCurve *icu;
 	
@@ -635,6 +635,10 @@
 	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;





More information about the Bf-blender-cvs mailing list