diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-06-22 15:09:31 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-06-22 15:09:31 +0400 |
commit | aad13c1b8715d6847641a5e50e3df3baf0bb0a1e (patch) | |
tree | 9338840cc4324f5f91400665272f15be91c5a79f | |
parent | 133c7fd7c734fe9e20be4a89b23047815141ca06 (diff) |
== 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ä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.
-rw-r--r-- | source/blender/blenkernel/intern/ipo.c | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_ipo_types.h | 4 | ||||
-rw-r--r-- | source/blender/src/drawaction.c | 22 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 31 | ||||
-rw-r--r-- | source/blender/src/header_ipo.c | 6 |
5 files changed, 65 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 08924ac96d5..bf02c49b23c 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -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); + } } } diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 441a3fc43fc..9321dce2ca3 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -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 diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index f1aba590358..357614f24ab 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -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); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 03b74fe5239..d0b0005bf71 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -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); diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index 1c117e0331e..b7fcc98356e 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -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"); |