Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Show First 20 Lines • Show All 4,281 Lines • ▼ Show 20 Lines | static bool match_region_with_redraws(eSpace_Type spacetype, | ||||
| if (regiontype == RGN_TYPE_WINDOW) { | if (regiontype == RGN_TYPE_WINDOW) { | ||||
| switch (spacetype) { | switch (spacetype) { | ||||
| case SPACE_VIEW3D: | case SPACE_VIEW3D: | ||||
| if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) { | if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| break; | break; | ||||
| case SPACE_GRAPH: | |||||
| case SPACE_NLA: | |||||
| if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit) { | |||||
| return true; | |||||
| } | |||||
| break; | |||||
| case SPACE_ACTION: | |||||
| /* if only 1 window or 3d windows, we do timeline too | |||||
| * NOTE: Now we do action editor in all these cases, since timeline is here. */ | |||||
| if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit) { | |||||
| return true; | |||||
| } | |||||
| break; | |||||
| case SPACE_PROPERTIES: | case SPACE_PROPERTIES: | ||||
| if (redraws & TIME_ALL_BUTS_WIN) { | if (redraws & TIME_ALL_BUTS_WIN) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| break; | break; | ||||
| case SPACE_SEQ: | case SPACE_SEQ: | ||||
| if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit) { | if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit) { | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | switch (spacetype) { | ||||
| return true; | return true; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static void screen_animation_action_region_tag_redraw(ARegion *region) | |||||
| { | |||||
| switch (region->regiontype) { | |||||
| case RGN_TYPE_UI: | |||||
| case RGN_TYPE_HEADER: { | |||||
| ED_region_tag_redraw(region); | |||||
| break; | |||||
| } | |||||
| case RGN_TYPE_WINDOW: { | |||||
| // ED_region_tag_redraw_editor_overlays(region); | |||||
| break; | |||||
| } | |||||
| default: { | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| static bool screen_animation_region_supports_time_follow(ScrArea *area, ARegion *region) | |||||
| { | |||||
| return (region->regiontype == RGN_TYPE_WINDOW && | |||||
| ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || | |||||
| (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW); | |||||
| } | |||||
| static void screen_animation_region_tag_redraw(ScrArea *area, | |||||
| ARegion *region, | |||||
| const Scene *scene, | |||||
| eScreen_Redraws_Flag redraws) | |||||
| { | |||||
| /* do follow here if editor type supports it */ | |||||
| if ((redraws & TIME_FOLLOW) && screen_animation_region_supports_time_follow(area, region)) { | |||||
| float w = BLI_rctf_size_x(®ion->v2d.cur); | |||||
| if (scene->r.cfra < region->v2d.cur.xmin) { | |||||
| region->v2d.cur.xmax = scene->r.cfra; | |||||
| region->v2d.cur.xmin = region->v2d.cur.xmax - w; | |||||
| /* Tag region for a complete redraw. */ | |||||
| ED_region_tag_redraw(region); | |||||
| return; | |||||
| } | |||||
| else if (scene->r.cfra > region->v2d.cur.xmax) { | |||||
| region->v2d.cur.xmin = scene->r.cfra; | |||||
| region->v2d.cur.xmax = region->v2d.cur.xmin + w; | |||||
| /* Tag region for a complete redraw. */ | |||||
| ED_region_tag_redraw(region); | |||||
| return; | |||||
| } | |||||
| } | |||||
| switch (area->spacetype) { | |||||
| case SPACE_ACTION: { | |||||
| /* for TIME mode we should draw the header as it contains the current frame number | |||||
| */ | |||||
| screen_animation_action_region_tag_redraw(region); | |||||
| break; | |||||
| } | |||||
| default: | |||||
| ED_region_tag_redraw(region); | |||||
| break; | |||||
| } | |||||
| } | |||||
| //#define PROFILE_AUDIO_SYNCH | //#define PROFILE_AUDIO_SYNCH | ||||
| static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) | ||||
| { | { | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| #ifdef PROFILE_AUDIO_SYNCH | #ifdef PROFILE_AUDIO_SYNCH | ||||
| Show All 22 Lines | if (screen->animtimer && screen->animtimer == event->customdata) { | ||||
| else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) { | else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) { | ||||
| sync = 0; | sync = 0; | ||||
| } | } | ||||
| else { | else { | ||||
| sync = (scene->flag & SCE_FRAME_DROP); | sync = (scene->flag & SCE_FRAME_DROP); | ||||
| } | } | ||||
| if (scene_eval == NULL) { | if (scene_eval == NULL) { | ||||
| /* Happens when undo/redo system is used during playback, nothing meaningful we can do here. | /* Happens when undo/redo system is used during playback, nothing meaningful we can do | ||||
| * here. | |||||
| */ | */ | ||||
| } | } | ||||
| else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { | else if (scene_eval->id.recalc & ID_RECALC_AUDIO_SEEK) { | ||||
| /* Ignore seek here, the audio will be updated to the scene frame after jump during next | /* Ignore seek here, the audio will be updated to the scene frame after jump during next | ||||
| * dependency graph update. */ | * dependency graph update. */ | ||||
| } | } | ||||
| else if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false && | else if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false && | ||||
| isfinite(time = BKE_sound_sync_scene(scene_eval))) { | isfinite(time = BKE_sound_sync_scene(scene_eval))) { | ||||
| ▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | for (window = wm->windows.first; window; window = window->next) { | ||||
| redraw = true; | redraw = true; | ||||
| } | } | ||||
| else if (match_region_with_redraws( | else if (match_region_with_redraws( | ||||
| area->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) { | area->spacetype, region->regiontype, sad->redraws, sad->from_anim_edit)) { | ||||
| redraw = true; | redraw = true; | ||||
| } | } | ||||
| if (redraw) { | if (redraw) { | ||||
| ED_region_tag_redraw(region); | screen_animation_region_tag_redraw(area, region, scene, sad->redraws); | ||||
| /* do follow here if editor type supports it */ | |||||
| if ((sad->redraws & TIME_FOLLOW)) { | |||||
| if ((region->regiontype == RGN_TYPE_WINDOW && | |||||
| ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) || | |||||
| (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) { | |||||
| float w = BLI_rctf_size_x(®ion->v2d.cur); | |||||
| if (scene->r.cfra < region->v2d.cur.xmin) { | |||||
| region->v2d.cur.xmax = scene->r.cfra; | |||||
| region->v2d.cur.xmin = region->v2d.cur.xmax - w; | |||||
| } | |||||
| else if (scene->r.cfra > region->v2d.cur.xmax) { | |||||
| region->v2d.cur.xmin = scene->r.cfra; | |||||
| region->v2d.cur.xmax = region->v2d.cur.xmin + w; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* update frame rate info too | /* update frame rate info too | ||||
| * NOTE: this may not be accurate enough, since we might need this after modifiers/etc. | * NOTE: this may not be accurate enough, since we might need this after modifiers/etc. | ||||
| * have been calculated instead of just before updates have been done? | * have been calculated instead of just before updates have been done? | ||||
| ▲ Show 20 Lines • Show All 1,025 Lines • Show Last 20 Lines | |||||