Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_ops.c
| Show First 20 Lines • Show All 2,979 Lines • ▼ Show 20 Lines | static int frame_offset_exec(bContext *C, wmOperator *op) | ||||
| int delta = RNA_int_get(op->ptr, "delta"); | int delta = RNA_int_get(op->ptr, "delta"); | ||||
| CFRA += delta; | CFRA += delta; | ||||
| FRAMENUMBER_MIN_CLAMP(CFRA); | FRAMENUMBER_MIN_CLAMP(CFRA); | ||||
| SUBFRA = 0.0f; | SUBFRA = 0.0f; | ||||
| areas_do_frame_follow(C, false); | areas_do_frame_follow(C, false); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); | DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCREEN_OT_frame_offset(wmOperatorType *ot) | static void SCREEN_OT_frame_offset(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (RNA_boolean_get(op->ptr, "end")) { | ||||
| CFRA = PEFRA; | CFRA = PEFRA; | ||||
| } | } | ||||
| else { | else { | ||||
| CFRA = PSFRA; | CFRA = PSFRA; | ||||
| } | } | ||||
| areas_do_frame_follow(C, true); | areas_do_frame_follow(C, true); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); | DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | ||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCREEN_OT_frame_jump(wmOperatorType *ot) | static void SCREEN_OT_frame_jump(wmOperatorType *ot) | ||||
| ▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | static int keyframe_jump_exec(bContext *C, wmOperator *op) | ||||
| if (done == false) { | if (done == false) { | ||||
| BKE_report(op->reports, RPT_INFO, "No more keyframes to jump to in this direction"); | BKE_report(op->reports, RPT_INFO, "No more keyframes to jump to in this direction"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| areas_do_frame_follow(C, true); | areas_do_frame_follow(C, true); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); | DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) | static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (!found) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| CFRA = closest; | CFRA = closest; | ||||
| areas_do_frame_follow(C, true); | areas_do_frame_follow(C, true); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); | DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCREEN_OT_marker_jump(wmOperatorType *ot) | static void SCREEN_OT_marker_jump(wmOperatorType *ot) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,384 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| 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_FRAME_CHANGE) { | ||||
| /* 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))) { | ||||
| double newfra = time * FPS; | double newfra = time * FPS; | ||||
| /* give some space here to avoid jumps */ | /* give some space here to avoid jumps */ | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | #endif | ||||
| /* next frame overridden by user action (pressed jump to first/last frame) */ | /* next frame overridden by user action (pressed jump to first/last frame) */ | ||||
| if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) { | if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) { | ||||
| scene->r.cfra = sad->nextfra; | scene->r.cfra = sad->nextfra; | ||||
| sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; | sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME; | ||||
| sad->flag |= ANIMPLAY_FLAG_JUMPED; | sad->flag |= ANIMPLAY_FLAG_JUMPED; | ||||
| } | } | ||||
| if (sad->flag & ANIMPLAY_FLAG_JUMPED) { | if (sad->flag & ANIMPLAY_FLAG_JUMPED) { | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_AUDIO_SEEK); | DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); | ||||
| #ifdef PROFILE_AUDIO_SYNCH | #ifdef PROFILE_AUDIO_SYNCH | ||||
| old_frame = CFRA; | old_frame = CFRA; | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* since we follow drawflags, we can't send notifier but tag regions ourselves */ | /* since we follow drawflags, we can't send notifier but tag regions ourselves */ | ||||
| if (depsgraph != NULL) { | if (depsgraph != NULL) { | ||||
| ED_update_for_newframe(bmain, depsgraph); | ED_update_for_newframe(bmain, depsgraph); | ||||
| ▲ Show 20 Lines • Show All 1,054 Lines • Show Last 20 Lines | |||||