Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_ops.c
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | static float frame_from_event(bContext *C, const wmEvent *event) | ||||
| /* respect preview range restrictions (if only allowed to move around within that range) */ | /* respect preview range restrictions (if only allowed to move around within that range) */ | ||||
| if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { | if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { | ||||
| CLAMP(frame, PSFRA, PEFRA); | CLAMP(frame, PSFRA, PEFRA); | ||||
| } | } | ||||
| return frame; | return frame; | ||||
| } | } | ||||
| static void change_frame_seq_preview_begin(bContext *C, const wmEvent *event) | static void change_frame_seq_preview_begin(bContext *C, | ||||
| const wmEvent *event, | |||||
| bool preview_hovered_sequence) | |||||
| { | { | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| bScreen *screen = CTX_wm_screen(C); | bScreen *screen = CTX_wm_screen(C); | ||||
| if (sa && sa->spacetype == SPACE_SEQ) { | if (sa && sa->spacetype == SPACE_SEQ) { | ||||
| SpaceSeq *sseq = sa->spacedata.first; | SpaceSeq *sseq = sa->spacedata.first; | ||||
| if (ED_space_sequencer_check_show_strip(sseq)) { | if (preview_hovered_sequence && ED_space_sequencer_check_show_strip(sseq)) { | ||||
| ED_sequencer_special_preview_set(C, event->mval); | ED_sequencer_special_preview_set(C, event->mval); | ||||
| } | } | ||||
| } | } | ||||
| if (screen) { | if (screen) { | ||||
| screen->scrubbing = true; | screen->scrubbing = true; | ||||
| } | } | ||||
| } | } | ||||
| Show All 21 Lines | |||||
| /* Modal Operator init */ | /* Modal Operator init */ | ||||
| static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| { | { | ||||
| /* Change to frame that mouse is over before adding modal handler, | /* Change to frame that mouse is over before adding modal handler, | ||||
| * as user could click on a single frame (jump to frame) as well as | * as user could click on a single frame (jump to frame) as well as | ||||
| * click-dragging over a range (modal scrubbing). | * click-dragging over a range (modal scrubbing). | ||||
| */ | */ | ||||
| RNA_float_set(op->ptr, "frame", frame_from_event(C, event)); | RNA_float_set(op->ptr, "frame", frame_from_event(C, event)); | ||||
| bool preview_hovered_sequence = RNA_boolean_get(op->ptr, "preview_hovered_sequence"); | |||||
| change_frame_seq_preview_begin(C, event); | change_frame_seq_preview_begin(C, event, preview_hovered_sequence); | ||||
| change_frame_apply(C, op); | change_frame_apply(C, op); | ||||
| /* add temp handler */ | /* add temp handler */ | ||||
| WM_event_add_modal_handler(C, op); | WM_event_add_modal_handler(C, op); | ||||
| return OPERATOR_RUNNING_MODAL; | return OPERATOR_RUNNING_MODAL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | static void ANIM_OT_change_frame(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_X | OPTYPE_UNDO_GROUPED; | ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_X | OPTYPE_UNDO_GROUPED; | ||||
| ot->undo_group = "Frame Change"; | ot->undo_group = "Frame Change"; | ||||
| /* rna */ | /* rna */ | ||||
| ot->prop = RNA_def_float( | ot->prop = RNA_def_float( | ||||
| ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); | ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME); | ||||
| prop = RNA_def_boolean(ot->srna, "snap", false, "Snap", ""); | prop = RNA_def_boolean(ot->srna, "snap", false, "Snap", ""); | ||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | RNA_def_property_flag(prop, PROP_SKIP_SAVE); | ||||
| prop = RNA_def_boolean( | |||||
| ot->srna, | |||||
| "preview_hovered_sequence", | |||||
| false, | |||||
| "Preview Hovered Sequence", | |||||
| "Only preview the sequence under the mouse when scrubbing in the video sequence editor"); | |||||
| RNA_def_property_flag(prop, PROP_SKIP_SAVE); | |||||
| } | } | ||||
| /* ****************** Start/End Frame Operators *******************************/ | /* ****************** Start/End Frame Operators *******************************/ | ||||
| static bool anim_set_end_frames_poll(bContext *C) | static bool anim_set_end_frames_poll(bContext *C) | ||||
| { | { | ||||
| ScrArea *sa = CTX_wm_area(C); | ScrArea *sa = CTX_wm_area(C); | ||||
| ▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines | |||||