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:
authorRichard Antalik <richardantalik@gmail.com>2021-05-19 00:38:33 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-05-19 00:41:47 +0300
commitd373b43f07f5403826035b5dee71b09f433b0540 (patch)
tree88bfe141f78f611a891e868f0dccb5a5fe31cbe0 /source/blender/sequencer/intern/utils.c
parentf7a14c116c4de9a0ac2a07d7c6fa3097a018a668 (diff)
VSE: Better handling of effect strip splitting
Splitting of effect strip alone wasn't handled properly. Previously this resulted in duplicating effect strip, and it was broken at least from 2.79. Change in rB8ec6b34b8eb2 was intended to allow splitting strips individually, so it can be used as RNA API function but also so it requires as little glue logic as possible. This is fixed by splitting all dependent strips at once in 2 separate ListBases for left and right strips. Strips can be finally moved into original `ListBase`. With this fix it is still possible to split strips individually with little glue logic. RNA API function could return list of split strips as well, currently at least one strip in chain will be provided so chain can be reconstructed on python side. Reviewed By: sergey Differential Revision: https://developer.blender.org/D10209
Diffstat (limited to 'source/blender/sequencer/intern/utils.c')
-rw-r--r--source/blender/sequencer/intern/utils.c76
1 files changed, 58 insertions, 18 deletions
diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c
index 6d5332b2b15..8da71b0ac56 100644
--- a/source/blender/sequencer/intern/utils.c
+++ b/source/blender/sequencer/intern/utils.c
@@ -33,10 +33,7 @@
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
-#include "BLI_listbase.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-#include "BLI_utildefines.h"
+#include "BLI_blenlib.h"
#include "BKE_image.h"
#include "BKE_main.h"
@@ -55,21 +52,24 @@
#include "proxy.h"
#include "utils.h"
-void SEQ_sort(Scene *scene)
+/**
+ * Sort strips in provided seqbase. Effect strips are trailing the list and they are sorted by
+ * channel position as well.
+ * This is important for SEQ_time_update_sequence to work properly
+ *
+ * \param seqbase: ListBase with strips
+ */
+
+void seq_sort_seqbase(ListBase *seqbase)
{
/* all strips together per kind, and in order of y location ("machine") */
- ListBase seqbase, effbase;
- Editing *ed = SEQ_editing_get(scene, false);
+ ListBase inputbase, effbase;
Sequence *seq, *seqt;
- if (ed == NULL) {
- return;
- }
-
- BLI_listbase_clear(&seqbase);
+ BLI_listbase_clear(&inputbase);
BLI_listbase_clear(&effbase);
- while ((seq = BLI_pophead(ed->seqbasep))) {
+ while ((seq = BLI_pophead(seqbase))) {
if (seq->type & SEQ_TYPE_EFFECT) {
seqt = effbase.first;
@@ -85,22 +85,40 @@ void SEQ_sort(Scene *scene)
}
}
else {
- seqt = seqbase.first;
+ seqt = inputbase.first;
while (seqt) {
if (seqt->machine >= seq->machine) {
- BLI_insertlinkbefore(&seqbase, seqt, seq);
+ BLI_insertlinkbefore(&inputbase, seqt, seq);
break;
}
seqt = seqt->next;
}
if (seqt == NULL) {
- BLI_addtail(&seqbase, seq);
+ BLI_addtail(&inputbase, seq);
}
}
}
- BLI_movelisttolist(&seqbase, &effbase);
- *(ed->seqbasep) = seqbase;
+ BLI_movelisttolist(seqbase, &inputbase);
+ BLI_movelisttolist(seqbase, &effbase);
+}
+
+/**
+ * Sort strips in active seqbase. Effect strips are trailing the list and they are sorted by
+ * channel position as well.
+ * This is important for SEQ_time_update_sequence to work properly
+ *
+ * \param scene: Scene to look for active seqbase in
+ */
+void SEQ_sort(Scene *scene)
+{
+ Editing *ed = SEQ_editing_get(scene, false);
+
+ if (ed == NULL) {
+ return;
+ }
+
+ seq_sort_seqbase(SEQ_active_seqbase_get(ed));
}
typedef struct SeqUniqueInfo {
@@ -612,3 +630,25 @@ int SEQ_recursive_apply(Sequence *seq, int (*apply_fn)(Sequence *, void *), void
return ret;
}
+
+/**
+ * Ensure, that provided Sequence has unique name. If animation data exists for this Sequence, it
+ * will be duplicated and mapped onto new name
+ *
+ * \param seq: Sequence which name will be ensured to be unique
+ * \param scene: Scene in which name must be unique
+ */
+void SEQ_ensure_unique_name(Sequence *seq, Scene *scene)
+{
+ char name[SEQ_NAME_MAXSTR];
+
+ BLI_strncpy_utf8(name, seq->name + 2, sizeof(name));
+ SEQ_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
+ SEQ_dupe_animdata(scene, name, seq->name + 2);
+
+ if (seq->type == SEQ_TYPE_META) {
+ LISTBASE_FOREACH (Sequence *, seq_child, &seq->seqbase) {
+ SEQ_ensure_unique_name(seq_child, scene);
+ }
+ }
+}