diff options
Diffstat (limited to 'source/blender')
23 files changed, 1230 insertions, 790 deletions
diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h index 459884df704..172e4b9726f 100644 --- a/source/blender/include/BIF_editaction.h +++ b/source/blender/include/BIF_editaction.h @@ -78,24 +78,14 @@ void transform_actionchannel_keys(int mode, int dummy); void transform_meshchannel_keys(char mode, struct Key *key); struct Key *get_action_mesh_key(void); int get_nearest_key_num(struct Key *key, short *mval, float *x); -void snap_keys_to_frame(void); +void snap_keys_to_frame(int snap_mode); void clean_shapekeys(struct Key *key); void clean_actionchannels(struct bAction *act); /* Marker Operations */ -struct ListBase *get_saction_markers(struct SpaceAction *saction); -struct TimeMarker *find_nearest_saction_marker(struct ListBase *markers); -void get_minmax_saction_markers(struct ListBase *markers, float *first, float *last); -void add_saction_marker(struct ListBase *markers, int frame); -void duplicate_saction_markers(struct ListBase *markers); -void remove_saction_markers(struct ListBase *markers); -void rename_saction_markers(struct ListBase *markers); -void transform_saction_markers(int mode, int smode); -void deselect_saction_markers(struct ListBase *markers, short test, short sel); -void borderselect_saction_markers(struct ListBase *markers, float xmin, float xmax, int selectmode); -void nextprev_saction_markers(ListBase *markers, short dir); -void selectkeys_columns_markers(struct ListBase *markers); -void selectkeys_between_markers(struct ListBase *markers); +void get_minmax_saction_markers(float *first, float *last); +void selectkeys_columns_markers(void); +void selectkeys_between_markers(void); /* channel/strip operations */ void up_sel_action(void); diff --git a/source/blender/include/BIF_editnla.h b/source/blender/include/BIF_editnla.h index fafc95fb03f..88abf2f83f1 100644 --- a/source/blender/include/BIF_editnla.h +++ b/source/blender/include/BIF_editnla.h @@ -52,7 +52,7 @@ void shift_nlastrips_up(void); void shift_nlastrips_down(void); void reset_action_strips(int val); void synchronize_action_strips(void); -void snap_action_strips(void); +void snap_action_strips(int snap_mode); void add_nlablock(void); void copy_action_modifiers(void); diff --git a/source/blender/include/BSE_editipo.h b/source/blender/include/BSE_editipo.h index d102587a563..b7da37bb2e2 100644 --- a/source/blender/include/BSE_editipo.h +++ b/source/blender/include/BSE_editipo.h @@ -106,7 +106,7 @@ void sethandles_ipo(int code); void select_ipo_bezier_keys(struct Ipo *ipo, int selectmode); void set_ipotype(void); void borderselect_ipo(void); -void del_ipo(void); +void del_ipo(int need_check); void del_ipoCurve ( struct IpoCurve * icu ); void free_ipocopybuf(void); void copy_editipo(void); diff --git a/source/blender/include/BSE_time.h b/source/blender/include/BSE_time.h index 050006a08fc..b842da8015a 100644 --- a/source/blender/include/BSE_time.h +++ b/source/blender/include/BSE_time.h @@ -33,19 +33,28 @@ #ifndef BSE_TIME_H #define BSE_TIME_H -struct SpaceAction; +struct View2D; -/* ******** Markers ********* */ -void add_timeline_marker(int frame); -void duplicate_timeline_marker(void); -void remove_timeline_marker(void); -void rename_timeline_marker(void); -void select_timeline_markers(void); +/* ******** Markers - General Api ********* */ +void add_marker(int frame); +void duplicate_marker(void); +void remove_marker(void); +void rename_marker(void); +void transform_markers(int mode, int smode); +void deselect_markers(short test, short sel); +void borderselect_markers(float xmin, float xmax, int selectmode); +struct TimeMarker *find_nearest_marker(int clip_y); +void nextprev_marker(short dir); + +/* ******** Markers - Space Specific ************* */ +/* TimeLine Marker Stuff ----------------------------------- */ +void borderselect_timeline_markers(void); +/* Other Space Marker Stuff ----------------------------- */ +void draw_markers_timespace(struct View2D *v2d); + +/* *********** TimeLine Specific ***************/ void timeline_frame_to_center(void); void nextprev_timeline_key(short dir); -void nextprev_timeline_marker(short dir); -void timeline_grab(int mode, int smode); -void draw_markers_action(struct SpaceAction *sact); #endif diff --git a/source/blender/include/transform.h b/source/blender/include/transform.h index d91fe81d991..a5a2bacc6e0 100755 --- a/source/blender/include/transform.h +++ b/source/blender/include/transform.h @@ -300,6 +300,9 @@ int BoneSize(TransInfo *t, short mval[2]); void initBoneEnvelope(TransInfo *t); int BoneEnvelope(TransInfo *t, short mval[2]); +void initBoneRoll(TransInfo *t); +int BoneRoll(TransInfo *t, short mval[2]); + /*********************** transform_conversions.c ********** */ struct ListBase; void flushTransUVs(TransInfo *t); diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index ae476530cde..62e5ad1071d 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -697,7 +697,7 @@ void drawactionspace(ScrArea *sa, void *spacedata) draw_cfra_action(); /* Draw markers */ - draw_markers_action(G.saction); + draw_markers_timespace(&(G.saction->v2d)); /* Draw scroll */ mywinset(curarea->win); // reset scissor too diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index c2dc4139245..1137e2d3468 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -85,6 +85,7 @@ #include "BSE_editipo.h" #include "BSE_editipo_types.h" #include "BSE_editnla_types.h" +#include "BSE_time.h" #include "BPY_extern.h" @@ -2136,6 +2137,9 @@ void drawipospace(ScrArea *sa, void *spacedata) draw_ipohandles(1); draw_ipovertices(1); + /* draw markers */ + draw_markers_timespace(&(sipo->v2d)); + /* restore viewport */ mywinset(sa->win); diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index e831a2ef4ed..807568b0064 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -66,6 +66,7 @@ #include "BSE_drawipo.h" #include "BSE_editnla_types.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" #include "BIF_editnla.h" #include "BIF_gl.h" @@ -644,6 +645,7 @@ static void nla_blockhandlers(ScrArea *sa) void drawnlaspace(ScrArea *sa, void *spacedata) { + SpaceNla *snla= G.snla; float col[3]; short ofsx = 0, ofsy = 0; @@ -687,6 +689,9 @@ void drawnlaspace(ScrArea *sa, void *spacedata) glScissor(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1); myortho2 (G.v2d->cur.xmin, G.v2d->cur.xmax, G.v2d->cur.ymin, G.v2d->cur.ymax); draw_cfra_action(); + + /* draw markers */ + draw_markers_timespace(&(snla->v2d)); /* Draw scroll */ mywinset(curarea->win); // reset scissor too diff --git a/source/blender/src/drawsound.c b/source/blender/src/drawsound.c index adf3aacf9c4..c4849556683 100644 --- a/source/blender/src/drawsound.c +++ b/source/blender/src/drawsound.c @@ -55,6 +55,7 @@ #include "BIF_resources.h" #include "BSE_drawipo.h" +#include "BSE_time.h" #include "BMF_Api.h" /* local */ @@ -188,6 +189,7 @@ static void draw_cfra_sound(SpaceSound *ssound) void drawsoundspace(ScrArea *sa, void *spacedata) { + SpaceSound *ssound; float col[3]; short ofsx, ofsy; @@ -217,7 +219,9 @@ void drawsoundspace(ScrArea *sa, void *spacedata) draw_sample(G.ssound->sound->sample); } - draw_cfra_sound(spacedata); + ssound= spacedata; + draw_cfra_sound(ssound); + draw_markers_timespace(&(ssound->v2d)); /* restore viewport */ mywinset(curarea->win); diff --git a/source/blender/src/drawtime.c b/source/blender/src/drawtime.c index b81334dc73a..315d8d004a6 100644 --- a/source/blender/src/drawtime.c +++ b/source/blender/src/drawtime.c @@ -45,6 +45,8 @@ #include "DNA_scene_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" +#include "DNA_sound_types.h" +#include "DNA_view2d_types.h" #include "BKE_ipo.h" #include "BKE_object.h" @@ -162,7 +164,7 @@ static void draw_marker(TimeMarker *marker) } } -static void draw_markers_time( void ) +static void draw_markers_time(void) { TimeMarker *marker; @@ -179,17 +181,17 @@ static void draw_markers_time( void ) } } -void draw_markers_action(SpaceAction *sact) +void draw_markers_timespace(View2D *v2d) { TimeMarker *marker; float yspace, ypixels; /* move ortho view to align with slider in bottom */ - glTranslatef(0.0f, sact->v2d.cur.ymin, 0.0f); + glTranslatef(0.0f, v2d->cur.ymin, 0.0f); /* bad hacks in drawing markers... inverse correct that as well */ - yspace= sact->v2d.cur.ymax - sact->v2d.cur.ymin; - ypixels= sact->v2d.mask.ymax - sact->v2d.mask.ymin; + yspace= v2d->cur.ymax - v2d->cur.ymin; + ypixels= v2d->mask.ymax - v2d->mask.ymin; glTranslatef(0.0f, -11.0*yspace/ypixels, 0.0f); /* unselected markers are drawn at the first time */ @@ -203,12 +205,11 @@ void draw_markers_action(SpaceAction *sact) if(marker->flag & SELECT) draw_marker(marker); } - glTranslatef(0.0f, -sact->v2d.cur.ymin, 0.0f); + glTranslatef(0.0f, -v2d->cur.ymin, 0.0f); glTranslatef(0.0f, 11.0*yspace/ypixels, 0.0f); } - static void draw_sfra_efra() { BIF_ThemeColorShade(TH_BACK, -25); diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 279f2de6277..397d383edda 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -3278,7 +3278,7 @@ int play_anim(int mode) } } else if(event==MKEY) { - if(val) add_timeline_marker(CFRA-1); + if(val) add_marker(CFRA-1); } } if(ELEM3(event, ESCKEY, SPACEKEY, RIGHTMOUSE)) break; diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 09d10cec044..b39ece4eda4 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -85,6 +85,7 @@ #include "BSE_drawipo.h" #include "BSE_headerbuttons.h" #include "BSE_editipo.h" +#include "BSE_time.h" #include "BSE_trans_types.h" #include "BDR_editobject.h" @@ -601,18 +602,16 @@ static void mouse_action(int selectmode) bActionChannel *chan; bConstraintChannel *conchan; TimeMarker *marker; - ListBase *markers; short mval[2]; act=G.saction->action; if (!act) return; - markers= get_saction_markers(G.saction); getmouseco_areawin (mval); chan=get_nearest_actionchannel_key(&selx, &sel, &conchan); - marker=find_nearest_saction_marker(markers); + marker=find_nearest_marker(1); if (chan){ if (selectmode == SELECT_REPLACE) { @@ -644,7 +643,7 @@ static void mouse_action(int selectmode) else if (marker) { /* not channel, so maybe marker */ if (selectmode == SELECT_REPLACE) { - deselect_saction_markers(markers, 0, 0); + deselect_markers(0, 0); marker->flag |= SELECT; } else if (selectmode == SELECT_INVERT) { @@ -658,10 +657,13 @@ static void mouse_action(int selectmode) else if (selectmode == SELECT_SUBTRACT) marker->flag &= ~SELECT; - std_rmouse_transform(transform_saction_markers); + std_rmouse_transform(transform_markers); - allqueue(REDRAWACTION, 0); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } @@ -673,7 +675,6 @@ static void mouse_mesh_action(int selectmode, Key *key) IpoCurve *icu; TimeMarker *marker; - ListBase *markers; short sel; float selx; short mval[2]; @@ -685,8 +686,7 @@ static void mouse_mesh_action(int selectmode, Key *key) * data, etc) */ - markers= get_saction_markers(G.saction); - marker= find_nearest_saction_marker(markers); + marker= find_nearest_marker(1); /* get the click location, and the cooresponding * ipo curve and selection time value @@ -729,7 +729,7 @@ static void mouse_mesh_action(int selectmode, Key *key) else if (marker) { /* not channel, so maybe marker */ if (selectmode == SELECT_REPLACE) { - deselect_saction_markers(markers, 0, 0); + deselect_markers(0, 0); marker->flag |= SELECT; } else if (selectmode == SELECT_INVERT) { @@ -743,10 +743,13 @@ static void mouse_mesh_action(int selectmode, Key *key) else if (selectmode == SELECT_SUBTRACT) marker->flag &= ~SELECT; - std_rmouse_transform(transform_saction_markers); + std_rmouse_transform(transform_markers); - allqueue(REDRAWACTION, 0); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } @@ -759,22 +762,19 @@ void borderselect_action(void) bActionChannel *chan; bConstraintChannel *conchan; bAction *act; - ListBase *markers; float ymin, ymax; act=G.saction->action; if (!act) return; - - markers = get_saction_markers(G.saction); if ( (val = get_border(&rect, 3)) ){ if (val == LEFTMOUSE) selectmode = SELECT_ADD; else selectmode = SELECT_SUBTRACT; - + mval[0]= rect.xmin; mval[1]= rect.ymin+2; areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); @@ -782,6 +782,9 @@ void borderselect_action(void) mval[1]= rect.ymax-2; areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); + /* do markers first */ + borderselect_markers(rectf.xmin, rectf.xmax, selectmode); + /* if action is mapped in NLA, it returns a correction */ if(G.saction->pin==0 && OBACT) { rectf.xmin= get_action_frame(OBACT, rectf.xmin); @@ -814,22 +817,17 @@ void borderselect_action(void) } } - /* do markers first */ - if (markers != NULL) - borderselect_saction_markers(markers, rectf.xmin, rectf.xmax, selectmode); - - BIF_undo_push("Border Select Action"); - allqueue(REDRAWNLA, 0); - allqueue(REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); allqueue(REDRAWIPO, 0); - if (markers != NULL) allqueue(REDRAWTIME, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } void borderselect_mesh(Key *key) { - ListBase *markers; rcti rect; int val, adrcodemax, adrcodemin; short mval[2]; @@ -838,7 +836,6 @@ void borderselect_mesh(Key *key) int (*select_function)(BezTriple *); IpoCurve *icu; - markers = get_saction_markers(G.saction); if ( (val = get_border(&rect, 3)) ){ /* set the selection function based on what @@ -852,8 +849,8 @@ void borderselect_mesh(Key *key) else { selectmode = SELECT_SUBTRACT; select_function = select_bezier_subtract; - } - + } + /* get the minimum and maximum adrcode numbers * for the IpoCurves (this is the number that * relates an IpoCurve to the keyblock it @@ -868,7 +865,10 @@ void borderselect_mesh(Key *key) mval[1]= rect.ymax-2; adrcodemin = get_nearest_key_num(key, mval, &xmax); adrcodemin = (adrcodemin < 1) ? 1 : adrcodemin; - + + /* do markers first */ + borderselect_markers(rect.xmin, rect.xmax, selectmode); + /* Lets loop throug the IpoCurves and do borderselect * on the curves with adrcodes in our selected range. */ @@ -884,16 +884,13 @@ void borderselect_mesh(Key *key) } } - /* do markers too if any */ - if (markers != NULL) - borderselect_saction_markers(markers, xmin, xmax, selectmode); - /* redraw stuff */ BIF_undo_push("Border select Action Key"); - allqueue(REDRAWNLA, 0); - allqueue(REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); allqueue(REDRAWIPO, 0); - if (markers != NULL) allqueue(REDRAWTIME, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } @@ -2089,7 +2086,7 @@ static void set_snap_meshchannels(Key *key, short snaptype) } -void snap_keys_to_frame() +void snap_keys_to_frame(int snap_mode) { /* This function is the generic entry-point for snapping keyframes * to a frame(s). It passes the work off to sub-functions for the @@ -2099,26 +2096,20 @@ void snap_keys_to_frame() SpaceAction *saction; bAction *act; Key *key; - short event; /* get data */ saction= curarea->spacedata.first; if (!saction) return; act = saction->action; key = get_action_mesh_key(); - - /* find the type of snapping to do */ - if (act || key) - event = pupmenu("Snap Frames To%t|Nearest Frame%x1|Current Frame%x2"); - else return; - + /* handle events */ - switch (event) { + switch (snap_mode) { case 1: /* snap to nearest frame */ if (act) - set_snap_actionchannels(act, event); + set_snap_actionchannels(act, snap_mode); else - set_snap_meshchannels(key, event); + set_snap_meshchannels(key, snap_mode); /* Clean up and redraw stuff */ remake_action_ipos (act); @@ -2131,9 +2122,9 @@ void snap_keys_to_frame() break; case 2: /* snap to current frame */ if (act) - set_snap_actionchannels(act, event); + set_snap_actionchannels(act, snap_mode); else - set_snap_meshchannels(key, event); + set_snap_meshchannels(key, snap_mode); /* Clean up and redraw stuff */ remake_action_ipos (act); @@ -2435,12 +2426,12 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) extern void do_actionbuts(unsigned short event); // drawaction.c SpaceAction *saction; bAction *act; - ListBase *markers; Key *key; float dx,dy; int doredraw= 0; int cfra; short mval[2]; + short nr; unsigned short event= evt->event; short val= evt->val; short mousebut = L_MOUSE; @@ -2450,8 +2441,6 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) saction= curarea->spacedata.first; if (!saction) return; - - markers = get_saction_markers(saction); act=saction->action; if(val) { @@ -2489,9 +2478,12 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } else { if (G.qual == LR_CTRLKEY) { - deselect_saction_markers(markers, 1, 0); - allqueue(REDRAWACTION, 0); + deselect_markers(1, 0); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } else { deselect_meshchannel_keys(key, 1); @@ -2511,9 +2503,12 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } else if (mval[0]>ACTWIDTH) { if (G.qual == LR_CTRLKEY) { - deselect_saction_markers(markers, 1, 0); - allqueue(REDRAWACTION, 0); + deselect_markers (1, 0); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } else { deselect_actionchannel_keys (act, 1); @@ -2579,26 +2574,34 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case DKEY: - if (key) { - if (G.qual & LR_SHIFTKEY && mval[0]>ACTWIDTH) { - duplicate_meshchannel_keys(key); + if (mval[0]>ACTWIDTH) { + if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) { + duplicate_marker(); } - } - else if (act) { - if (G.qual & LR_SHIFTKEY && mval[0]>ACTWIDTH){ - duplicate_actionchannel_keys(); - remake_action_ipos(act); + else if (G.qual == LR_SHIFTKEY) { + if (key) { + duplicate_meshchannel_keys(key); + } + else if (act) { + duplicate_actionchannel_keys(); + remake_action_ipos(act); + } } } break; case GKEY: - if (mval[0]>=ACTWIDTH) { - if (key) { - transform_meshchannel_keys('g', key); - } - else if (act) { - transform_actionchannel_keys ('g', 0); + if (G.qual & LR_SHIFTKEY) { + transform_markers('g', 0); + } + else { + if (mval[0]>=ACTWIDTH) { + if (key) { + transform_meshchannel_keys('g', key); + } + else if (act) { + transform_actionchannel_keys ('g', 0); + } } } break; @@ -2636,25 +2639,17 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case MKEY: /* marker operations */ - if (markers != NULL) { - if (G.qual == 0) - add_saction_marker(markers, CFRA); - else if (G.qual == LR_ALTKEY) { - if( okee("Erase selected markers")==0 ) - break; - remove_saction_markers(markers); - } - else if (G.qual == LR_CTRLKEY) - rename_saction_markers(markers); - else if (G.qual == LR_SHIFTKEY) - transform_saction_markers('g', 0); - else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) - duplicate_saction_markers(markers); - else - break; - allqueue(REDRAWACTION, 0); - allqueue(REDRAWTIME, 0); - } + if (G.qual == 0) + add_marker(CFRA); + else if (G.qual == LR_SHIFTKEY) + rename_marker(); + else + break; + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; case NKEY: @@ -2677,7 +2672,8 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case SKEY: if (mval[0]>=ACTWIDTH) { if(G.qual & LR_SHIFTKEY) { - snap_keys_to_frame(); + val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2"); + snap_keys_to_frame(val); } else { if (key) @@ -2713,7 +2709,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case PAGEUPKEY: if (key) { /* only jump to markers possible (key channels can't be moved yet) */ - nextprev_saction_markers(markers, 1); + nextprev_marker(1); } else { if(G.qual & LR_SHIFTKEY) @@ -2721,13 +2717,13 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) else if (G.qual & LR_CTRLKEY) up_sel_action(); else - nextprev_saction_markers(markers, 1); + nextprev_marker(1); } break; case PAGEDOWNKEY: if (key) { /* only jump to markers possible (key channels can't be moved yet) */ - nextprev_saction_markers(markers, -1); + nextprev_marker(-1); } else { if(G.qual & LR_SHIFTKEY) @@ -2735,19 +2731,33 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) else if (G.qual & LR_CTRLKEY) down_sel_action(); else - nextprev_saction_markers(markers, -1); + nextprev_marker(-1); } break; case DELKEY: case XKEY: - if (key) { - delete_meshchannel_keys(key); - } - else { - if (mval[0]<NAMEWIDTH) - delete_actionchannels (); - else - delete_actionchannel_keys (); + nr= pupmenu("Erase selected%t|Keys %x1|Markers %x2|Both %x3"); + if (nr>0) { + if (nr==1||nr==3) { + if (key) { + delete_meshchannel_keys(key); + } + else { + if (mval[0]<NAMEWIDTH) + delete_actionchannels(); + else + delete_actionchannel_keys(); + } + } + if (nr==2) { + remove_marker(); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } } break; /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above, @@ -2913,351 +2923,14 @@ int get_nearest_key_num(Key *key, short *mval, float *x) { } /* ************************************* Action Editor Markers ************************************* */ - -/* returns the current active markers */ -ListBase *get_saction_markers (SpaceAction *saction) -{ - ListBase *markers; - -// if (saction->markert == SACTION_SCMARKERS) - markers = &(G.scene->markers); -// else if ((saction->markert == SACTION_ACMARKERS) && (saction->action != NULL)) -// markers = &(saction->action->markers); -// else -// markers = NULL; - - return markers; -} - -/* add a TimeMarker - code basically taken from edittime.c */ -void add_saction_marker (ListBase *markers, int frame) -{ - TimeMarker *marker; - - if (markers == NULL) - return; - - /* two markers can't be at the same place */ - for(marker= markers->first; marker; marker= marker->next) - if(marker->frame == frame) return; - /* deselect all */ - for(marker= markers->first; marker; marker= marker->next) - marker->flag &= ~SELECT; - - marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); - marker->flag= SELECT; - marker->frame= frame; - BLI_addtail(markers, marker); - - BIF_undo_push("Add Marker"); -} - -/* remove a TimeMarker - code basically taken from edittime.c */ -void remove_saction_markers(ListBase *markers) -{ - TimeMarker *marker; - - if (markers == NULL) - return; - - for(marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT){ - BLI_freelinkN(markers, marker); - } - } - - BIF_undo_push("Remove Marker"); -} - -/* rename a TimeMarker - code basically taken from edittime.c */ -void rename_saction_markers(ListBase *markers) +void get_minmax_saction_markers(float *first, float *last) { TimeMarker *marker; - char name[64]; - - if (markers == NULL) - return; - - for(marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - sprintf(name, marker->name); - if (sbutton(name, 0, sizeof(name)-1, "Name: ")) - BLI_strncpy(marker->name, name, sizeof(marker->name)); - break; - } - } - - BIF_undo_push("Rename Marker"); -} - -/* duplicate selected TimeMarkers - code basically taken from edittime.c */ -void duplicate_saction_markers(ListBase *markers) -{ - TimeMarker *marker, *newmarker; - - if (markers == NULL) - return; - - /* go through the list of markers, duplicate selected markers and add duplicated copies - * to the begining of the list (unselect original markers) */ - for(marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT){ - /* unselect selected marker */ - marker->flag &= ~SELECT; - /* create and set up new marker */ - newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); - newmarker->flag= SELECT; - newmarker->frame= marker->frame; - BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name)); - /* new marker is added to the begining of list */ - BLI_addhead(markers, newmarker); - } - } - - transform_saction_markers('g', 0); -} - -void transform_saction_markers(int mode, int smode) // mode and smode unused here, for callback -{ - SpaceAction *saction= curarea->spacedata.first; - TimeMarker *marker, *selmarker=NULL; ListBase *markers; - float dx, fac; - int a, ret_val= 0, totmark=0, *oldframe, offs, firsttime=1; - unsigned short event; - short val, pmval[2], mval[2], mvalo[2]; - char str[32]; - - markers= get_saction_markers(saction); - if (markers == NULL) return; - - for(marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT) totmark++; - } - if(totmark==0) return; - - oldframe= MEM_mallocN(totmark*sizeof(int), "marker array"); - for(a=0, marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - oldframe[a]= marker->frame; - selmarker= marker; // used for hederprint - a++; - } - } - - dx= G.v2d->mask.xmax-G.v2d->mask.xmin; - dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/dx; - - getmouseco_areawin(pmval); - mvalo[0]= pmval[0]; - - while(ret_val == 0) { - - getmouseco_areawin(mval); - - if (mval[0] != mvalo[0] || firsttime) { - mvalo[0]= mval[0]; - firsttime= 0; - - fac= (((float)(mval[0] - pmval[0]))*dx); - - apply_keyb_grid(&fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); - offs= (int)fac; - - for(a=0, marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - marker->frame= oldframe[a] + offs; - a++; - } - } - - if(totmark==1) // we print current marker value - sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); - else - sprintf(str, "Marker offset %.2f ", (double)(offs)); - - headerprint(str); - - force_draw(0); // areas identical to this, 0 = no header - } - else PIL_sleep_ms(10); // idle - - /* emptying queue and reading events */ - while( qtest() ) { - event= extern_qread(&val); - - if(val) { - if(event==ESCKEY || event==RIGHTMOUSE) ret_val= 2; - else if(event==LEFTMOUSE || event==RETKEY || event==SPACEKEY) ret_val= 1; - } - } - } - - /* restore? */ - if(ret_val==2) { - for(a=0, marker= markers->first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - marker->frame= oldframe[a]; - a++; - } - } - } - else { - BIF_undo_push("Move Markers"); - } - MEM_freeN(oldframe); - allqueue(REDRAWACTION, 0); - allqueue(REDRAWTIME, 0); -} - -TimeMarker *find_nearest_saction_marker(ListBase *markers) -{ - TimeMarker *marker; - float xmin, xmax; - rctf rectf; - short mval[2]; - - if (markers == NULL) - return NULL; - - getmouseco_areawin (mval); - - /* first clip selection in Y */ - if(mval[1] > 30) - return NULL; - - mval[0]-=7; - areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); - mval[0]+=14; - areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); - - xmin= rectf.xmin; - xmax= rectf.xmax; - - for(marker= markers->first; marker; marker= marker->next) { - if ((marker->frame > xmin) && (marker->frame <= xmax)) { - return marker; - } - } - - return NULL; -} - -/* select next/previous marker */ -void nextprev_saction_markers(ListBase *markers, short dir) -{ - TimeMarker *marker, *cur=NULL, *first, *last; - int mindist= MAXFRAME, dist; - - if (markers == NULL) - return; - - first= last= markers->first; - for(marker= markers->first; marker; marker= marker->next) { - /* find closest to current frame first */ - dist= (marker->frame/G.scene->r.framelen) - CFRA; - if(dir==1 && dist>0 && dist<mindist) { - mindist= dist; - cur= marker; - } - else if(dir==-1 && dist<0 && -dist<mindist) { - mindist= -dist; - cur= marker; - } - /* find first/last */ - if(marker->frame > last->frame) last= marker; - if(marker->frame < first->frame) first= marker; - } - - if(cur==NULL) { - if(dir==1) cur= first; - else cur= last; - } - if(cur) { - CFRA= cur->frame/G.scene->r.framelen; - update_for_newframe(); - allqueue(REDRAWALL, 0); - } -} - -/* select/deselect all TimeMarkers */ -void deselect_saction_markers(ListBase *markers, short test, short sel) -{ - TimeMarker *marker; - - if (markers == NULL) - return; - - /* check if need to find out whether to how to select markers */ - if (test) { - /* dependant on existing selection */ - /* determine if select all or deselect all */ - sel = 1; - for (marker= markers->first; marker; marker= marker->next) { - if (marker->flag & SELECT) { - sel = 0; - break; - } - } - - /* do selection */ - for (marker= markers->first; marker; marker= marker->next) { - if (sel) { - if ((marker->flag & SELECT)==0) - marker->flag |= SELECT; - } - else { - if (marker->flag & SELECT) - marker->flag &= ~SELECT; - } - } - } - else { - /* not dependant on existing selection */ - for (marker= markers->first; marker; marker= marker->next) { - if (sel) { - if ((marker->flag & SELECT)==0) - marker->flag |= SELECT; - } - else { - if (marker->flag & SELECT) - marker->flag &= ~SELECT; - } - } - } -} - -void borderselect_saction_markers(ListBase *markers, float xmin, float xmax, int selectmode) -{ - TimeMarker *marker; - - if (markers == NULL) - return; - - for(marker= markers->first; marker; marker= marker->next) { - if ((marker->frame > xmin) && (marker->frame <= xmax)) { - switch (selectmode) { - case SELECT_ADD: - if ((marker->flag & SELECT) == 0) - marker->flag |= SELECT; - break; - case SELECT_SUBTRACT: - if (marker->flag & SELECT) - marker->flag &= ~SELECT; - break; - } - } - } -} - -void get_minmax_saction_markers(ListBase *markers, float *first, float *last) -{ - TimeMarker *marker; float min, max; - if (!markers) - return; - + markers= &(G.scene->markers); + min= ((TimeMarker *)markers->first)->frame; max= ((TimeMarker *)markers->last)->frame; diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c index 408992545b9..19671b3315b 100644 --- a/source/blender/src/editipo.c +++ b/source/blender/src/editipo.c @@ -111,6 +111,7 @@ #include "BSE_headerbuttons.h" #include "BSE_node.h" #include "BSE_sequence.h" +#include "BSE_time.h" #include "blendef.h" #include "mydevice.h" @@ -1360,6 +1361,7 @@ void mouse_select_ipo(void) IpoCurve *icu; IpoKey *ik, *actik; BezTriple *bezt; + TimeMarker *marker; float x, y, dist, mindist; int a, oldflag = 0, hand, ok; short mval[2], xo, yo; @@ -1367,6 +1369,7 @@ void mouse_select_ipo(void) if(G.sipo->editipo==0) return; get_status_editipo(); + marker=find_nearest_marker(1); if(G.sipo->showkey) { getmouseco_areawin(mval); @@ -1435,6 +1438,21 @@ void mouse_select_ipo(void) } } } + else if (marker) { + /* select timeline marker */ + if ((G.qual & LR_SHIFTKEY)==0) { + oldflag= marker->flag; + deselect_markers(0, 0); + + if (oldflag & SELECT) + marker->flag &= ~SELECT; + else + marker->flag |= SELECT; + } + else { + marker->flag |= SELECT; + } + } else { /* vertex keys ? */ @@ -1532,8 +1550,13 @@ void mouse_select_ipo(void) getmouseco_areawin(mval); if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) { - if(actkb) move_keys(OBACT); - else transform_ipo('g'); + if (marker) { + transform_markers('g', 0); + } + else { + if(actkb) move_keys(OBACT); + else transform_ipo('g'); + } return; } @@ -3581,7 +3604,7 @@ void del_ipoCurve ( IpoCurve * icu ) } } -void del_ipo(void) +void del_ipo(int need_check) { EditIpo *ei; BezTriple *bezt, *bezt1; @@ -3592,12 +3615,17 @@ void del_ipo(void) if(G.sipo->ipo && G.sipo->ipo->id.lib) return; if(totipo_edit==0 && totipo_sel==0 && totipo_vertsel==0) { - if(okee("Erase selected keys")) - delete_key(OBACT); + if (need_check) { + if(okee("Erase selected keys")) + delete_key(OBACT); + } + else + delete_key(OBACT); return; } - if( okee("Erase selected")==0 ) return; + if (need_check) + if( okee("Erase selected")==0 ) return; // first round, can we delete entire parts? ei= G.sipo->editipo; diff --git a/source/blender/src/editipo_mods.c b/source/blender/src/editipo_mods.c index 581d293b079..9b8c64d4c36 100644 --- a/source/blender/src/editipo_mods.c +++ b/source/blender/src/editipo_mods.c @@ -67,6 +67,7 @@ #include "BSE_editipo.h" #include "BSE_drawipo.h" #include "BSE_trans_types.h" +#include "BSE_time.h" #include "BDR_drawobject.h" @@ -771,7 +772,10 @@ void borderselect_ipo(void) mval[0]= rect.xmax; mval[1]= rect.ymax; areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); - + + /* do markers first */ + borderselect_markers(rectf.xmin, rectf.xmax, val); + if(G.sipo->showkey) { ik= G.sipo->ipokey.first; while(ik) { @@ -812,7 +816,11 @@ void borderselect_ipo(void) } } BIF_undo_push("Border select Ipo"); - scrarea_queue_winredraw(curarea); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 6bb42502f5a..2e3cf1a4242 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -81,6 +81,7 @@ #include "BSE_filesel.h" #include "BDR_editobject.h" #include "BSE_drawnla.h" +#include "BSE_time.h" #include "blendef.h" #include "mydevice.h" @@ -229,7 +230,7 @@ void reset_action_strips(int val) allqueue (REDRAWNLA, 0); } -void snap_action_strips(void) +void snap_action_strips(int snap_mode) { Base *base; bActionStrip *strip; @@ -237,8 +238,25 @@ void snap_action_strips(void) for (base=G.scene->base.first; base; base=base->next) { for (strip = base->object->nlastrips.last; strip; strip=strip->prev) { if (strip->flag & ACTSTRIP_SELECT) { - strip->start= floor(strip->start+0.5); - strip->end= floor(strip->end+0.5); + if (snap_mode==1) { + /* nearest frame */ + strip->start= floor(strip->start+0.5); + strip->end= floor(strip->end+0.5); + } + else if (snap_mode==2) { + /* current frame */ + float diff; + if (CFRA < strip->start) { + diff = (strip->start - CFRA); + strip->start -= diff; + strip->end -= diff; + } + else { + diff = (CFRA - strip->start); + strip->start += diff; + strip->end += diff; + } + } } } } @@ -953,10 +971,7 @@ void delete_nlachannel_keys(void) bActionChannel *chan; bConstraintChannel *conchan; bActionStrip *strip, *nextstrip; - - if (!okee("Erase selected strips and/or keys")) - return; - + for (base = G.scene->base.first; base; base=base->next){ /* Delete object ipos */ @@ -1059,11 +1074,11 @@ void borderselect_nla(void) bConstraintChannel *conchan; if ( (val = get_border (&rect, 3)) ){ - if (val == LEFTMOUSE) - selectmode = SELECT_ADD; - else - selectmode = SELECT_SUBTRACT; - + if (val == LEFTMOUSE) + selectmode = SELECT_ADD; + else + selectmode = SELECT_SUBTRACT; + mval[0]= rect.xmin; mval[1]= rect.ymin+2; areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); @@ -1071,6 +1086,9 @@ void borderselect_nla(void) mval[1]= rect.ymax-2; areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); + /* do markers first */ + borderselect_markers(rectf.xmin, rectf.xmax, selectmode); + ymax = count_nla_levels(); ymax*= (NLACHANNELHEIGHT+NLACHANNELSKIP); ymax+= (NLACHANNELHEIGHT+NLACHANNELSKIP)/2; @@ -1136,9 +1154,11 @@ void borderselect_nla(void) } } BIF_undo_push("Border select NLA"); - allqueue(REDRAWNLA, 0); - allqueue(REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } } @@ -1150,6 +1170,7 @@ static void mouse_nla(int selectmode) bActionChannel *chan; bActionStrip *rstrip; bConstraintChannel *conchan; + TimeMarker *marker; float selx; short mval[2]; short sel, isdone=0; @@ -1158,6 +1179,7 @@ static void mouse_nla(int selectmode) /* Try object ipo or ob-constraint ipo selection */ base= get_nearest_nlachannel_ob_key(&selx, &sel); + marker=find_nearest_marker(1); if (base) { isdone= 1; @@ -1172,6 +1194,31 @@ static void mouse_nla(int selectmode) for (conchan=base->object->constraintChannels.first; conchan; conchan=conchan->next) select_ipo_key(conchan->ipo, selx, selectmode); } + else if (marker) { + /* marker */ + if (selectmode == SELECT_REPLACE) { + deselect_markers(0, 0); + marker->flag |= SELECT; + } + else if (selectmode == SELECT_INVERT) { + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + else + marker->flag |= SELECT; + } + else if (selectmode == SELECT_ADD) + marker->flag |= SELECT; + else if (selectmode == SELECT_SUBTRACT) + marker->flag &= ~SELECT; + + std_rmouse_transform(transform_markers); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } else { /* Try action ipo selection */ act= get_nearest_nlachannel_ac_key(&selx, &sel); @@ -1606,21 +1653,53 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case EQUALKEY: - case PAGEUPKEY: shift_nlastrips_up(); break; + + case PAGEUPKEY: + if (G.qual & LR_CTRLKEY) + shift_nlastrips_up(); + else { + nextprev_marker(1); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + break; case MINUSKEY: - case PAGEDOWNKEY: shift_nlastrips_down(); break; + case PAGEDOWNKEY: + if (G.qual & LR_CTRLKEY) + shift_nlastrips_down(); + else { + nextprev_marker(-1); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + break; + case AKEY: if (G.qual & LR_SHIFTKEY){ add_nlablock(); allqueue (REDRAWNLA, 0); allqueue (REDRAWVIEW3D, 0); } + else if (G.qual & LR_CTRLKEY) { + deselect_markers(1, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } else{ if (mval[0]>=NLAWIDTH) deselect_nlachannel_keys(1); @@ -1656,18 +1735,48 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case DKEY: - if (G.qual & LR_SHIFTKEY && mval[0]>=NLAWIDTH){ + if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY) && mval[0]>=NLAWIDTH) { + duplicate_marker(); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + else if (G.qual & LR_SHIFTKEY && mval[0]>=NLAWIDTH){ duplicate_nlachannel_keys(); update_for_newframe_muted(); } + break; case GKEY: - if (mval[0]>=NLAWIDTH) - transform_nlachannel_keys ('g', 0); - update_for_newframe_muted(); + if (mval[0]>=NLAWIDTH) { + if (G.qual & LR_SHIFTKEY) { + transform_markers('g', 0); + } + else { + transform_nlachannel_keys ('g', 0); + update_for_newframe_muted(); + } + } break; - + + case MKEY: + /* marker operations */ + if (G.qual == 0) + add_marker(CFRA); + else if (G.qual == LR_SHIFTKEY) + rename_marker(); + else + break; + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; + case NKEY: if(G.qual==0) { toggle_blockhandler(curarea, NLA_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE); @@ -1687,8 +1796,9 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) reset_action_strips(2); } else if(G.qual & LR_SHIFTKEY) { - if(okee("Snap Strips to Frame")) - snap_action_strips(); + val= pupmenu("Snap To%t|Nearest Frame%x1|Current Frame%x2"); + if (val==1 || val==2) + snap_action_strips(val); } else { if (mval[0]>=NLAWIDTH) @@ -1699,10 +1809,22 @@ void winqreadnlaspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case DELKEY: case XKEY: - if (mval[0]>=NLAWIDTH) - delete_nlachannel_keys (); - - update_for_newframe_muted(); + if (mval[0]>=NLAWIDTH) { + val= pupmenu("Erase selected%t|Strips and/or Keys%x1|Markers%x2"); + if (val==1) { + delete_nlachannel_keys(); + update_for_newframe_muted(); + } + else if (val==2) { + remove_marker(); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + } break; /* LEFTMOUSE and RIGHTMOUSE event codes can be swapped above, diff --git a/source/blender/src/editsound.c b/source/blender/src/editsound.c index bd209f2d39c..365c26ee255 100644 --- a/source/blender/src/editsound.c +++ b/source/blender/src/editsound.c @@ -73,9 +73,13 @@ #include "BIF_interface.h" #include "BIF_editsound.h" #include "BIF_mywindow.h" +#include "BIF_toolbox.h" #include "BSE_drawipo.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" + +#include "BDR_editobject.h" #include "blendef.h" @@ -163,14 +167,28 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt) view2dmove(event); /* in drawipo.c */ break; case RIGHTMOUSE: - nr= pupmenu("Time value%t|Frames %x1|Seconds%x2"); - if (nr>0) { - if(nr==1) ssound->flag |= SND_DRAWFRAMES; - else ssound->flag &= ~SND_DRAWFRAMES; - doredraw= 1; - } + { + TimeMarker *marker; + + getmouseco_areawin(mval); + areamouseco_to_ipoco(G.v2d, mval, &dx, &dy); + marker = find_nearest_marker(0); + if (marker) { + if ((G.qual & LR_SHIFTKEY)==0) + deselect_markers(0, 0); + + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + else + marker->flag |= SELECT; + } + + force_draw(0); + std_rmouse_transform(transform_markers); + } break; + case PADPLUSKEY: dx= (float)(0.1154*(G.v2d->cur.xmax-G.v2d->cur.xmin)); G.v2d->cur.xmin+= dx; @@ -190,6 +208,85 @@ void winqreadsoundspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case HOMEKEY: do_sound_buttons(B_SOUNDHOME); break; + + case PAGEUPKEY: /* cfra to next marker */ + nextprev_marker(1); + break; + case PAGEDOWNKEY: /* cfra to prev marker */ + nextprev_marker(-1); + break; + + case AKEY: /* select/deselect all */ + deselect_markers(1, 0); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; + + case BKEY: /* borderselect markers */ + borderselect_timeline_markers(); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; + + case DKEY: /* duplicate selected marker(s) */ + if (G.qual & LR_SHIFTKEY) { + duplicate_marker(); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + break; + + case GKEY: + transform_markers('g', 0); + break; + + case MKEY: /* add marker or rename first selected */ + if (G.qual & LR_SHIFTKEY) + rename_marker(); + else + add_marker(CFRA); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; + + case TKEY: /* toggle time display */ + nr= pupmenu("Time value%t|Frames %x1|Seconds%x2"); + if (nr>0) { + if(nr==1) ssound->flag |= SND_DRAWFRAMES; + else ssound->flag &= ~SND_DRAWFRAMES; + doredraw= 1; + } + + break; + + case DELKEY: /* delete selected markers */ + case XKEY: + if (okee("Erase selected")) { + remove_marker(); + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + break; } } diff --git a/source/blender/src/edittime.c b/source/blender/src/edittime.c index 919508aec0d..a92efac3034 100644 --- a/source/blender/src/edittime.c +++ b/source/blender/src/edittime.c @@ -63,8 +63,10 @@ #include "BIF_interface.h" #include "BIF_toolbox.h" #include "BIF_mywindow.h" +#include "BIF_editaction.h" #include "BSE_drawipo.h" +#include "BSE_edit.h" #include "BSE_headerbuttons.h" #include "BSE_time.h" @@ -79,10 +81,10 @@ /* declarations */ void winqreadtimespace(ScrArea *, void *, BWinEvent *); -/* ************* Timeline marker code **************** */ +/* ************* Marker API **************** */ /* add TimeMarker at curent frame */ -void add_timeline_marker(int frame) +void add_marker(int frame) { TimeMarker *marker; @@ -98,29 +100,29 @@ void add_timeline_marker(int frame) marker->frame= frame; BLI_addtail(&(G.scene->markers), marker); - BIF_undo_push("Add Timeline Marker"); + BIF_undo_push("Add Marker"); } -/* remove TimeMarker */ -void remove_timeline_marker(void) +/* remove selected TimeMarkers */ +void remove_marker(void) { TimeMarker *marker; - + for(marker= G.scene->markers.first; marker; marker= marker->next) { if(marker->flag & SELECT){ - BLI_freelinkN(&G.scene->markers, marker); + BLI_freelinkN(&(G.scene->markers), marker); } } - BIF_undo_push("Remove Timeline Marker"); + BIF_undo_push("Remove Marker"); } /* rename first selected TimeMarker */ -void rename_timeline_marker(void) +void rename_marker(void) { TimeMarker *marker; char name[64]; - + for(marker= G.scene->markers.first; marker; marker= marker->next) { if(marker->flag & SELECT) { sprintf(name, marker->name); @@ -130,14 +132,14 @@ void rename_timeline_marker(void) } } - BIF_undo_push("Rename Timeline Marker"); + BIF_undo_push("Rename Marker"); } /* duplicate selected TimeMarkers */ -void duplicate_timeline_marker(void) +void duplicate_marker(void) { TimeMarker *marker, *newmarker; - + /* go through the list of markers, duplicate selected markers and add duplicated copies * to the begining of the list (unselect original markers) */ for(marker= G.scene->markers.first; marker; marker= marker->next) { @@ -154,72 +156,194 @@ void duplicate_timeline_marker(void) } } - timeline_grab('g', 0); + transform_markers('g', 0); } - - -static int find_nearest_marker(float dx) +void transform_markers(int mode, int smode) // mode and smode unused here, for callback { - TimeMarker *marker, *nearest= NULL; - float dist, min_dist= 1000000; + SpaceLink *slink= curarea->spacedata.first; + SpaceTime *stime= curarea->spacedata.first; + TimeMarker *marker, *selmarker=NULL; + float dx, fac; + int a, ret_val= 0, totmark=0, *oldframe, offs, firsttime=1; + unsigned short event; + short val, pmval[2], mval[2], mvalo[2]; + char str[32]; for(marker= G.scene->markers.first; marker; marker= marker->next) { - dist = ABS((float)marker->frame - dx); - if(dist < min_dist){ - min_dist= dist; - nearest= marker; + if(marker->flag & SELECT) totmark++; + } + if(totmark==0) return; + + oldframe= MEM_mallocN(totmark*sizeof(int), "marker array"); + for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { + if(marker->flag & SELECT) { + oldframe[a]= marker->frame; + selmarker= marker; // used for hederprint + a++; } } - if(nearest) return nearest->frame; - else return (int)floor(dx); + dx= G.v2d->mask.xmax-G.v2d->mask.xmin; + dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/dx; + + getmouseco_areawin(pmval); + mvalo[0]= pmval[0]; + + while(ret_val == 0) { + + getmouseco_areawin(mval); + + if (mval[0] != mvalo[0] || firsttime) { + mvalo[0]= mval[0]; + firsttime= 0; + + fac= (((float)(mval[0] - pmval[0]))*dx); + + if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND)) + apply_keyb_grid(&fac, 0.0, (float)G.scene->r.frs_sec, 0.1*(float)G.scene->r.frs_sec, 0); + else + apply_keyb_grid(&fac, 0.0, 1.0, 0.1, U.flag & USER_AUTOGRABGRID); + offs= (int)fac; + + for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { + if(marker->flag & SELECT) { + marker->frame= oldframe[a] + offs; + a++; + } + } + + if(totmark==1) { // we print current marker value + if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND)) { + if(stime->flag & TIME_DRAWFRAMES) + sprintf(str, "Marker %d offset %d", selmarker->frame, offs); + else + sprintf(str, "Marker %.2f offset %.2f", (selmarker->frame/(float)G.scene->r.frs_sec), (offs/(float)G.scene->r.frs_sec)); + } + else { + sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs)); + } + } + else { + if (ELEM(slink->spacetype, SPACE_TIME, SPACE_SOUND)) { + if(stime->flag & TIME_DRAWFRAMES) + sprintf(str, "Marker offset %d ", offs); + else + sprintf(str, "Marker offset %.2f ", (offs/(float)G.scene->r.frs_sec)); + } + else { + sprintf(str, "Marker offset %.2f ", (double)(offs)); + } + } + headerprint(str); + + force_draw(0); // areas identical to this, 0 = no header + } + else PIL_sleep_ms(10); // idle + + /* emptying queue and reading events */ + while( qtest() ) { + event= extern_qread(&val); + + if(val) { + if(event==ESCKEY || event==RIGHTMOUSE) ret_val= 2; + else if(event==LEFTMOUSE || event==RETKEY || event==SPACEKEY) ret_val= 1; + } + } + } + + /* restore? */ + if(ret_val==2) { + for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { + if(marker->flag & SELECT) { + marker->frame= oldframe[a]; + a++; + } + } + } + else { + BIF_undo_push("Move Markers"); + } + MEM_freeN(oldframe); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } -/* select/deselect TimeMarker at current frame */ -static void select_timeline_marker_frame(int frame, unsigned char shift) +/* select/deselect all TimeMarkers + * test - based on current selections? + * sel - selection status to set all markers to if blanket apply status + */ +void deselect_markers(short test, short sel) { TimeMarker *marker; - int select=0; - - for(marker= G.scene->markers.first; marker; marker= marker->next) { - /* if Shift is not set, then deselect Markers */ - if(!shift) marker->flag &= ~SELECT; - /* this way a not-shift select will allways give 1 selected marker */ - if((marker->frame == frame) && (!select)) { - if(marker->flag & SELECT) - marker->flag &= ~SELECT; - else - marker->flag |= SELECT; - select = 1; + + /* check if need to find out whether to how to select markers */ + if (test) { + /* dependant on existing selection */ + /* determine if select all or deselect all */ + sel = 1; + for (marker= G.scene->markers.first; marker; marker= marker->next) { + if (marker->flag & SELECT) { + sel = 0; + break; + } + } + + /* do selection */ + for (marker= G.scene->markers.first; marker; marker= marker->next) { + if (sel) { + if ((marker->flag & SELECT)==0) + marker->flag |= SELECT; + } + else { + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + } + } + } + else { + /* not dependant on existing selection */ + for (marker= G.scene->markers.first; marker; marker= marker->next) { + if (sel) { + if ((marker->flag & SELECT)==0) + marker->flag |= SELECT; + } + else { + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + } } } } -/* select/deselect all TimeMarkers */ -void select_timeline_markers(void) +void borderselect_markers(float xmin, float xmax, int selectmode) { TimeMarker *marker; - char any_selected= 0; - + for(marker= G.scene->markers.first; marker; marker= marker->next) { - if(marker->flag & SELECT) any_selected= 1; - marker->flag &= ~SELECT; - } - - /* no TimeMarker selected, then select all TimeMarkers */ - if(!any_selected){ - for(marker= G.scene->markers.first; marker; marker= marker->next) { - marker->flag |= SELECT; + if ((marker->frame > xmin) && (marker->frame <= xmax)) { + switch (selectmode) { + case SELECT_ADD: + if ((marker->flag & SELECT) == 0) + marker->flag |= SELECT; + break; + case SELECT_SUBTRACT: + if (marker->flag & SELECT) + marker->flag &= ~SELECT; + break; + } } } } -void nextprev_timeline_marker(short dir) +void nextprev_marker(short dir) { TimeMarker *marker, *cur=NULL, *first, *last; int mindist= MAXFRAME, dist; - + first= last= G.scene->markers.first; for(marker= G.scene->markers.first; marker; marker= marker->next) { /* find closest to current frame first */ @@ -248,7 +372,109 @@ void nextprev_timeline_marker(short dir) } } -/* *********** end Markers *************** */ +TimeMarker *find_nearest_marker(int clip_y) +{ + TimeMarker *marker; + float xmin, xmax; + rctf rectf; + short mval[2]; + + getmouseco_areawin (mval); + + /* first clip selection in Y */ + if((clip_y) && (mval[1] > 30)) + return NULL; + + mval[0]-=7; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); + mval[0]+=14; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); + + xmin= rectf.xmin; + xmax= rectf.xmax; + + for(marker= G.scene->markers.first; marker; marker= marker->next) { + if ((marker->frame > xmin) && (marker->frame <= xmax)) { + return marker; + } + } + + return NULL; +} + +/* *********** End Markers - Markers API *************** */ + +/* border-select markers */ +void borderselect_timeline_markers(void) +{ + rcti rect; + rctf rectf; + int val, selectmode; + short mval[2]; + + if ( (val = get_border(&rect, 3)) ){ + if (val == LEFTMOUSE) + selectmode = SELECT_ADD; + else + selectmode = SELECT_SUBTRACT; + + mval[0]= rect.xmin; + mval[1]= rect.ymin+2; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmin, &rectf.ymin); + mval[0]= rect.xmax; + mval[1]= rect.ymax-2; + areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax); + + /* do markers */ + borderselect_markers(rectf.xmin, rectf.xmax, selectmode); + + BIF_undo_push("Border Select TimeLine"); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } +} + +static int find_nearest_timeline_marker(float dx) +{ + TimeMarker *marker, *nearest= NULL; + float dist, min_dist= 1000000; + + for(marker= G.scene->markers.first; marker; marker= marker->next) { + dist = ABS((float)marker->frame - dx); + if(dist < min_dist){ + min_dist= dist; + nearest= marker; + } + } + + if(nearest) return nearest->frame; + else return (int)floor(dx); +} + +/* select/deselect TimeMarker at current frame */ +static void select_timeline_marker_frame(int frame, unsigned char shift) +{ + TimeMarker *marker; + int select=0; + + for(marker= G.scene->markers.first; marker; marker= marker->next) { + /* if Shift is not set, then deselect Markers */ + if(!shift) marker->flag &= ~SELECT; + /* this way a not-shift select will allways give 1 selected marker */ + if((marker->frame == frame) && (!select)) { + if(marker->flag & SELECT) + marker->flag &= ~SELECT; + else + marker->flag |= SELECT; + select = 1; + } + } +} + +/* *********** end Markers - TimeLine *************** */ static int float_to_frame(float frame) { @@ -359,102 +585,6 @@ void timeline_frame_to_center(void) scrarea_queue_winredraw(curarea); } -void timeline_grab(int mode, int smode) // mode and smode unused here, for callback -{ - SpaceTime *stime= curarea->spacedata.first; - TimeMarker *marker, *selmarker=NULL; - float dx, fac; - int a, ret_val= 0, totmark=0, *oldframe, offs, firsttime=1; - unsigned short event; - short val, pmval[2], mval[2], mvalo[2]; - char str[32]; - - for(marker= G.scene->markers.first; marker; marker= marker->next) { - if(marker->flag & SELECT) totmark++; - } - if(totmark==0) return; - - oldframe= MEM_mallocN(totmark*sizeof(int), "marker array"); - for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - oldframe[a]= marker->frame; - selmarker= marker; // used for hederprint - a++; - } - } - - dx= G.v2d->mask.xmax-G.v2d->mask.xmin; - dx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/dx; - - getmouseco_areawin(pmval); - mvalo[0]= pmval[0]; - - while(ret_val == 0) { - - getmouseco_areawin(mval); - - if (mval[0] != mvalo[0] || firsttime) { - mvalo[0]= mval[0]; - firsttime= 0; - - fac= (((float)(mval[0] - pmval[0]))*dx); - - apply_keyb_grid(&fac, 0.0, (float)G.scene->r.frs_sec, 0.1*(float)G.scene->r.frs_sec, 0); - offs= (int)fac; - - for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - marker->frame= oldframe[a] + offs; - a++; - } - } - - if(totmark==1) { // we print current marker value - if(stime->flag & TIME_DRAWFRAMES) - sprintf(str, "Marker %d offset %d", selmarker->frame, offs); - else - sprintf(str, "Marker %.2f offset %.2f", (selmarker->frame/(float)G.scene->r.frs_sec), (offs/(float)G.scene->r.frs_sec)); - } - else { - if(stime->flag & TIME_DRAWFRAMES) - sprintf(str, "Marker offset %d ", offs); - else - sprintf(str, "Marker offset %.2f ", (offs/(float)G.scene->r.frs_sec)); - } - headerprint(str); - - force_draw(0); // areas identical to this, 0 = no header - } - else PIL_sleep_ms(10); // idle - - /* emptying queue and reading events */ - while( qtest() ) { - event= extern_qread(&val); - - if(val) { - if(event==ESCKEY || event==RIGHTMOUSE) ret_val= 2; - else if(event==LEFTMOUSE || event==RETKEY || event==SPACEKEY) ret_val= 1; - } - } - } - - /* restore? */ - if(ret_val==2) { - for(a=0, marker= G.scene->markers.first; marker; marker= marker->next) { - if(marker->flag & SELECT) { - marker->frame= oldframe[a]; - a++; - } - } - } - else { - BIF_undo_push("Move Markers"); - } - MEM_freeN(oldframe); - allqueue(REDRAWTIME, 0); - allqueue(REDRAWACTION, 0); -} - /* copy of this is actually in editscreen.c, but event based */ static void timeline_force_draw(short val) { @@ -564,7 +694,7 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) getmouseco_areawin(mval); areamouseco_to_ipoco(G.v2d, mval, &dx, &dy); - cfra= find_nearest_marker(dx); + cfra= find_nearest_timeline_marker(dx); if (G.qual && LR_SHIFTKEY) select_timeline_marker_frame(cfra, 1); @@ -572,7 +702,7 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) select_timeline_marker_frame(cfra, 0); force_draw(0); - std_rmouse_transform(timeline_grab); + std_rmouse_transform(transform_markers); break; case MIDDLEMOUSE: @@ -608,29 +738,37 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(G.qual==LR_CTRLKEY) nextprev_timeline_key(1); else - nextprev_timeline_marker(1); + nextprev_marker(1); break; case PAGEDOWNKEY: /* prev keyframe */ if(G.qual==LR_CTRLKEY) nextprev_timeline_key(-1); else - nextprev_timeline_marker(-1); + nextprev_marker(-1); break; case AKEY: /* deselect all TimeMarkers */ - select_timeline_markers(); - doredraw= 1; + deselect_markers(1, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; + case BKEY: + /* borderselect markers */ + borderselect_timeline_markers(); break; case DKEY: if(G.qual==LR_SHIFTKEY) - duplicate_timeline_marker(); + duplicate_marker(); break; case CKEY: timeline_frame_to_center(); break; case GKEY: /* move marker */ - timeline_grab('g', 0); + transform_markers('g', 0); break; case EKEY: /* set end frame */ G.scene->r.efra = CFRA; @@ -638,12 +776,15 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) allqueue(REDRAWTIME, 1); break; case MKEY: /* add, rename marker */ - if (G.qual & LR_CTRLKEY) - rename_timeline_marker(); + if (G.qual & LR_SHIFTKEY) + rename_marker(); else - add_timeline_marker(CFRA); + add_marker(CFRA); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; case SKEY: /* set start frame */ G.scene->r.sfra = CFRA; @@ -662,9 +803,12 @@ void winqreadtimespace(ScrArea *sa, void *spacedata, BWinEvent *evt) case XKEY: if( okee("Erase selected")==0 ) break; - remove_timeline_marker(); + remove_marker(); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; } } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 79fcd85adbe..5a25245a076 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -70,6 +70,7 @@ #include "BSE_drawipo.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" #include "nla.h" @@ -84,6 +85,9 @@ #define ACTMENU_VIEW_MAXIMIZE 5 #define ACTMENU_VIEW_LOCK 6 #define ACTMENU_VIEW_SLIDERS 7 +#define ACTMENU_VIEW_NEXTMARKER 8 +#define ACTMENU_VIEW_PREVMARKER 9 + #define ACTMENU_SEL_BORDER 0 #define ACTMENU_SEL_ALL_KEYS 1 @@ -96,8 +100,8 @@ #define ACTMENU_KEY_DUPLICATE 0 #define ACTMENU_KEY_DELETE 1 #define ACTMENU_KEY_BAKE 2 -#define ACTMENU_KEY_SNAP 3 -#define ACTMENU_KEY_CLEAN 4 +#define ACTMENU_KEY_CLEAN 3 +#define ACTMENU_KEY_MIRROR 4 #define ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_UP 0 #define ACTMENU_KEY_CHANPOS_MOVE_CHANNEL_DOWN 1 @@ -122,6 +126,9 @@ #define ACTMENU_KEY_EXTEND_CYCLIC 2 #define ACTMENU_KEY_EXTEND_CYCLICEXTRAPOLATION 3 +#define ACTMENU_KEY_SNAP_NEARFRAME 0 +#define ACTMENU_KEY_SNAP_CURFRAME 1 + #define ACTMENU_MARKERS_ADD 0 #define ACTMENU_MARKERS_DUPLICATE 1 #define ACTMENU_MARKERS_DELETE 2 @@ -250,6 +257,12 @@ static void do_action_viewmenu(void *arg, int event) case ACTMENU_VIEW_MAXIMIZE: /* Maximize Window */ /* using event B_FULL */ break; + case ACTMENU_VIEW_NEXTMARKER: /* jump to next marker */ + nextprev_marker(1); + break; + case ACTMENU_VIEW_PREVMARKER: /* jump to previous marker */ + nextprev_marker(-1); + break; } allqueue(REDRAWVIEW3D, 0); } @@ -267,14 +280,6 @@ static uiBlock *action_viewmenu(void *arg_unused) "Center View to Current Frame|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_VIEW_CENTERVIEW, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, - menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, BTST(G.saction->lock, 0)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, - "Update Automatically|", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 1, - ACTMENU_VIEW_AUTOUPDATE, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -283,10 +288,30 @@ static uiBlock *action_viewmenu(void *arg_unused) "Show Sliders|", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_VIEW_SLIDERS, ""); + + 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, + ACTMENU_VIEW_LOCK, ""); + + uiDefIconTextBut(block, BUTM, 1, BTST(G.saction->lock, 0)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, + "Update Automatically|", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, + ACTMENU_VIEW_AUTOUPDATE, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Jump To Next Marker|PageUp", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_NEXTMARKER, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Jump To Prev Marker|PageDown", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_VIEW_PREVMARKER, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, @@ -303,11 +328,6 @@ static uiBlock *action_viewmenu(void *arg_unused) "View All|Home", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_VIEW_ALL, ""); - - 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, - ACTMENU_VIEW_LOCK, ""); if (!curarea->full) uiDefIconTextBut(block, BUTM, B_FULL, ICON_BLANK1, @@ -338,7 +358,6 @@ static void do_action_selectmenu(void *arg, int event) SpaceAction *saction; bAction *act; Key *key; - ListBase *markers; saction = curarea->spacedata.first; if (!saction) @@ -346,7 +365,6 @@ static void do_action_selectmenu(void *arg, int event) act = saction->action; key = get_action_mesh_key(); - markers = get_saction_markers(saction); switch(event) { @@ -383,11 +401,12 @@ static void do_action_selectmenu(void *arg, int event) break; case ACTMENU_SEL_ALL_MARKERS: /* select/deselect all markers */ - if (markers != NULL) { - deselect_saction_markers(markers, 1, 0); - allqueue(REDRAWACTION, 0); - allqueue(REDRAWTIME, 0); - } + deselect_markers(1, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; case ACTMENU_SEL_COLUMN: /* select column */ @@ -800,6 +819,45 @@ static uiBlock *action_keymenu_chanposmenu(void *arg_unused) return block; } +static void do_action_keymenu_snapmenu(void *arg, int event) +{ + switch(event) + { + case ACTMENU_KEY_SNAP_NEARFRAME: + snap_keys_to_frame(1); + break; + case ACTMENU_KEY_SNAP_CURFRAME: + snap_keys_to_frame(2); + break; + } + + scrarea_queue_winredraw(curarea); +} + +static uiBlock *action_keymenu_snapmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "action_keymenu_snapmenu", + UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_action_keymenu_snapmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Nearest Frame|Shift S, 1", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_NEARFRAME, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Current Frame|Shift S, 2", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, + ACTMENU_KEY_SNAP_CURFRAME, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + + return block; +} + static void do_action_keymenu(void *arg, int event) { SpaceAction *saction; @@ -836,9 +894,6 @@ static void do_action_keymenu(void *arg, int event) case ACTMENU_KEY_BAKE: bake_action_with_client (G.saction->action, OBACT, 0.01); break; - case ACTMENU_KEY_SNAP: - snap_keys_to_frame(); - break; case ACTMENU_KEY_CLEAN: if (key) clean_shapekeys(key); @@ -860,9 +915,8 @@ static uiBlock *action_keymenu(void *arg_unused) uiDefIconTextBlockBut(block, action_keymenu_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 20, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, - "Snap to Frame|Shift S", 0, yco-=20, - menuwidth, 19, NULL, 0.0, 0.0, 0, ACTMENU_KEY_SNAP, ""); + uiDefIconTextBlockBut(block, action_keymenu_snapmenu, + NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 20, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -926,39 +980,30 @@ static uiBlock *action_keymenu(void *arg_unused) static void do_action_markermenu(void *arg, int event) { - SpaceAction *saction; - ListBase *markers = NULL; - - saction= curarea->spacedata.first; - if (!saction) - return; - - /* get set of markers */ - markers= get_saction_markers(saction); - if (markers == NULL) - return; - switch(event) { case ACTMENU_MARKERS_ADD: - add_saction_marker(markers, CFRA); + add_marker(CFRA); break; case ACTMENU_MARKERS_DUPLICATE: - duplicate_saction_markers(markers); + duplicate_marker(); break; case ACTMENU_MARKERS_DELETE: - remove_saction_markers(markers); + remove_marker(); break; case ACTMENU_MARKERS_NAME: - rename_saction_markers(markers); + rename_marker(); break; case ACTMENU_MARKERS_MOVE: - transform_saction_markers('g', 0); + transform_markers('g', 0); break; } - allqueue(REDRAWACTION, 0); allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } static uiBlock *action_markermenu(void *arg_unused) @@ -972,16 +1017,16 @@ static uiBlock *action_markermenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_ADD, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker(s)|Ctrl Shift M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DUPLICATE, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker(s)|Alt M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_DELETE, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker(s)|Ctrl M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Shift M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_NAME, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker(s)|Shift M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Shift G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, ACTMENU_MARKERS_MOVE, ""); @@ -1069,19 +1114,16 @@ void action_buttons(void) uiDefPulldownBut(block, action_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, ""); xco+= xmax; - + + xmax= GetButStringLength("Marker"); + uiDefPulldownBut(block, action_markermenu, NULL, + "Marker", xco, -2, xmax-3, 24, ""); + xco+= xmax; + xmax= GetButStringLength("Key"); uiDefPulldownBut(block, action_keymenu, NULL, "Key", xco, -2, xmax-3, 24, ""); xco+= xmax; - - //if ((G.saction->markert != SACTION_NOMARKERS) && - // (G.saction->action != NULL)) { - xmax= GetButStringLength("Marker"); - uiDefPulldownBut(block, action_markermenu, NULL, - "Marker", xco, -2, xmax-3, 24, ""); - xco+= xmax; - //} } uiBlockSetEmboss(block, UI_EMBOSS); diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index aa446fc50dc..a79302905d9 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -79,6 +79,7 @@ #include "BSE_edit.h" #include "BSE_editipo.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" #include "BIF_editaction.h" #include "BIF_interface.h" @@ -336,9 +337,9 @@ static uiBlock *ipo_editmenu_mirrormenu(void *arg_unused) block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_mirrormenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); uiBlockSetButmFunc(block, do_ipo_editmenu_mirrormenu, NULL); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Current Frame|M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Vertical Axis|M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Horizontal Axis|M, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Current Frame|Ctrl M, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Vertical Axis|Ctrl M, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Over Horizontal Axis|Ctrl M, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 60); @@ -555,7 +556,7 @@ static void do_ipo_editmenu(void *arg, int event) switch(event) { case 0: - del_ipo(); + del_ipo(1); break; case 1: add_duplicate_editipo(); @@ -813,6 +814,69 @@ static uiBlock *ipo_selectmenu(void *arg_unused) return block; } +static void do_ipo_markermenu(void *arg, int event) +{ + switch(event) + { + case 1: + add_marker(CFRA); + break; + case 2: + duplicate_marker(); + break; + case 3: + remove_marker(); + break; + case 4: + rename_marker(); + break; + case 5: + transform_markers('g', 0); + break; + } + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); +} + +static uiBlock *ipo_markermenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "ipo_markermenu", + UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_ipo_markermenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Shift M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Shift G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} static char *ipo_modeselect_pup(void) { @@ -1113,7 +1177,11 @@ void ipo_buttons(void) xmax= GetButStringLength("Select"); uiDefPulldownBut(block,ipo_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, ""); xco+=xmax; - + + xmax= GetButStringLength("Marker"); + uiDefPulldownBut(block,ipo_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, ""); + xco+=xmax; + if (G.sipo->showkey) { xmax= GetButStringLength("Key"); uiDefPulldownBut(block,ipo_editmenu, NULL, "Key", xco, -2, xmax-3, 24, ""); @@ -1126,7 +1194,6 @@ void ipo_buttons(void) xmax= GetButStringLength("Curve"); uiDefPulldownBut(block,ipo_editmenu, NULL, "Curve", xco, -2, xmax-3, 24, ""); } - xco+=xmax; } diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c index 03b0558dfca..9e5402e0f64 100644 --- a/source/blender/src/header_nla.c +++ b/source/blender/src/header_nla.c @@ -58,9 +58,12 @@ #include "BIF_screen.h" #include "BIF_space.h" #include "BIF_editnla.h" +#include "BIF_editaction.h" +#include "BIF_toolbox.h" #include "BSE_drawipo.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" //#include "nla.h" @@ -180,6 +183,14 @@ static void do_nla_selectmenu(void *arg, int event) allqueue (REDRAWNLA, 0); allqueue (REDRAWIPO, 0); break; + case 3: /* Select/Deselect All Markers */ + deselect_markers(1, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + break; } } @@ -197,6 +208,7 @@ static uiBlock *nla_selectmenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Keys|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Channels", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All Markers|Ctrl A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); if(curarea->headertype==HEADERTOP) { uiBlockSetDirection(block, UI_DOWN); @@ -211,6 +223,31 @@ static uiBlock *nla_selectmenu(void *arg_unused) return block; } +static void do_nla_strip_snapmenu(void *arg, int event) +{ + snap_action_strips(event); + + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); +} + +static uiBlock *nla_strip_snapmenu(void *arg_unused) +{ + uiBlock *block; + short yco = 20, menuwidth = 120; + + block= uiNewBlock(&curarea->uiblocks, "nla_strip_snapmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_nla_strip_snapmenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nearest Frame|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Current Frame|Shift S, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 60); + return block; +} + static void do_nla_strip_transformmenu(void *arg, int event) { switch(event) { @@ -257,8 +294,10 @@ static void do_nla_stripmenu(void *arg, int event) update_for_newframe_muted(); break; case 3: /* Delete Strips */ - delete_nlachannel_keys (); - update_for_newframe_muted(); + if (okee("Erase selected strips and/or keys")) { + delete_nlachannel_keys (); + update_for_newframe_muted(); + } break; case 5: /* Convert Action to NLA Strip */ break; @@ -274,9 +313,6 @@ static void do_nla_stripmenu(void *arg, int event) case 9: /* reset start/end of action */ reset_action_strips(2); break; - case 10: /* snap to frame */ - snap_action_strips(); - break; } } @@ -292,7 +328,7 @@ static uiBlock *nla_stripmenu(void *arg_unused) uiDefIconTextBlockBut(block, nla_strip_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 20, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Strip Size|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 8, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Reset Action Start/End|Alt S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 9, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Snap to Frame|Shift S", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 10, ""); + uiDefIconTextBlockBut(block, nla_strip_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap To Frame", 0, yco-=20, 120, 20, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -302,8 +338,8 @@ static uiBlock *nla_stripmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Down|Page Down", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Up|Page Up", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Down|Ctrl Page Down", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Up|Ctrl Page Up", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); // uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Action to NLA Strip|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); @@ -320,6 +356,70 @@ static uiBlock *nla_stripmenu(void *arg_unused) return block; } +static void do_nla_markermenu(void *arg, int event) +{ + switch(event) + { + case 1: + add_marker(CFRA); + break; + case 2: + duplicate_marker(); + break; + case 3: + remove_marker(); + break; + case 4: + rename_marker(); + break; + case 5: + transform_markers('g', 0); + break; + } + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); +} + +static uiBlock *nla_markermenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "nla_markermenu", + UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_nla_markermenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Ctrl Shift D", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Shift M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|Shift G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + void nla_buttons(void) { SpaceNla *snla; @@ -367,11 +467,16 @@ void nla_buttons(void) xmax= GetButStringLength("Select"); uiDefPulldownBut(block, nla_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, ""); xco+= xmax; - + + xmax= GetButStringLength("Marker"); + uiDefPulldownBut(block, nla_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, ""); + xco+= xmax; + xmax= GetButStringLength("Strip"); uiDefPulldownBut(block, nla_stripmenu, NULL, "Strip", xco, -2, xmax-3, 24, ""); xco+= xmax; - + + } uiBlockSetEmboss(block, UI_EMBOSS); diff --git a/source/blender/src/header_sound.c b/source/blender/src/header_sound.c index fccbebe1350..73ff9a75413 100644 --- a/source/blender/src/header_sound.c +++ b/source/blender/src/header_sound.c @@ -70,6 +70,7 @@ #include "BSE_drawipo.h" #include "BSE_filesel.h" #include "BSE_headerbuttons.h" +#include "BSE_time.h" #include "blendef.h" #include "mydevice.h" @@ -186,6 +187,12 @@ static void do_sound_viewmenu(void *arg, int event) case 4: /* Maximize Window */ /* using event B_FULL */ break; + case 5: /* jump to next marker */ + nextprev_marker(1); + break; + case 6: /* jump to previous marker */ + nextprev_marker(-1); + break; } allqueue(REDRAWVIEW3D, 0); } @@ -199,6 +206,13 @@ static uiBlock *sound_viewmenu(void *arg_unused) UI_EMBOSSP, UI_HELV, curarea->headwin); uiBlockSetButmFunc(block, do_sound_viewmenu, NULL); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Next Marker|PageUp", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Jump To Prev Marker|PageDown", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20, @@ -226,6 +240,72 @@ static uiBlock *sound_viewmenu(void *arg_unused) return block; } +static void do_sound_markermenu(void *arg, int event) +{ + switch(event) + { + case 1: + add_marker(CFRA); + break; + case 2: + duplicate_marker(); + break; + case 3: + remove_marker(); + break; + case 4: + rename_marker(); + break; + case 5: + transform_markers('g', 0); + break; + } + + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); +} + +static uiBlock *sound_markermenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0, menuwidth=120; + + block= uiNewBlock(&curarea->uiblocks, "sound_markermenu", + UI_EMBOSSP, UI_HELV, curarea->headwin); + uiBlockSetButmFunc(block, do_sound_markermenu, NULL); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Shift D", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "(Re)Name Marker|Shift M", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|G", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); + + + if(curarea->headertype==HEADERTOP) { + uiBlockSetDirection(block, UI_DOWN); + } + else { + uiBlockSetDirection(block, UI_TOP); + uiBlockFlipOrder(block); + } + + uiTextBoundsBlock(block, 50); + + return block; +} + + void sound_buttons(void) { uiBlock *block; @@ -278,6 +358,10 @@ void sound_buttons(void) "View", xco, -2, xmax-3, 24, ""); xco+= xmax; + xmax= GetButStringLength("Marker"); + uiDefPulldownBut(block, sound_markermenu, NULL, + "Marker", xco, -2, xmax-3, 24, ""); + xco+= xmax; } uiBlockSetEmboss(block, UI_EMBOSS); diff --git a/source/blender/src/header_time.c b/source/blender/src/header_time.c index d5ecd383fab..b0a9b45ca95 100644 --- a/source/blender/src/header_time.c +++ b/source/blender/src/header_time.c @@ -203,10 +203,10 @@ static void do_time_viewmenu(void *arg, int event) stime->flag ^= TIME_DRAWFRAMES; break; case 6: - nextprev_timeline_marker(1); + nextprev_marker(1); break; case 7: - nextprev_timeline_marker(-1); + nextprev_marker(-1); break; case 8: nextprev_timeline_key(1); @@ -290,22 +290,26 @@ static void do_time_framemenu(void *arg, int event) allqueue(REDRAWALL, 1); break; case 3: /* Add Marker */ - add_timeline_marker(CFRA); + add_marker(CFRA); break; case 4: /* Remove Marker */ - remove_timeline_marker(); + remove_marker(); break; case 5: /* Rename Marker */ - rename_timeline_marker(); + rename_marker(); break; case 6: /* Grab Marker */ - timeline_grab('g', 0); + transform_markers('g', 0); break; case 7: /* duplicate marker */ - duplicate_timeline_marker(); + duplicate_marker(); break; } allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); } static uiBlock *time_framemenu(void *arg_unused) @@ -319,14 +323,14 @@ static uiBlock *time_framemenu(void *arg_unused) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Marker|M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate Marker|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Marker|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Ctrl M", 0, yco-=20, + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Name Marker|Shift M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Grab/Move Marker|G", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index d6307c7e284..1f5131ecdea 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -135,6 +135,7 @@ #include "BSE_filesel.h" #include "BSE_headerbuttons.h" #include "BSE_editnla_types.h" +#include "BSE_time.h" #include "BDR_vpaint.h" #include "BDR_editmball.h" @@ -1871,9 +1872,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) selectrow_nurb(); } else if(G.qual==LR_CTRLKEY) { - if (G.obedit->type==OB_MESH) + if (G.obedit->type==OB_MESH) { CutEdgeloop(1); BIF_undo_push("Cut Edgeloop"); + } + //else if (G.obedit->type==OB_ARMATURE) { + // initTransform(TFM_BONE_ROLL, CTX_NONE); + // Transform(); + //} } else if((G.qual==0)) { initTransform(TFM_ROTATION, CTX_NONE); @@ -2342,8 +2348,11 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case RIGHTMOUSE: mouse_select_ipo(); - allqueue (REDRAWACTION, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; case MIDDLEMOUSE: if(in_ipo_buttons()) { @@ -2364,16 +2373,20 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) doredraw= 1; break; case PAGEUPKEY: - if(G.qual==LR_CTRLKEY) + if(G.qual & LR_CTRLKEY) movekey_ipo(1); - else if((G.qual==0)) + else if(G.qual & LR_SHIFTKEY) nextkey_ipo(1); + else + nextprev_marker(1); break; case PAGEDOWNKEY: - if(G.qual==LR_CTRLKEY) + if(G.qual & LR_CTRLKEY) movekey_ipo(-1); - else if((G.qual==0)) + else if(G.qual & LR_SHIFTKEY) nextkey_ipo(-1); + else + nextprev_marker(-1); break; case HOMEKEY: if((G.qual==0)) @@ -2381,7 +2394,15 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case AKEY: - if((G.qual==0)) { + if (G.qual & LR_CTRLKEY) { + deselect_markers(1, 0); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } + else if (G.qual==0) { if(in_ipo_buttons()) { swap_visible_editipo(); } @@ -2392,37 +2413,42 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) allqueue (REDRAWNLA, 0); allqueue (REDRAWACTION, 0); } + break; case BKEY: - if((G.qual==0)) + if (G.qual==0) borderselect_ipo(); break; case CKEY: - if((G.qual==0)) + if (G.qual==0) move_to_frame(); break; case DKEY: - if((G.qual==LR_SHIFTKEY)) + if (G.qual==LR_SHIFTKEY) add_duplicate_editipo(); + else if (G.qual == (LR_CTRLKEY|LR_SHIFTKEY)) + duplicate_marker(); break; case GKEY: - if((G.qual==0)) + if (G.qual & LR_SHIFTKEY) + transform_markers('g', 0); + else if (G.qual==0) transform_ipo('g'); break; case HKEY: - if(G.qual==LR_ALTKEY) + if (G.qual==LR_ALTKEY) sethandles_ipo(HD_AUTO_ANIM); - if(G.qual==LR_SHIFTKEY) + if (G.qual==LR_SHIFTKEY) sethandles_ipo(HD_AUTO); - else if(G.qual==0) + else if (G.qual==0) sethandles_ipo(HD_ALIGN); break; case JKEY: - if((G.qual==LR_CTRLKEY)) + if (G.qual==LR_CTRLKEY) join_ipo_menu(); break; case KKEY: - if((G.qual==0)) { + if (G.qual==0) { ipo_toggle_showkey(); scrarea_queue_headredraw(curarea); allqueue(REDRAWVIEW3D, 0); @@ -2430,40 +2456,64 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt) } break; case MKEY: - if((G.qual==0)) + if (G.qual==LR_CTRLKEY) { ipo_mirror_menu(); + break; + } + if (G.qual == 0) + add_marker(CFRA); + else if (G.qual == LR_SHIFTKEY) + rename_marker(); + else + break; + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); break; case NKEY: toggle_blockhandler(sa, IPO_HANDLER_PROPERTIES, UI_PNL_TO_MOUSE); doredraw= 1; break; case OKEY: - if(G.qual==LR_SHIFTKEY) + if (G.qual==LR_SHIFTKEY) smooth_ipo(); else clean_ipo(sipo->ipo, 1); break; case RKEY: - if((G.qual==0)) + if (G.qual==0) ipo_record(); break; case SKEY: - if((G.qual==LR_SHIFTKEY)) { + if (G.qual==LR_SHIFTKEY) { ipo_snap_menu(); - } else if((G.qual==0)) + } + else if (G.qual==0) transform_ipo('s'); break; case TKEY: - if((G.qual==0)) + if (G.qual==0) set_ipotype(); break; case VKEY: - if((G.qual==0)) + if (G.qual==0) sethandles_ipo(HD_VECT); break; case XKEY: case DELKEY: - del_ipo(); + val= pupmenu("Erase selected%t|Keys %x1|Markers %x2"); + if (val == 1) + del_ipo(0); + else if (val == 2) { + remove_marker(); + allqueue(REDRAWTIME, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWSOUND, 0); + } break; } } |