[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11003] trunk/blender/source/blender: == IPO Muting ==

Joshua Leung aligorith at gmail.com
Fri Jun 22 13:09:32 CEST 2007


Revision: 11003
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11003
Author:   aligorith
Date:     2007-06-22 13:09:31 +0200 (Fri, 22 Jun 2007)

Log Message:
-----------
== IPO Muting ==

It is now possible to temporarily 'mute' and IPO-block or IPO-curve. This functionality has been requested by the Plumiferos team, and is based off Patch #6866 by Juho Veps?\195?\164l?\195?\164inen (bebraw).


Usage:
* In the IPO Editor header, there is a toggle button (open/closed eye used for Outliner Visibility restriction) beside the IPO-blocktype menu, when there is an active IPO-block in the IPO Editor.

* In the Action Editor, beside the 'lock' icon for channel protection on Action/Constraint channels, there is the open/closed 'eye' that can be toggled to set the mute status of said channel's IPO-block.

* Also in the Action Editor, you can mute individual IPO-curve channels in a similar manner.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/ipo.c
    trunk/blender/source/blender/makesdna/DNA_ipo_types.h
    trunk/blender/source/blender/src/drawaction.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/header_ipo.c

Modified: trunk/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/ipo.c	2007-06-21 21:58:04 UTC (rev 11002)
+++ trunk/blender/source/blender/blenkernel/intern/ipo.c	2007-06-22 11:09:31 UTC (rev 11003)
@@ -995,10 +995,13 @@
 	IpoCurve *icu;
 	
 	if(ipo==NULL) return;
+	if(ipo->muteipo) return;
 	
 	for(icu= ipo->curve.first; icu; icu= icu->next) {
-		if(icu->driver || (icu->flag & IPO_LOCK)==0) 
-			calc_icu(icu, ctime);
+		if(icu->driver || (icu->flag & IPO_LOCK)==0) { 
+			if((icu->flag & IPO_MUTE)==0)
+				calc_icu(icu, ctime);
+		}
 	}
 }
 

Modified: trunk/blender/source/blender/makesdna/DNA_ipo_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_ipo_types.h	2007-06-21 21:58:04 UTC (rev 11002)
+++ trunk/blender/source/blender/makesdna/DNA_ipo_types.h	2007-06-22 11:09:31 UTC (rev 11003)
@@ -45,8 +45,7 @@
 	ListBase curve;
 	rctf cur;
 	short blocktype, showkey;
-	int pad;
-		
+	short muteipo, pad;
 } Ipo;
 
 /* sometimes used */
@@ -391,6 +390,7 @@
 #define IPO_AUTO_HORIZ	16
 #define IPO_ACTIVE		32
 #define IPO_PROTECT		64
+#define IPO_MUTE		128
 
 #endif
 

Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c	2007-06-21 21:58:04 UTC (rev 11002)
+++ trunk/blender/source/blender/src/drawaction.c	2007-06-22 11:09:31 UTC (rev 11003)
@@ -404,6 +404,14 @@
 			glRasterPos2f(x+18,  y-4);
 			BMF_DrawString(G.font, achan->name);
 			
+			/* draw 'eye' indicating whether channel's ipo is muted */
+			if (achan->ipo) {
+				if (achan->ipo->muteipo) 
+					BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
+				else 
+					BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
+			}
+			
 			/* draw 'lock' indicating whether channel is protected */
 			if (EDITABLE_ACHAN(achan)==0) 
 				BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_LOCKED);
@@ -454,6 +462,12 @@
 							glRasterPos2f(x+24,  y-4);
 							BMF_DrawString(G.font, icu_name);
 							
+							/* draw 'eye' indicating whether channel's ipo curve is muted */
+							if (icu->flag & IPO_MUTE) 
+								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
+							else 
+								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
+							
 #if 0 /* tempolarily disabled until all ipo-code can support this option */
 							/* draw 'lock' to indicate if ipo-curve channel is protected */
 							if (EDITABLE_ICU(icu)==0) 
@@ -506,6 +520,14 @@
 							glRasterPos2f(x+25,  y-4);
 							BMF_DrawString(G.font, conchan->name);
 							
+							/* draw 'eye' indicating whether channel's ipo is muted */
+							if (conchan->ipo) {
+								if (conchan->ipo->muteipo) 
+									BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_ON);
+								else 
+									BIF_icon_draw(NAMEWIDTH-32, y-CHANNELHEIGHT/2, ICON_RESTRICT_VIEW_OFF);
+							}
+							
 							/* draw 'lock' to indicate if constraint channel is protected */
 							if (EDITABLE_CONCHAN(conchan)==0) 
 								BIF_icon_draw(NAMEWIDTH-16, y-CHANNELHEIGHT/2, ICON_LOCKED);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2007-06-21 21:58:04 UTC (rev 11002)
+++ trunk/blender/source/blender/src/editaction.c	2007-06-22 11:09:31 UTC (rev 11003)
@@ -1647,7 +1647,8 @@
 	
 	int but=0;
     char str[64];
-	short expand, protect, chantype;
+	short chantype;
+	short expand, protect, mute;
 	float slidermin, slidermax;
 	
 	/* figure out what is under cursor */
@@ -1660,9 +1661,11 @@
 		strcpy(str, achan->name);
 		protect= (achan->flag & ACHAN_PROTECTED);
 		expand = (achan->flag & ACHAN_EXPANDED);
