[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54618] trunk/blender/source/blender/ editors/space_sequencer/sequencer_edit.c: == Sequencer ==

Peter Schlaile peter at schlaile.de
Sun Feb 17 22:44:13 CET 2013


Revision: 54618
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54618
Author:   schlaile
Date:     2013-02-17 21:44:13 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
== Sequencer ==

This fixes a bug in sequencer cut tool:

* if you cut two strips of the same name class (MVI_XXXX.MOV and MVI_XXXX.001) 
  the two new generated strips will end up with the same name.
  (easy test case: add a MOV file with it's accompanying audio track to the
  timeline and then cut both strips at once into two pieces)
  
* visible problem: your animation data will get messed up on the way, since
  the animation system doesn't know, which strip it should assign the
  animation.
  
Problem was caused by generating a new list of sequences within the 
cut_seq_list() function:

Since dupli_seq() can't see the members of the new list of sequences, it
won't be able to assign unique names in all cases.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2013-02-17 19:38:08 UTC (rev 54617)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c	2013-02-17 21:44:13 UTC (rev 54618)
@@ -817,40 +817,56 @@
 
 
 /* like duplicate, but only duplicate and cut overlapping strips,
- * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
-static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
+ * strips to the left of the cutframe are ignored and strips to the right 
+ * are moved to the end of slist
+ * we have to work on the same slist (not using a seperate list), since
+ * otherwise dupli_seq can't check for duplicate names properly and
+ * may generate strips with the same name (which will mess up animdata)
+ */
+
+static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe,
                         Sequence * (*cut_seq)(Scene *, Sequence *, int))
 {
 	int did_something = FALSE;
 	Sequence *seq, *seq_next_iter;
 	
-	seq = old->first;
+	for (seq = slist->first; seq; seq = seq->next) {
+		seq->tmp = NULL;
+	}
 	
-	while (seq) {
+	seq = slist->first;
+
+	while (seq && !seq->tmp) {
 		seq_next_iter = seq->next; /* we need this because we may remove seq */
-		
-		seq->tmp = NULL;
+		/* only handle strips not marked as new */
 		if (seq->flag & SELECT) {
 			if (cutframe > seq->startdisp && 
 			    cutframe < seq->enddisp)
 			{
 				Sequence *seqn = cut_seq(scene, seq, cutframe);
 				if (seqn) {
-					BLI_addtail(new, seqn);
+					BLI_addtail(slist, seqn);
+					seqn->tmp = seq; /* mark as new */
+					did_something = TRUE;
 				}
-				did_something = TRUE;
 			}
 			else if (seq->enddisp <= cutframe) {
 				/* do nothing */
 			}
 			else if (seq->startdisp >= cutframe) {
-				/* move into new list */
-				BLI_remlink(old, seq);
-				BLI_addtail(new, seq);
+				/* move to tail and mark as new */
+				BLI_remlink(slist, seq);
+				BLI_addtail(slist, seq);
+				seq->tmp = seq;
 			}
 		}
 		seq = seq_next_iter;
 	}
+
+	for (; seq; seq = seq->next) {
+		seq->tmp = NULL;
+	}
+
 	return did_something;
 }
 
@@ -1488,25 +1504,21 @@
 	Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
 	int cut_side, cut_hard, cut_frame;
 
-	ListBase newlist;
 	int changed;
 
 	cut_frame = RNA_int_get(op->ptr, "frame");
 	cut_hard = RNA_enum_get(op->ptr, "type");
 	cut_side = RNA_enum_get(op->ptr, "side");
 	
-	newlist.first = newlist.last = NULL;
-
 	if (cut_hard == SEQ_CUT_HARD) {
-		changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
+		changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_hard);
 	}
 	else {
-		changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
+		changed = cut_seq_list(scene, ed->seqbasep, cut_frame, cut_seq_soft);
 	}
 	
-	if (newlist.first) { /* got new strips ? */
+	if (changed) { /* got new strips ? */
 		Sequence *seq;
-		BLI_movelisttolist(ed->seqbasep, &newlist);
 
 		if (cut_side != SEQ_SIDE_BOTH) {
 			SEQP_BEGIN (ed, seq)




More information about the Bf-blender-cvs mailing list