[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20316] branches/blender2.5/blender/source /blender: 2.5
Ton Roosendaal
ton at blender.org
Thu May 21 15:33:06 CEST 2009
Revision: 20316
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20316
Author: ton
Date: 2009-05-21 15:33:04 +0200 (Thu, 21 May 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
branches/blender2.5/blender/source/blender/editors/include/ED_screen_types.h
branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
branches/blender2.5/blender/source/blender/editors/space_info/space_info.c
branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
branches/blender2.5/blender/source/blender/editors/space_time/time_header.c
branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_screen.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_screen.h 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_screen.h 2009-05-21 13:33:04 UTC (rev 20316)
@@ -89,7 +89,7 @@
void ED_screen_set_scene(struct bContext *C, struct Scene *scene);
void ED_screen_set_subwinactive(struct wmWindow *win, struct wmEvent *event);
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
-void ED_screen_animation_timer(struct bContext *C, int enable);
+void ED_screen_animation_timer(struct bContext *C, int redraws, int enable);
int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
void ED_screen_full_prevspace(struct bContext *C);
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_screen_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_screen_types.h 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_screen_types.h 2009-05-21 13:33:04 UTC (rev 20316)
@@ -29,6 +29,13 @@
#ifndef ED_SCREEN_TYPES_H__
#define ED_SCREEN_TYPES_H__
+/* for animplayer */
+typedef struct ScreenAnimData {
+ ARegion *ar; /* do not read from this, only for comparing if region exists */
+ int redraws;
+} ScreenAnimData;
+
+
typedef struct AZone {
struct AZone *next, *prev;
int type;
Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_edit.c 2009-05-21 13:33:04 UTC (rev 20316)
@@ -1430,7 +1430,8 @@
ed_screen_fullarea(C, sa);
}
-void ED_screen_animation_timer(bContext *C, int enable)
+/* redraws: uses defines from stime->redraws */
+void ED_screen_animation_timer(bContext *C, int redraws, int enable)
{
bScreen *screen= CTX_wm_screen(C);
wmWindow *win= CTX_wm_window(C);
@@ -1440,8 +1441,17 @@
WM_event_remove_window_timer(win, screen->animtimer);
screen->animtimer= NULL;
- if(enable)
+ if(enable) {
+ struct ScreenAnimData *sad= MEM_mallocN(sizeof(ScreenAnimData), "ScreenAnimData");
+
screen->animtimer= WM_event_add_window_timer(win, TIMER0, (1.0/FPS));
+ sad->ar= CTX_wm_region(C);
+ sad->redraws= redraws;
+ screen->animtimer->customdata= sad;
+
+ }
+ /* notifier catched by top header, for button */
+ WM_event_add_notifier(C, NC_SCREEN|ND_ANIMPLAY, screen);
}
unsigned int ED_screen_view3d_layers(bScreen *screen)
Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-05-21 13:33:04 UTC (rev 20316)
@@ -1859,17 +1859,65 @@
}
-/* ****************** anim player, typically with timer ***************** */
+/* ****************** anim player, with timer ***************** */
-static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
+static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
{
+ if(regiontype==RGN_TYPE_WINDOW) {
+
+ switch (spacetype) {
+ case SPACE_VIEW3D:
+ if(redraws & TIME_ALL_3D_WIN)
+ return 1;
+ break;
+ case SPACE_IPO:
+ case SPACE_ACTION:
+ case SPACE_NLA:
+ if(redraws & TIME_ALL_ANIM_WIN)
+ return 1;
+ break;
+ case SPACE_TIME:
+ /* if only 1 window or 3d windows, we do timeline too */
+ if(redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
+ return 1;
+ break;
+ case SPACE_BUTS:
+ if(redraws & TIME_ALL_BUTS_WIN)
+ return 1;
+ break;
+ case SPACE_SEQ:
+ if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+ return 1;
+ break;
+ case SPACE_IMAGE:
+ if(redraws & TIME_ALL_IMAGE_WIN)
+ return 1;
+ break;
+
+ }
+ }
+ else if(regiontype==RGN_TYPE_UI) {
+ if(redraws & TIME_ALL_BUTS_WIN)
+ return 1;
+ }
+ else if(regiontype==RGN_TYPE_HEADER) {
+ if(spacetype==SPACE_TIME)
+ return 1;
+ }
+ return 0;
+}
+
+static int screen_animation_step(bContext *C, wmOperator *op, wmEvent *event)
+{
bScreen *screen= CTX_wm_screen(C);
if(screen->animtimer==event->customdata) {
Scene *scene= CTX_data_scene(C);
+ wmTimer *wt= screen->animtimer;
+ ScreenAnimData *sad= wt->customdata;
+ ScrArea *sa;
if(scene->audio.flag & AUDIO_SYNC) {
- wmTimer *wt= screen->animtimer;
int step = floor(wt->duration * FPS);
scene->r.cfra += step;
wt->duration -= ((float)step)/FPS;
@@ -1886,13 +1934,65 @@
scene->r.cfra= scene->r.sfra;
}
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+ /* since we follow drawflags, we can't send notifier but tag regions ourselves */
+ ED_update_for_newframe(C, 1);
+ for(sa= screen->areabase.first; sa; sa= sa->next) {
+ ARegion *ar;
+ for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ if(ar==sad->ar)
+ ED_region_tag_redraw(ar);
+ else
+ if(match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws))
+ ED_region_tag_redraw(ar);
+ }
+ }
+
+ //WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+
return OPERATOR_FINISHED;
}
return OPERATOR_PASS_THROUGH;
}
+static void SCREEN_OT_animation_step(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Animation Step";
+ ot->idname= "SCREEN_OT_animation_step";
+
+ /* api callbacks */
+ ot->invoke= screen_animation_step;
+
+ ot->poll= ED_operator_screenactive;
+
+}
+
+/* ****************** anim player, starts or ends timer ***************** */
+
+/* toggle operator */
+static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
+{
+ bScreen *screen= CTX_wm_screen(C);
+
+ if(screen->animtimer) {
+ ED_screen_animation_timer(C, 0, 0);
+ }
+ else {
+ /* todo: RNA properties to define play types */
+ ED_screen_animation_timer(C, TIME_REGION|TIME_ALL_3D_WIN, 1);
+
+ if(screen->animtimer) {
+ wmTimer *wt= screen->animtimer;
+ ScreenAnimData *sad= wt->customdata;
+
+ sad->ar= CTX_wm_region(C);
+ }
+ }
+
+ return OPERATOR_FINISHED;
+}
+
void SCREEN_OT_animation_play(wmOperatorType *ot)
{
/* identifiers */
@@ -1904,6 +2004,7 @@
ot->poll= ED_operator_screenactive;
+
}
/* ************** border select operator (template) ***************************** */
@@ -2400,6 +2501,7 @@
/*frame changes*/
WM_operatortype_append(SCREEN_OT_frame_offset);
+ WM_operatortype_append(SCREEN_OT_animation_step);
WM_operatortype_append(SCREEN_OT_animation_play);
/* render */
@@ -2418,7 +2520,7 @@
ListBase *keymap= WM_keymap_listbase(wm, "Screen", 0, 0);
/* standard timers */
- WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", TIMER0, KM_ANY, KM_ANY, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1);
@@ -2464,12 +2566,13 @@
WM_keymap_add_item(keymap, "SCREEN_OT_render", F12KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_render_view_cancel", ESCKEY, KM_PRESS, 0, 0);
- /* frame offsets */
+ /* frame offsets & play */
keymap= WM_keymap_listbase(wm, "Frames", 0, 0);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 10);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -10);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
+ WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0);
}
Modified: branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_info/info_header.c 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/space_info/info_header.c 2009-05-21 13:33:04 UTC (rev 20316)
@@ -72,8 +72,9 @@
/* ************************ header area region *********************** */
-#define B_STOPRENDER 1
-#define B_STOPCAST 2
+#define B_STOPRENDER 1
+#define B_STOPCAST 2
+#define B_STOPANIM 3
static void do_viewmenu(bContext *C, void *arg, int event)
{
@@ -328,6 +329,9 @@
case B_STOPCAST:
WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C));
break;
+ case B_STOPANIM:
+ ED_screen_animation_timer(C, 0, 0);
+ break;
}
}
@@ -444,6 +448,10 @@
uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_REC, "Capture", xco+5,yco,85,19, NULL, 0.0f, 0.0f, 0, 0, "Stop screencast");
xco+= 90;
}
+ if(screen->animtimer) {
+ uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_REC, "Anim Player", xco+5,yco,85,19, NULL, 0.0f, 0.0f, 0, 0, "Stop animation playback");
+ xco+= 90;
+ }
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
Modified: branches/blender2.5/blender/source/blender/editors/space_info/space_info.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_info/space_info.c 2009-05-21 13:32:15 UTC (rev 20315)
+++ branches/blender2.5/blender/source/blender/editors/space_info/space_info.c 2009-05-21 13:33:04 UTC (rev 20316)
@@ -43,6 +43,7 @@
#include "BKE_context.h"
#include "BKE_colortools.h"
#include "BKE_screen.h"
+#include "BKE_utildefines.h"
#include "ED_space_api.h"
#include "ED_screen.h"
@@ -196,7 +197,7 @@
/* context changes */
switch(wmn->category) {
case NC_SCREEN:
- if(wmn->data==ND_SCREENCAST)
+ if(ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list