diff options
-rw-r--r-- | source/blender/makesdna/DNA_action_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawipo.c | 25 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 29 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 19 |
4 files changed, 63 insertions, 11 deletions
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index c12a4bf4022..77e550949ca 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -150,6 +150,7 @@ typedef struct SpaceAction { /* SpaceAction flag */ #define SACTION_MOVING 1 /* during transform */ #define SACTION_SLIDERS 2 /* show sliders (if relevant) - limited to shape keys for now */ +#define SACTION_DRAWTIME 4 /* draw time in seconds instead of time in frames */ /* SpaceAction AutoSnap Settings */ #define SACTSNAP_OFF 0 /* no auto-snap */ diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index 1bbec20cd49..29f56fade34 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -219,6 +219,15 @@ void calc_ipogrid() secondgrid = 1; secondiv = 0.01 * (float)G.scene->r.frs_sec; } + break; + } + case SPACE_ACTION: { + SpaceAction *saction = curarea->spacedata.first; + if (saction->flag & SACTION_DRAWTIME) { + secondgrid = 1; + secondiv = 0.01 * (float)G.scene->r.frs_sec; + } + break; } default: break; @@ -231,7 +240,7 @@ void calc_ipogrid() step_to_grid(&ipogrid_dx, &ipomachtx); ipogrid_dx*= secondiv; - if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) { + if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) { if(ipogrid_dx < 0.1) ipogrid_dx= 0.1; ipomachtx-= 2; if(ipomachtx<-2) ipomachtx= -2; @@ -242,7 +251,7 @@ void calc_ipogrid() ipogrid_dy= IPOSTEP*space/pixels; step_to_grid(&ipogrid_dy, &ipomachty); - if ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME) { + if ELEM4(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME, SPACE_ACTION) { if(ipogrid_dy < 1.0) ipogrid_dy= 1.0; if(ipomachty<1) ipomachty= 1; } @@ -949,6 +958,18 @@ void drawscroll(int disptype) else scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype); } + else if (curarea->spacetype==SPACE_ACTION) { + SpaceAction *saction= curarea->spacedata.first; + + if (saction->flag & SACTION_DRAWTIME) { + fac2= val/(float)G.scene->r.frs_sec; + scroll_prstr(fac, 3.0+(float)(hor.ymin), fac2, 'h', disptype); + } + else { + ipomachtx= 1; + scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype); + } + } else { scroll_prstr(fac, 3.0+(float)(hor.ymin), val, 'h', disptype); } diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 7c5efbdcc5b..80179d181ed 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -2831,12 +2831,12 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case HKEY: - if(G.qual & LR_SHIFTKEY) { - if(okee("Set Keys to Auto Handle")) + if (G.qual & LR_SHIFTKEY) { + if (okee("Set Keys to Auto Handle")) sethandles_action_keys(HD_AUTO); } else { - if(okee("Toggle Keys Aligned Handle")) + if (okee("Toggle Keys Aligned Handle")) sethandles_action_keys(HD_ALIGN); } break; @@ -2899,6 +2899,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) anim_previewrange_set(); else if (G.qual & LR_ALTKEY) /* clear preview range */ anim_previewrange_clear(); + allqueue(REDRAWTIME, 0); allqueue(REDRAWBUTSALL, 0); allqueue(REDRAWACTION, 0); @@ -2908,7 +2909,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case SKEY: if (mval[0]>=ACTWIDTH) { - if(G.qual & LR_SHIFTKEY) { + if (G.qual & LR_SHIFTKEY) { if (data) { val = pupmenu("Snap Keys To%t|Nearest Frame%x1|Current Frame%x2|Nearest Marker %x3"); snap_action_keys(val); @@ -2920,17 +2921,27 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) break; case TKEY: - if(G.qual & LR_SHIFTKEY) + if (G.qual & LR_SHIFTKEY) action_set_ipo_flags(SET_IPO_POPUP); + else if (G.qual & LR_CTRLKEY) { + val= pupmenu("Time value%t|Frames %x1|Seconds%x2"); + + if (val > 0) { + if (val == 2) saction->flag |= SACTION_DRAWTIME; + else saction->flag &= ~SACTION_DRAWTIME; + + doredraw= 1; + } + } else transform_action_keys ('t', 0); break; - + case VKEY: - if(okee("Set Keys to Vector Handle")) + if (okee("Set Keys to Vector Handle")) sethandles_action_keys(HD_VECT); break; - + case PAGEUPKEY: if (datatype == ACTCONT_ACTION) { if(G.qual & LR_SHIFTKEY) @@ -3044,7 +3055,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt) view2d_zoom(G.v2d, 0.1154, sa->winx, sa->winy); test_view2d(G.v2d, sa->winx, sa->winy); view2d_do_locks(curarea, V2D_LOCK_COPY); - + doredraw= 1; break; case PADMINUS: diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index d39bd004eac..289629f8d91 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -89,6 +89,7 @@ #define ACTMENU_VIEW_SLIDERS 7 #define ACTMENU_VIEW_NEXTMARKER 8 #define ACTMENU_VIEW_PREVMARKER 9 +#define ACTMENU_VIEW_TIME 10 #define ACTMENU_SEL_BORDER 0 #define ACTMENU_SEL_BORDERM 1 @@ -255,6 +256,9 @@ static void do_action_viewmenu(void *arg, int event) case ACTMENU_VIEW_PREVMARKER: /* jump to previous marker */ nextprev_marker(-1); break; + case ACTMENU_VIEW_TIME: /* switch between frames and seconds display */ + G.saction->flag ^= SACTION_DRAWTIME; + break; } allqueue(REDRAWVIEW3D, 0); } @@ -275,6 +279,21 @@ static uiBlock *action_viewmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + + if (G.saction->flag & SACTION_DRAWTIME) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Show Frames|T", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, + ACTMENU_VIEW_TIME, ""); + } + else { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Show Seconds|T", 0, yco-=20, + menuwidth, 19, NULL, 0.0, 0.0, 1, + ACTMENU_VIEW_TIME, ""); + } + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, (G.saction->flag & SACTION_SLIDERS)?ICON_CHECKBOX_HLT:ICON_CHECKBOX_DEHLT, "Show Sliders|", 0, yco-=20, |