Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-03-22 17:22:28 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-03-22 17:22:28 +0400
commit44eb9cc2721463ee302dc3a74d45092bd10c12ac (patch)
tree63410f62967e0c9760eb72372f0448940e7fdd77 /source/blender/editors/space_sequencer/sequencer_edit.c
parent5cf739c2dad6002f4716f0ccf514bd2544e0698d (diff)
Fix #30491: Not Updating Scene Length
(also fixes special request from Ian for Mango) Added operator to update actual content length of all selected strips. Can be useful for scenes and movies as well after doing making changes to scene/movie. Can be improved further to deal better with cases when strip has got effect and it's get reshuffled because of overlapping after changing it's length.
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_edit.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index cd16b35ea25..8d04edd0c7f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -55,6 +55,7 @@
#include "BKE_sequencer.h"
#include "BKE_report.h"
#include "BKE_sound.h"
+#include "BKE_movieclip.h"
#include "IMB_imbuf.h"
@@ -3055,3 +3056,65 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
}
+
+static int sequencer_update_strip_length_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ Editing *ed = seq_give_editing(scene, FALSE);
+ Sequence *seq;
+ int update = FALSE;
+
+ SEQP_BEGIN(ed, seq) {
+ if ((seq->flag & SELECT)) {
+ 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->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);
+
+ update = TRUE;
+ }
+ }
+ }
+ SEQ_END
+
+ if (update) {
+ free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_update_strip_length(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Update Strip Length";
+ ot->idname = "SEQUENCER_OT_update_strip_length";
+ ot->description = "Update actual content length for selected strips";
+
+ /* api callbacks */
+ ot->exec = sequencer_update_strip_length_exec;
+ ot->poll = ED_operator_sequencer_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}