diff options
Diffstat (limited to 'source/blender/editors/screen/screen_ops.c')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 166 |
1 files changed, 52 insertions, 114 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 2133681f8f9..1c6d46d231d 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -717,7 +717,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) else event.type = EVT_ACTIONZONE_REGION; - event.val = 0; + event.val = KM_NOTHING; event.customdata = op->customdata; event.customdatafree = true; op->customdata = NULL; @@ -990,6 +990,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event) rect.ymax = rect.ymin + BLI_rcti_size_y(&rect) / U.pixelsize; newwin = WM_window_open(C, &rect); + *newwin->stereo3d_format = *win->stereo3d_format; /* allocs new screen and adds to newly created window, using window size */ newsc = ED_screen_add(newwin, CTX_data_scene(C), sc->id.name + 2); @@ -2099,7 +2100,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, false); - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -2151,7 +2152,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, true); - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } @@ -2257,7 +2258,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) else { areas_do_frame_follow(C, true); - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -2319,7 +2320,7 @@ static int marker_jump_exec(bContext *C, wmOperator *op) areas_do_frame_follow(C, true); - sound_seek_scene(bmain, scene); + BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); @@ -3318,105 +3319,17 @@ static void SCREEN_OT_header_toolbox(wmOperatorType *ot) /* ****************** anim player, with timer ***************** */ -static int match_area_with_refresh(int spacetype, int refresh) -{ - switch (spacetype) { - case SPACE_TIME: - if (refresh & SPACE_TIME) - return 1; - break; - } - - return 0; -} - -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_NODE: - if (redraws & (TIME_NODES)) - return 1; - break; - case SPACE_IMAGE: - if (redraws & TIME_ALL_IMAGE_WIN) - return 1; - break; - case SPACE_CLIP: - if (redraws & TIME_CLIPS) - return 1; - break; - - } - } - else if (regiontype == RGN_TYPE_CHANNELS) { - switch (spacetype) { - case SPACE_IPO: - case SPACE_ACTION: - case SPACE_NLA: - if (redraws & TIME_ALL_ANIM_WIN) - return 1; - break; - } - } - else if (regiontype == RGN_TYPE_UI) { - if (spacetype == SPACE_CLIP) { - /* Track Preview button is on Properties Editor in SpaceClip, - * and it's very common case when users want it be refreshing - * during playback, so asking people to enable special option - * for this is a bit tricky, so add exception here for refreshing - * Properties Editor for SpaceClip always */ - return 1; - } - - if (redraws & TIME_ALL_BUTS_WIN) - return 1; - } - else if (regiontype == RGN_TYPE_HEADER) { - if (spacetype == SPACE_TIME) - return 1; - } - else if (regiontype == RGN_TYPE_PREVIEW) { - switch (spacetype) { - case SPACE_SEQ: - if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) - return 1; - break; - case SPACE_CLIP: - return 1; - } - } - return 0; -} +//#define PROFILE_AUDIO_SYNCH static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { bScreen *screen = CTX_wm_screen(C); +#ifdef PROFILE_AUDIO_SYNCH + static int old_frame = 0; + int newfra_int; +#endif + if (screen->animtimer && screen->animtimer == event->customdata) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -3435,14 +3348,21 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false && - finite(time = sound_sync_scene(scene))) + finite(time = BKE_sound_sync_scene(scene))) { - double newfra = (double)time * FPS; - /* give some space here to avoid jumps */ - if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra) - scene->r.cfra++; - else - scene->r.cfra = newfra + 0.5; + scene->r.cfra = (double)time * FPS; + +#ifdef PROFILE_AUDIO_SYNCH + newfra_int = scene->r.cfra; + if (newfra_int < old_frame) { + printf("back jump detected, frame %d!\n", newfra_int); + } + else if (newfra_int > old_frame + 1) { + printf("forward jump detected, frame %d!\n", newfra_int); + } + fflush(stdout); + old_frame = newfra_int; +#endif } else { if (sync) { @@ -3509,8 +3429,12 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv sad->flag |= ANIMPLAY_FLAG_JUMPED; } - if (sad->flag & ANIMPLAY_FLAG_JUMPED) - sound_seek_scene(bmain, scene); + if (sad->flag & ANIMPLAY_FLAG_JUMPED) { + BKE_sound_seek_scene(bmain, scene); +#ifdef PROFILE_AUDIO_SYNCH + old_frame = CFRA; +#endif + } /* since we follow drawflags, we can't send notifier but tag regions ourselves */ ED_update_for_newframe(bmain, scene, 1); @@ -3523,7 +3447,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv if (ar == sad->ar) { redraw = true; } - else if (match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) { + else if (ED_match_region_with_redraws(sa->spacetype, ar->regiontype, sad->redraws)) { redraw = true; } @@ -3549,7 +3473,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv } } - if (match_area_with_refresh(sa->spacetype, sad->refresh)) + if (ED_match_area_with_refresh(sa->spacetype, sad->refresh)) ED_area_tag_refresh(sa); } } @@ -3593,6 +3517,19 @@ bScreen *ED_screen_animation_playing(const wmWindowManager *wm) wmWindow *win; for (win = wm->windows.first; win; win = win->next) { + if (win->screen->animtimer || win->screen->scrubbing) { + return win->screen; + } + } + + return NULL; +} + +bScreen *ED_screen_animation_no_scrub(const wmWindowManager *wm) +{ + wmWindow *win; + + for (win = wm->windows.first; win; win = win->next) { if (win->screen->animtimer) { return win->screen; } @@ -3601,6 +3538,7 @@ bScreen *ED_screen_animation_playing(const wmWindowManager *wm) return NULL; } + /* toggle operator */ int ED_screen_animation_play(bContext *C, int sync, int mode) { @@ -3610,7 +3548,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) if (ED_screen_animation_playing(CTX_wm_manager(C))) { /* stop playback now */ ED_screen_animation_timer(C, 0, 0, 0, 0); - sound_stop_scene(scene); + BKE_sound_stop_scene(scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); } @@ -3618,7 +3556,7 @@ int ED_screen_animation_play(bContext *C, int sync, int mode) int refresh = SPACE_TIME; /* these settings are currently only available from a menu in the TimeLine */ if (mode == 1) /* XXX only play audio forwards!? */ - sound_play_scene(scene); + BKE_sound_play_scene(scene); ED_screen_animation_timer(C, screen->redraws_flag, refresh, sync, mode); @@ -4228,6 +4166,8 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "SCREEN_OT_area_dupli", EVT_ACTIONZONE_AREA, 0, KM_SHIFT, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_area_swap", EVT_ACTIONZONE_AREA, 0, KM_CTRL, 0); WM_keymap_verify_item(keymap, "SCREEN_OT_region_scale", EVT_ACTIONZONE_REGION, 0, 0, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", EVT_ACTIONZONE_FULLSCREEN, 0, 0, 0); + RNA_boolean_set(kmi->ptr, "use_hide_panels", true); /* area move after action zones */ WM_keymap_verify_item(keymap, "SCREEN_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0); @@ -4255,8 +4195,6 @@ void ED_keymap_screen(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", SPACEKEY, KM_PRESS, KM_SHIFT, 0); kmi = WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", F10KEY, KM_PRESS, KM_ALT, 0); RNA_boolean_set(kmi->ptr, "use_hide_panels", true); - kmi = WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", EVT_ACTIONZONE_FULLSCREEN, 0, 0, 0); - RNA_boolean_set(kmi->ptr, "use_hide_panels", true); WM_keymap_add_item(keymap, "SCREEN_OT_screenshot", F3KEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0); |