+		mute = (achan->ipo)? (achan->ipo->muteipo): 0;
 
 		add_numbut(but++, TEX, "ActChan: ", 0, 31, str, "Name of Action Channel");
 		add_numbut(but++, TOG|SHO, "Expanded", 0, 24, &expand, "Action Channel is Expanded");
+		add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
 		add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
 	}
 	else if (chantype == ACTTYPE_CONCHAN) {
@@ -1670,8 +1673,10 @@
 		
 		strcpy(str, conchan->name);
 		protect= (conchan->flag & CONSTRAINT_CHANNEL_PROTECTED);
+		mute = (conchan->ipo)? (conchan->ipo->muteipo): 0;
 		
 		add_numbut(but++, TEX, "ConChan: ", 0, 29, str, "Name of Constraint Channel");
+		add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
 		add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
 	}
 	else if (chantype == ACTTYPE_ICU) {
@@ -1693,9 +1698,11 @@
 		slidermax= icu->slide_max;
 		
 		//protect= (icu->flag & IPO_PROTECT);
+		mute = (icu->flag & IPO_MUTE);
 		
 		add_numbut(but++, NUM|FLO, "Slider Min:", -10000, slidermax, &slidermin, 0);
 		add_numbut(but++, NUM|FLO, "Slider Max:", slidermin, 10000, &slidermax, 0);
+		add_numbut(but++, TOG|SHO, "Muted", 0, 24, &mute, "Channel is Muted");
 		//add_numbut(but++, TOG|SHO, "Protected", 0, 24, &protect, "Channel is Protected");
 	}
 	else {
@@ -1712,12 +1719,17 @@
 			
 			//if (protect) icu->flag |= IPO_PROTECT;
 			//else icu->flag &= ~IPO_PROTECT;
+			if (mute) icu->flag |= IPO_MUTE;
+			else icu->flag &= ~IPO_MUTE;
 		}
 		else if (conchan) {
 			strcpy(conchan->name, str);
 			
 			if (protect) conchan->flag |= CONSTRAINT_CHANNEL_PROTECTED;
 			else conchan->flag &= ~CONSTRAINT_CHANNEL_PROTECTED;
+			
+			if (conchan->ipo)
+				conchan->ipo->muteipo = mute;
 		}
 		else if (achan) {
 			strcpy(achan->name, str);
@@ -1727,6 +1739,9 @@
 			
 			if (protect) achan->flag |= ACHAN_PROTECTED;
 			else achan->flag &= ~ACHAN_PROTECTED;
+			
+			if (achan->ipo)
+				achan->ipo->muteipo = mute;
 		}
 		
         allqueue (REDRAWACTION, 0);
@@ -2441,6 +2456,10 @@
 					/* toggle protect */
 					achan->flag ^= ACHAN_PROTECTED;
 				}
+				else if ((mval[0] >= (NAMEWIDTH-32)) && (achan->ipo)) {
+					/* toggle mute */
+					achan->ipo->muteipo = (achan->ipo->muteipo)? 0: 1;
+				}
 				else if (mval[0] <= 17) {
 					/* toggle expand */
 					achan->flag ^= ACHAN_EXPANDED;
@@ -2496,10 +2515,16 @@
 			{
 				IpoCurve *icu= (IpoCurve *)act_channel;
 				
+#if 0 /* disabled until all ipo tools support this ------->  */
 				if (mval[0] >= (NAMEWIDTH-16)) {
 					/* toggle protection */
 					icu->flag ^= IPO_PROTECT;
 				}
+#endif /* <------- end of disabled code */
+				if (mval[0] >= (NAMEWIDTH-16)) {
+					/* toggle mute */
+					icu->flag ^= IPO_MUTE;
+				}
 				else {
 					/* select/deselect */
 					select_icu_channel(act, icu, SELECT_INVERT);
@@ -2514,6 +2539,10 @@
 					/* toggle protection */
 					conchan->flag ^= CONSTRAINT_CHANNEL_PROTECTED;
 				}
+				else if ((mval[0] >= (NAMEWIDTH-32)) && (conchan->ipo)) {
+					/* toggle mute */
+					conchan->ipo->muteipo = (conchan->ipo->muteipo)? 0: 1;
+				}
 				else {
 					/* select/deselect */
 					select_constraint_channel(act, conchan, SELECT_INVERT);

Modified: trunk/blender/source/blender/src/header_ipo.c
===================================================================
--- trunk/blender/source/blender/src/header_ipo.c	2007-06-21 21:58:04 UTC (rev 11002)
+++ trunk/blender/source/blender/src/header_ipo.c	2007-06-22 11:09:31 UTC (rev 11003)
@@ -1261,6 +1261,12 @@
 		uiClearButLock();
 	}
 	
+	/* ipo muting */
+	if (G.sipo->ipo) {
+		uiDefIconButS(block, ICONTOG, 1, ICON_RESTRICT_VIEW_OFF, xco,0,XIC,YIC, &(G.sipo->ipo->muteipo), 0, 0, 0, 0, "Mute IPO-block");
+		xco += XIC;
+	}
+	
 	/* mainmenu, only when data is there and no pin */
 	uiSetButLock(G.sipo->pin, "Can't change because of pinned data");
 





More information about the Bf-blender-cvs mailing list