diff options
author | Ton Roosendaal <ton@blender.org> | 2009-05-21 17:33:04 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-05-21 17:33:04 +0400 |
commit | 99cb9a26b0b217d2e36938983809337abce67835 (patch) | |
tree | 950abb5dc5390ce6127e1bfa0a828680fbdafcc0 /source/blender/editors/space_time | |
parent | 8013f6522e6b3d19d92bc14a50d18db3dd99b6d6 (diff) |
2.5
Animation playback back in control. And non-blocking still!
- Play follows the "Playback" options in TimeLine menu.
Only the region 'windows' are drawn, not headers, toolbars,
channel views, etc.
The option "Buttons Window" also redraws property regions.
- The Timeline header always redraws, this to denote at least
progressing frame numbers
- For now: if you choose to play 3D views, it also redraws
the TimeLine. Seems to be good convention, but probably
better to add menu option for it?
- Fun test: while playback, change Playback options, works OK!
- New: top header button shows animation play status, and allows
to stop playback
- New: Animation stop/start operator. Assigned to ALT+A. It has
no options yet; just plays active region + all 3D windows now.
Options will follow, based on reviews.
Also ESC won't work for now, just press ALT+A again.
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_time/time_header.c | 58 |
2 files changed, 53 insertions, 9 deletions
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 3df57208bbd..c4ca4d8522f 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -207,6 +207,10 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ switch(wmn->category) { + case NC_SCREEN: + if(wmn->data==ND_ANIMPLAY) + ED_region_tag_redraw(ar); + break; case NC_SCENE: switch (wmn->data) { case ND_FRAME: diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index f26e632eb87..cf9c12f3dff 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -46,6 +46,7 @@ #include "ED_keyframing.h" #include "ED_screen.h" +#include "ED_screen_types.h" #include "ED_types.h" #include "ED_util.h" @@ -66,17 +67,46 @@ /* ************************ header time area region *********************** */ +static ARegion *time_top_left_3dwindow(bScreen *screen) +{ + ARegion *aret= NULL; + ScrArea *sa; + int min= 10000; + + for(sa= screen->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_VIEW3D) { + ARegion *ar; + for(ar= sa->regionbase.first; ar; ar= ar->next) { + if(ar->regiontype==RGN_TYPE_WINDOW) { + if(ar->winrct.xmin - ar->winrct.ymin < min) { + aret= ar; + min= ar->winrct.xmin - ar->winrct.ymin; + } + } + } + } + } + return aret; +} static void do_time_redrawmenu(bContext *C, void *arg, int event) { - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); if(event < 1001) { + bScreen *screen= CTX_wm_screen(C); + SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); stime->redraws ^= event; - /* update handler when it's running */ -// if(has_screenhandler(G.curscreen, SCREEN_HANDLER_ANIM)) -// start_animated_screen(stime); + + if(screen->animtimer) { + wmTimer *wt= screen->animtimer; + ScreenAnimData *sad= wt->customdata; + + sad->redraws= stime->redraws; + sad->ar= NULL; + if(stime->redraws & TIME_REGION) + sad->ar= time_top_left_3dwindow(screen); + } } else { if(event==1001) { @@ -98,9 +128,9 @@ static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused) block= uiBeginBlock(C, ar, "header time_redrawmenu", UI_EMBOSSP); uiBlockSetButmFunc(block, do_time_redrawmenu, NULL); - if(stime->redraws & TIME_LEFTMOST_3D_WIN) icon= ICON_CHECKBOX_HLT; + if(stime->redraws & TIME_REGION) icon= ICON_CHECKBOX_HLT; else icon= ICON_CHECKBOX_DEHLT; - uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_LEFTMOST_3D_WIN, ""); + uiDefIconTextBut(block, BUTM, 1, icon, "Top-Left 3D Window", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, TIME_REGION, ""); if(stime->redraws & TIME_ALL_3D_WIN) icon= ICON_CHECKBOX_HLT; else icon= ICON_CHECKBOX_DEHLT; @@ -358,7 +388,8 @@ static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused) void do_time_buttons(bContext *C, void *arg, int event) { -// SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + bScreen *screen= CTX_wm_screen(C); + SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); Scene *scene= CTX_data_scene(C); switch(event) { @@ -374,10 +405,19 @@ void do_time_buttons(bContext *C, void *arg, int event) //update_for_newframe(); break; case B_TL_PLAY: - ED_screen_animation_timer(C, 1); + ED_screen_animation_timer(C, stime->redraws, 1); + + /* update region if TIME_REGION was set, to leftmost 3d window */ + if(screen->animtimer && (stime->redraws & TIME_REGION)) { + wmTimer *wt= screen->animtimer; + ScreenAnimData *sad= wt->customdata; + + sad->ar= time_top_left_3dwindow(screen); + } + break; case B_TL_STOP: - ED_screen_animation_timer(C, 0); + ED_screen_animation_timer(C, 0, 0); break; case B_TL_FF: /* end frame */ |