Add "View Selected" in the IPO editor

- Numpad dot is shortcut key, same as in other windows.

(Peach feature request)
This commit is contained in:
Brecht Van Lommel 2007-08-20 17:50:04 +00:00
parent b697f19cf8
commit 8a46c006d6
7 changed files with 38 additions and 20 deletions

@ -65,8 +65,8 @@ int geticon_ipo_blocktype(short blocktype);
struct EditIpo *get_active_editipo(void); struct EditIpo *get_active_editipo(void);
void boundbox_ipocurve(struct IpoCurve *icu); void boundbox_ipocurve(struct IpoCurve *icu, int selectedonly);
void boundbox_ipo(struct Ipo *ipo, struct rctf *bb); void boundbox_ipo(struct Ipo *ipo, struct rctf *bb, int selectedonly);
void editipo_changed(struct SpaceIpo *si, int doredraw); void editipo_changed(struct SpaceIpo *si, int doredraw);
void scale_editipo(void); void scale_editipo(void);

@ -246,6 +246,7 @@
#define B_IPOPIN 212 #define B_IPOPIN 212
#define B_IPO_ACTION_OB 213 #define B_IPO_ACTION_OB 213
#define B_IPO_ACTION_KEY 214 #define B_IPO_ACTION_KEY 214
#define B_IPOVIEWCENTER 215
/* OOPS: 250 */ /* OOPS: 250 */

@ -1654,7 +1654,7 @@ static void boundbox_ipo_curves(SpaceIpo *si)
if(ei->icu) { if(ei->icu) {
if(ei->flag & IPO_VISIBLE) { if(ei->flag & IPO_VISIBLE) {
boundbox_ipocurve(ei->icu); boundbox_ipocurve(ei->icu, 0);
if(first) { if(first) {
si->v2d.tot= ei->icu->totrct; si->v2d.tot= ei->icu->totrct;
first= 0; first= 0;

@ -248,7 +248,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
if(ei->flag & IPO_VISIBLE) { if(ei->flag & IPO_VISIBLE) {
boundbox_ipocurve(ei->icu); boundbox_ipocurve(ei->icu, 0);
sort_time_ipocurve(ei->icu); sort_time_ipocurve(ei->icu);
if(first) { if(first) {
si->v2d.tot= ei->icu->totrct; si->v2d.tot= ei->icu->totrct;

@ -287,7 +287,7 @@ char *getname_fluidsim_ei(int nr)
} }
void boundbox_ipocurve(IpoCurve *icu) void boundbox_ipocurve(IpoCurve *icu, int selectedonly)
{ {
BezTriple *bezt; BezTriple *bezt;
float vec[3]={0.0,0.0,0.0}; float vec[3]={0.0,0.0,0.0};
@ -302,20 +302,25 @@ void boundbox_ipocurve(IpoCurve *icu)
bezt= icu->bezt; bezt= icu->bezt;
while(a--) { while(a--) {
if(icu->vartype & IPO_BITS) { if(icu->vartype & IPO_BITS) {
vec[0]= bezt->vec[1][0]; if((bezt->f2 & 1) || !selectedonly) {
vec[1]= 0.0; vec[0]= bezt->vec[1][0];
DO_MINMAX(vec, min, max); vec[1]= 0.0;
DO_MINMAX(vec, min, max);
vec[1]= 16.0;
DO_MINMAX(vec, min, max); vec[1]= 16.0;
DO_MINMAX(vec, min, max);
}
} }
else { else {
if(icu->ipo==IPO_BEZ && a!=icu->totvert-1) { if((bezt->f1 & 1) || !selectedonly) {
DO_MINMAX(bezt->vec[0], min, max); if(icu->ipo==IPO_BEZ && a!=icu->totvert-1)
DO_MINMAX(bezt->vec[0], min, max);
} }
DO_MINMAX(bezt->vec[1], min, max); if((bezt->f2 & 1) || !selectedonly)
if(icu->ipo==IPO_BEZ && a!=0) { DO_MINMAX(bezt->vec[1], min, max);
DO_MINMAX(bezt->vec[2], min, max); if((bezt->f3 & 1) || !selectedonly) {
if(icu->ipo==IPO_BEZ && a!=0)
DO_MINMAX(bezt->vec[2], min, max);
} }
} }
@ -337,7 +342,7 @@ void boundbox_ipocurve(IpoCurve *icu)
} }
} }
void boundbox_ipo(Ipo *ipo, rctf *bb) void boundbox_ipo(Ipo *ipo, rctf *bb, int selectedonly)
{ {
IpoCurve *icu; IpoCurve *icu;
int first= 1; int first= 1;
@ -345,7 +350,7 @@ void boundbox_ipo(Ipo *ipo, rctf *bb)
icu= ipo->curve.first; icu= ipo->curve.first;
while(icu) { while(icu) {
boundbox_ipocurve(icu); boundbox_ipocurve(icu, selectedonly);
if(first) { if(first) {
*bb= icu->totrct; *bb= icu->totrct;

@ -713,6 +713,9 @@ static void do_ipo_viewmenu(void *arg, int event)
center_currframe(); center_currframe();
scrarea_queue_winredraw(curarea); scrarea_queue_winredraw(curarea);
break; break;
case 11:
do_ipo_buttons(B_IPOVIEWCENTER);
break;
} }
} }
@ -748,7 +751,7 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center on Current Frame|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center on Current Frame|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, "");
uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, uiDefIconTextBut(block, BUTM, 1, (G.v2d->flag & V2D_VIEWLOCK)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT,
"Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); "Lock Time to Other Windows|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
@ -757,6 +760,10 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Current Frame to Selected|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Current Frame to Selected|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, "");
} }
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View Selected|NumPad .", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 11, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,20, ""); if(!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Maximize Window|Ctrl UpArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0,20, "");
else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, ""); else uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, "Tile Window|Ctrl DownArrow", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 20, "");
@ -951,6 +958,7 @@ void do_ipo_buttons(short event)
if(curarea->win==0) return; if(curarea->win==0) return;
switch(event) { switch(event) {
case B_IPOVIEWCENTER:
case B_IPOHOME: case B_IPOHOME:
/* boundbox */ /* boundbox */
@ -969,7 +977,7 @@ void do_ipo_buttons(short event)
for(a=0; a<G.sipo->totipo; a++, ei++) { for(a=0; a<G.sipo->totipo; a++, ei++) {
if ISPOIN(ei, flag & IPO_VISIBLE, icu) { if ISPOIN(ei, flag & IPO_VISIBLE, icu) {
boundbox_ipocurve(ei->icu); boundbox_ipocurve(ei->icu, (event==B_IPOVIEWCENTER));
if(first) { if(first) {
v2d->tot= ei->icu->totrct; v2d->tot= ei->icu->totrct;

@ -2739,6 +2739,10 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if((G.qual==0)) if((G.qual==0))
do_ipo_buttons(B_IPOHOME); do_ipo_buttons(B_IPOHOME);
break; break;
case PADPERIOD:
if((G.qual==0))
do_ipo_buttons(B_IPOVIEWCENTER);
break;
case AKEY: case AKEY:
if (G.qual & LR_CTRLKEY) { if (G.qual & LR_CTRLKEY) {