diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-11 22:03:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-01-11 22:03:42 +0300 |
commit | ee34275e7da798a1cc9c398ac9bba68ad3343c1b (patch) | |
tree | f039058be6f8f4aa41cdde2a8540430d8f0f4df3 /source | |
parent | bb9c9d0eaaab836b8f20ab7b2228795f607b823a (diff) | |
parent | 1ded3d2f7c04100698afdee356e2ba8d4ae2d6bd (diff) |
Merge branch 'blender2.7'
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 39 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 17 |
3 files changed, 38 insertions, 23 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index a850777f3f1..62c56c0dc24 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -335,7 +335,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); @@ -391,7 +392,7 @@ typedef struct SeqLoadInfo { /* seq_dupli' flags */ -#define SEQ_DUPE_UNIQUE_NAME (1 << 0) /* WARNING: does NOT work when duplicating Meta strips! */ +#define SEQ_DUPE_UNIQUE_NAME (1 << 0) #define SEQ_DUPE_CONTEXT (1 << 1) #define SEQ_DUPE_ANIM (1 << 2) #define SEQ_DUPE_ALL (1 << 3) /* otherwise only selected are copied */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5160e5ddffc..0f3f35477af 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1957,7 +1957,7 @@ void BKE_sequencer_proxy_rebuild_context( 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; @@ -5413,7 +5413,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); @@ -5498,9 +5499,18 @@ 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) { - /* TODO this is broken in case of Meta strips recursive duplication... Not trivial to fix. */ BKE_sequence_base_unique_name_recursive(&scene_dst->ed->seqbase, seqn); } @@ -5534,22 +5544,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; @@ -5568,14 +5586,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 b6f8552bd81..f0d5d6d00f7 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -667,7 +667,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; @@ -739,7 +739,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_ANIM); + seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -788,7 +788,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; @@ -848,7 +848,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_ANIM); + seqn = BKE_sequence_dupli_recursive(scene, scene, new_seq_list, seq, SEQ_DUPE_UNIQUE_NAME | SEQ_DUPE_ANIM); } if (seqn) { @@ -900,7 +900,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; @@ -914,9 +914,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; } @@ -2089,7 +2088,6 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op) SEQP_BEGIN (ed, seq) { - BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq); if (seq->seq1 || seq->seq2 || seq->seq3) { BKE_sequence_calc(scene, seq); } @@ -2391,8 +2389,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; |