diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 25 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_ops.c | 3 |
5 files changed, 20 insertions, 43 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 50793f1358b..53d87323d78 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -285,7 +285,10 @@ class SEQUENCER_MT_strip(Menu): #} layout.separator() - layout.operator("sequencer.reload") + props = layout.operator("sequencer.reload", text="Reload Strips") + props.adjust_length = False + props = layout.operator("sequencer.reload", text="Reload Strips and Adjust Length") + props.adjust_length = True layout.operator("sequencer.reassign_inputs") layout.operator("sequencer.swap_inputs") layout.separator() diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 8f53dc041a3..7a84e71c763 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -348,6 +348,4 @@ extern SequencerDrawView sequencer_view3d_cb; extern ListBase seqbase_clipboard; extern int seqbase_clipboard_frame; -void seq_update_sequence_length(struct Scene *scene, struct Editing *ed, struct Sequence *seq); - #endif // __BKE_SEQUENCER_H__ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 94069f94f4d..18749d7b5a6 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -4007,31 +4007,3 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase, } } } - -void seq_update_sequence_length(Scene *scene, Editing *ed, Sequence *seq) -{ - int changed = FALSE; - - switch (seq->type) { - case SEQ_SCENE: - seq->len = seq->scene->r.efra - seq->scene->r.sfra + 1; - changed = TRUE; - break; - case SEQ_MOVIECLIP: - seq->len = BKE_movieclip_get_duration(seq->clip); - changed = TRUE; - break; - case SEQ_MOVIE: - seq_open_anim_file(seq); - seq->len = IMB_anim_get_duration(seq->anim, IMB_TC_RECORD_RUN); - changed = TRUE; - break; - } - - if (changed) { - calc_sequence_disp(scene, seq); - - if (seq_test_overlap(ed->seqbasep, seq)) - shuffle_seq(ed->seqbasep, seq, scene); - } -} diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 0afb2e461b5..a2c74d067f9 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1273,15 +1273,22 @@ void SEQUENCER_OT_unlock(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op)) +static int sequencer_reload_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); Sequence *seq; + int adjust_length= RNA_boolean_get(op->ptr, "adjust_length"); for (seq= ed->seqbasep->first; seq; seq= seq->next) { if (seq->flag & SELECT) { update_changed_seq_and_deps(scene, seq, 0, 1); + reload_sequence_new_file(scene, seq, !adjust_length); + + if (adjust_length) { + if (seq_test_overlap(ed->seqbasep, seq)) + shuffle_seq(ed->seqbasep, seq, scene); + } } } @@ -1292,6 +1299,8 @@ static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op)) void SEQUENCER_OT_reload(struct wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Reload Strips"; ot->idname = "SEQUENCER_OT_reload"; @@ -1303,26 +1312,18 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */ -} - -/* reload operator */ -static void sequencer_refresh_all_length(Scene *scene, Editing *ed) -{ - Sequence *seq; - SEQP_BEGIN(ed, seq) { - seq_update_sequence_length(scene, ed, seq); - } - SEQ_END + prop = RNA_def_boolean(ot->srna, "adjust_length", 0, "Adjust Length", "Adjust lenght of strips to their data length"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } +/* reload operator */ static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE); - sequencer_refresh_all_length(scene, ed); WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index c0f1bd219f2..797d6fa36b8 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -159,7 +159,10 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); + RNA_boolean_set(kmi->ptr, "adjust_length", TRUE); WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0); |