/* Set the new frame number */ static void change_frame_apply(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); float frame = RNA_float_get(op->ptr, "frame"); bool do_snap = RNA_boolean_get(op->ptr, "snap"); if (do_snap) { if (CTX_wm_space_seq(C)) { frame = BKE_sequencer_find_next_prev_edit(scene, frame, SEQ_SIDE_BOTH, true, false, false); } else { frame = BKE_scene_frame_snap_by_seconds(scene, 1.0, frame); } } /* set the new frame number */ if (scene->r.flag & SCER_SHOW_SUBFRAME) { CFRA = (int)frame; SUBFRA = frame - (int)frame; } else { CFRA = round_fl_to_int(frame); SUBFRA = 0.0f; } FRAMENUMBER_MIN_CLAMP(CFRA); /* do updates */ BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); }
static void change_frame_apply(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); /* set the new frame number */ CFRA = RNA_int_get(op->ptr, "frame"); FRAMENUMBER_MIN_CLAMP(CFRA); SUBFRA = 0.0f; /* do updates */ BKE_sound_seek_scene(CTX_data_main(C), scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); }
/* Set the new frame number */ static void change_frame_apply(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); int frame = RNA_int_get(op->ptr, "frame"); bool do_snap = RNA_boolean_get(op->ptr, "snap"); if (do_snap && CTX_wm_space_seq(C)) { frame = BKE_sequencer_find_next_prev_edit(scene, frame, SEQ_SIDE_BOTH, true, false, false); } /* set the new frame number */ CFRA = frame; FRAMENUMBER_MIN_CLAMP(CFRA); SUBFRA = 0.0f; /* do updates */ BKE_sound_seek_scene(bmain, scene); WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); }
/* Set the new frame number */ static void graphview_cursor_apply(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SpaceIpo *sipo = CTX_wm_space_graph(C); /* adjust the frame * NOTE: sync this part of the code with ANIM_OT_change_frame */ CFRA = RNA_int_get(op->ptr, "frame"); FRAMENUMBER_MIN_CLAMP(CFRA); SUBFRA = 0.f; BKE_sound_seek_scene(bmain, scene); /* set the cursor value */ sipo->cursorVal = RNA_float_get(op->ptr, "value"); /* send notifiers - notifiers for frame should force an update for both vars ok... */ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); }
/* Set the new frame number */ static void graphview_cursor_apply(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); SpaceIpo *sipo = CTX_wm_space_graph(C); float frame = RNA_float_get(op->ptr, "frame"); /* this isn't technically "frame", but it'll do... */ /* adjust the frame or the cursor x-value */ if (sipo->mode == SIPO_MODE_DRIVERS) { /* adjust cursor x-value */ sipo->cursorTime = frame; } else { /* adjust the frame * NOTE: sync this part of the code with ANIM_OT_change_frame */ /* 1) frame is rounded to the nearest int, since frames are ints */ CFRA = round_fl_to_int(frame); if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { /* Clip to preview range * NOTE: Preview range won't go into negative values, * so only clamping once should be fine. */ CLAMP(CFRA, PSFRA, PEFRA); } else { /* Prevent negative frames */ FRAMENUMBER_MIN_CLAMP(CFRA); } SUBFRA = 0.0f; BKE_sound_seek_scene(bmain, scene); } /* set the cursor value */ sipo->cursorVal = RNA_float_get(op->ptr, "value"); /* send notifiers - notifiers for frame should force an update for both vars ok... */ WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene); }