diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-11 21:48:56 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-11 22:01:01 +0300 |
commit | 1ded3d2f7c04100698afdee356e2ba8d4ae2d6bd (patch) | |
tree | 6beeb28679ed0ab09c52e376e2969a58a86a2b69 /source/blender | |
parent | c97794520f030b03a87c5c7b386aeb64571f46f6 (diff) |
Fix T55668: Volume Keyframe on Cut-ted Metastrip (re-doing the fix in better way).
Fix T60194: Sequencer cut loses animation data for the right strip.
Fixing the first also fixes the second. First attempt was delaying
uniquename check at a later step of cut process, after everything had
been duplicated. While this fixed first issue, second one became even
more proeminent (it become active for all strips, and not only
video/audio movie strips in meta's).
So instead, passing along the list of (new) sequences, so that duplicated
seqs can be put there immediately, before checking for unique names,
henceforth ensuring even strips inside meta's get properly handled.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 38 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 16 |
3 files changed, 37 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 043f08adc17..d395fca0bbd 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -336,7 +336,8 @@ bool BKE_sequence_base_shuffle_time(ListBase *seqbasep, struct Scene *evil_scene bool BKE_sequence_base_isolated_sel_check(struct ListBase *seqbase); void BKE_sequencer_free_imbuf(struct Scene *scene, struct ListBase *seqbasep, bool for_render); struct Sequence *BKE_sequence_dupli_recursive( - const struct Scene *scene_src, struct Scene *scene_dst, struct Sequence *seq, int dupe_flag); + const struct Scene *scene_src, struct Scene *scene_dst, + struct ListBase *new_seq_list, struct Sequence *seq, int dupe_flag); int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str); bool BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index ce42f800253..21d092e5fa3 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1969,7 +1969,7 @@ void BKE_sequencer_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *se context = MEM_callocN(sizeof(SeqIndexBuildContext), "seq proxy rebuild context"); - nseq = BKE_sequence_dupli_recursive(scene, scene, seq, 0); + nseq = BKE_sequence_dupli_recursive(scene, scene, NULL, seq, 0); context->tc_flags = nseq->strip->proxy->build_tc_flags; context->size_flags = nseq->strip->proxy->build_size_flags; @@ -5429,7 +5429,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad return seq; } -static Sequence *seq_dupli(const Scene *scene_src, Scene *scene_dst, Sequence *seq, int dupe_flag, const int flag) +static Sequence *seq_dupli( + const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, int dupe_flag, const int flag) { Sequence *seqn = MEM_dupallocN(seq); @@ -5514,6 +5515,16 @@ static Sequence *seq_dupli(const Scene *scene_src, Scene *scene_dst, Sequence *s BLI_assert(0); } + /* When using SEQ_DUPE_UNIQUE_NAME, it is mandatory to add new sequences in relevant container + * (scene or meta's one), *before* checking for unique names. Otherwise the meta's list is empty + * and hence we miss all seqs in that meta that have already been duplicated (see T55668). + * Note that unique name check itslef could be done at a later step in calling code, once all seqs + * have bee duplicated (that was first, simpler solution), but then handling of animation data will + * be broken (see T60194). */ + if (new_seq_list != NULL) { + BLI_addtail(new_seq_list, seqn); + } + if (scene_src == scene_dst) { if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) { BKE_sequence_base_unique_name_recursive(&scene_dst->ed->seqbase, seqn); @@ -5549,22 +5560,30 @@ static void seq_new_fix_links_recursive(Sequence *seq) } } -Sequence *BKE_sequence_dupli_recursive(const Scene *scene_src, Scene *scene_dst, Sequence *seq, int dupe_flag) +static Sequence *sequence_dupli_recursive_do( + const Scene *scene_src, Scene *scene_dst, ListBase *new_seq_list, Sequence *seq, const int dupe_flag) { Sequence *seqn; seq->tmp = NULL; - seqn = seq_dupli(scene_src, scene_dst, seq, dupe_flag, 0); + seqn = seq_dupli(scene_src, scene_dst, new_seq_list, seq, dupe_flag, 0); if (seq->type == SEQ_TYPE_META) { Sequence *s; for (s = seq->seqbase.first; s; s = s->next) { - Sequence *n = BKE_sequence_dupli_recursive(scene_src, scene_dst, s, dupe_flag); - if (n) { - BLI_addtail(&seqn->seqbase, n); - } + sequence_dupli_recursive_do(scene_src, scene_dst, &seqn->seqbase, s, dupe_flag); } } + return seqn; +} + +Sequence *BKE_sequence_dupli_recursive( + const Scene *scene_src, Scene *scene_dst, + ListBase *new_seq_list, Sequence *seq, int dupe_flag) +{ + Sequence *seqn = sequence_dupli_recursive_do(scene_src, scene_dst, new_seq_list, seq, dupe_flag); + + /* This does not need to be in recursive call itself, since it is already recursive... */ seq_new_fix_links_recursive(seqn); return seqn; @@ -5583,14 +5602,13 @@ void BKE_sequence_base_dupli_recursive( for (seq = seqbase->first; seq; seq = seq->next) { seq->tmp = NULL; if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) { - seqn = seq_dupli(scene_src, scene_dst, seq, dupe_flag, flag); + seqn = seq_dupli(scene_src, scene_dst, nseqbase, seq, dupe_flag, flag); if (seqn) { /*should never fail */ if (dupe_flag & SEQ_DUPE_CONTEXT) { seq->flag &= ~SEQ_ALLSEL; seqn->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK); } - BLI_addtail(nseqbase, seqn); if (seq->type == SEQ_TYPE_META) { BKE_sequence_base_dupli_recursive( scene_src, scene_dst, &seqn->seqbase, &seq->seqbase, diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index cb0034b7914..0f382ad0270 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -665,7 +665,7 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de } -static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) +static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe) { TransSeq ts; Sequence *seqn = NULL; @@ -737,7 +737,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); + seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -786,7 +786,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) return seqn; } -static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) +static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, ListBase *new_seq_list, int cutframe) { TransSeq ts; Sequence *seqn = NULL; @@ -846,7 +846,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) if (!skip_dup) { /* Duplicate AFTER the first change */ - seqn = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); + seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -898,7 +898,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) */ static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe, - Sequence * (*cut_seq)(Scene *, Sequence *, int)) + Sequence * (*cut_seq)(Scene *, Sequence *, ListBase *, int)) { Sequence *seq, *seq_next_iter; Sequence *seq_first_new = NULL; @@ -912,9 +912,8 @@ static bool cut_seq_list(Scene *scene, ListBase *slist, int cutframe, if (cutframe > seq->startdisp && cutframe < seq->enddisp) { - Sequence *seqn = cut_seq(scene, seq, cutframe); + Sequence *seqn = cut_seq(scene, seq, slist, cutframe); if (seqn) { - BLI_addtail(slist, seqn); if (seq_first_new == NULL) { seq_first_new = seqn; } @@ -2411,8 +2410,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* new seq */ se = BKE_sequencer_give_stripelem(seq, cfra); - seq_new = BKE_sequence_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME); - BLI_addtail(ed->seqbasep, seq_new); + seq_new = BKE_sequence_dupli_recursive(scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME); seq_new->start = start_ofs; seq_new->type = SEQ_TYPE_IMAGE; |