== IPO Muting ==
authorJoshua Leung <aligorith@gmail.com>
Fri, 22 Jun 2007 11:09:31 +0000 (11:09 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 22 Jun 2007 11:09:31 +0000 (11:09 +0000)
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äläinen (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.

source/blender/blenkernel/intern/ipo.c
source/blender/makesdna/DNA_ipo_types.h
source/blender/src/drawaction.c
source/blender/src/editaction.c
source/blender/src/header_ipo.c

index 08924ac96d58c4d6ec1d94a071be28e909f70d6d..bf02c49b23c3f99a26007aa661d782074a6d2a8b 100644 (file)
@@ -995,10 +995,13 @@ void calc_ipo(Ipo *ipo, float ctime)
        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);
+               }
        }
 }
 
index 441a3fc43fc6ec21f232e10c43957aa32cffbf54..9321dce2ca3344273aa7e4d9807414ff7ee83831 100644 (file)
@@ -45,8 +45,7 @@ typedef struct Ipo {
        ListBase curve;
        rctf cur;
        short blocktype, showkey;
-       int pad;
-               
+       short muteipo, pad;
 } Ipo;
 
 /* sometimes used */
@@ -391,6 +390,7 @@ typedef short IPO_Channel;
 #define IPO_AUTO_HORIZ 16
 #define IPO_ACTIVE             32
 #define IPO_PROTECT            64
+#define IPO_MUTE               128
 
 #endif
 
index f1aba5903586dd7173f1768a43941f5aa928af00..357614f24abb84efe40740bdd1d023d6ba376b55 100644 (file)
@@ -404,6 +404,14 @@ static void draw_action_channel_names(bAction *act)
                        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 @@ static void draw_action_channel_names(bAction *act)
                                                        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 @@ static void draw_action_channel_names(bAction *act)
                                                        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);
index 03b74fe52398f7e677f9a59e4cb1653d95bb9535..d0b0005bf71af2d0157105faae77a8f42aa3b56e 100644 (file)
@@ -1647,7 +1647,8 @@ static void clever_achannel_names (short *mval)
        
        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 @@ static void clever_achannel_names (short *mval)
                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 @@ static void clever_achannel_names (short *mval)
                
                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 @@ static void clever_achannel_names (short *mval)
                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 @@ static void clever_achannel_names (short *mval)
                        
                        //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 @@ static void clever_achannel_names (short *mval)
                        
                        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 @@ static void mouse_actionchannels (short mval[])
                                        /* 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 @@ static void mouse_actionchannels (short mval[])
                        {
                                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 @@ static void mouse_actionchannels (short mval[])
                                        /* 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);
index 1c117e0331ef6f58778393eb623ab9bcc5eeb977..b7fcc98356e130467f1d70f6c87f70b6416136a8 100644 (file)
@@ -1261,6 +1261,12 @@ void ipo_buttons(void)
                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");