[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14228] trunk/blender/source/blender: == Sequencer ==

Peter Schlaile peter at schlaile.de
Mon Mar 24 18:35:01 CET 2008


Revision: 14228
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14228
Author:   schlaile
Date:     2008-03-24 18:35:01 +0100 (Mon, 24 Mar 2008)

Log Message:
-----------
== Sequencer ==

A lot of fixes for anim_startofs / anim_endofs:
* crashed when striplen was 0 and startstill / endstill still in use
* made it work for Audio (HD and RAM)
* made it work for Image Sequences
* added a new cutting tool, that uses anim_startofs / endofs instead of
  startofs / endofs. This is now the default and called "hard cut"
* moved old cutting method to "Shift-K" and renamed it "soft cut"

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/include/BIF_editseq.h
    trunk/blender/source/blender/src/buttons_scene.c
    trunk/blender/source/blender/src/drawseq.c
    trunk/blender/source/blender/src/editseq.c
    trunk/blender/source/blender/src/header_seq.c
    trunk/blender/source/blender/src/seqaudio.c
    trunk/blender/source/blender/src/sequence.c
    trunk/blender/source/blender/src/space.c

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -1528,7 +1528,7 @@
 						writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
 					}
 					if(seq->type==SEQ_IMAGE)
-						writestruct(wd, DATA, "StripElem", strip->len, strip->stripdata);
+						writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
 					else if(seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
 						writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
 

Modified: trunk/blender/source/blender/include/BIF_editseq.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editseq.h	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/include/BIF_editseq.h	2008-03-24 17:35:01 UTC (rev 14228)
@@ -71,7 +71,7 @@
 void				transform_seq(int mode, int context);
 void				transform_seq_nomarker(int mode, int context);
 void				un_meta(void);
-void				seq_cut(int cutframe);
+void				seq_cut(int cutframe, int hard_cut);
 void				seq_separate_images(void);
 void				reassign_inputs_seq_effect(void);
 void				select_surrounding_handles(struct Sequence *test);

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/src/buttons_scene.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -614,7 +614,7 @@
 			  130, 80, 120, 20, &last_seq->machine, 
 			  0.0, MAXSEQ, 0.0, 0.0, "Channel used (Y position)");
 		
-		if (check_single_seq(last_seq)) {
+		if (check_single_seq(last_seq) || last_seq->len == 0) {
 			uiDefButI(block, NUM, 
 				B_SEQ_BUT_TRANSFORM, "End-Still", 
 				130, 60, 120, 19, &last_seq->endstill, 
@@ -858,12 +858,12 @@
 		  B_SEQ_BUT_RELOAD_FILE, "A-Start", 
 		  10, 0, 120, 20, &last_seq->anim_startofs, 
 		  0.0, last_seq->len + last_seq->anim_startofs, 0.0, 0.0, 
-		  "Animation start offset in file");
+		  "Animation start offset (trim start)");
 	uiDefButI(block, NUM, 
 		  B_SEQ_BUT_RELOAD_FILE, "A-End", 
 		  130, 0, 120, 20, &last_seq->anim_endofs, 
 		  0.0, last_seq->len + last_seq->anim_endofs, 0.0, 0.0, 
-		  "Animation end offset in file");
+		  "Animation end offset (trim end)");
 
 
 	if (last_seq->type == SEQ_MOVIE) {
@@ -1235,8 +1235,8 @@
 		panels |= SEQ_PANEL_INPUT | SEQ_PANEL_FILTER | SEQ_PANEL_PROXY;
 	}
 
-	if (type == SEQ_RAM_SOUND) {
-		panels |= SEQ_PANEL_FILTER;
+	if (type == SEQ_RAM_SOUND || type == SEQ_HD_SOUND) {
+		panels |= SEQ_PANEL_FILTER | SEQ_PANEL_INPUT;
 	}
 
 	if (type == SEQ_PLUGIN || type >= SEQ_EFFECT) {

Modified: trunk/blender/source/blender/src/drawseq.c
===================================================================
--- trunk/blender/source/blender/src/drawseq.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/src/drawseq.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -308,8 +308,8 @@
 	
 	if (seq->flag & SEQ_MUTE) glColor3ub(0x70, 0x80, 0x80); else glColor3ub(0x70, 0xc0, 0xc0);
 	
-	sofs = ((int)( FRA2TIME(seq->startdisp-seq->start)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
-	eofs = ((int)( FRA2TIME(seq->enddisp-seq->start)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
+	sofs = ((int)( FRA2TIME(seq->startdisp-seq->start+seq->anim_startofs)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
+	eofs = ((int)( FRA2TIME(seq->enddisp-seq->start+seq->anim_startofs)*(float)G.scene->audio.mixrate*4.0 )) & (~3);
 	
 	/* clip the drawing area to the screen bounds to save time */
 	sample_step= (G.v2d->cur.xmax - G.v2d->cur.xmin)/winx;

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/src/editseq.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -2287,7 +2287,7 @@
 	}
 }
 
-static Sequence * cut_seq(Sequence * seq, int cutframe)
+static Sequence * cut_seq_hard(Sequence * seq, int cutframe)
 {
 	TransSeq ts;
 	Sequence *seqn = 0;
@@ -2300,6 +2300,98 @@
 	ts.endstill= seq->endstill;
 	ts.startdisp= seq->startdisp;
 	ts.enddisp= seq->enddisp;
+	ts.startofs= seq->anim_startofs;
+	ts.endofs= seq->anim_endofs;
+	ts.len= seq->len;
+	
+	/* First Strip! */
+	/* strips with extended stillfames before */
+	
+	if ((seq->startstill) && (cutframe <seq->start)) {
+		/* don't do funny things with METAs ... */
+		if (seq->type == SEQ_META) {
+			skip_dup = TRUE;
+			seq->startstill = seq->start - cutframe;
+		} else {
+			seq->start= cutframe -1;
+			seq->startstill= cutframe -seq->startdisp -1;
+			seq->anim_endofs += seq->len - 1;
+			seq->endstill= 0;
+		}
+	}
+	/* normal strip */
+	else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
+		seq->endofs = 0;
+		seq->endstill = 0;
+		seq->anim_endofs += (seq->start+seq->len) - cutframe;
+	}
+	/* strips with extended stillframes after */
+	else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
+		seq->endstill -= seq->enddisp - cutframe;
+		/* don't do funny things with METAs ... */
+		if (seq->type == SEQ_META) {
+			skip_dup = TRUE;
+		}
+	}
+	
+	reload_sequence_new_file(seq);
+	calc_sequence(seq);
+	
+	if (!skip_dup) {
+		/* Duplicate AFTER the first change */
+		seqn = deep_dupli_seq(seq);
+	}
+	
+	if (seqn) { 
+		seqn->flag |= SELECT;
+			
+		/* Second Strip! */
+		/* strips with extended stillframes before */
+		if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
+			seqn->start = ts.start;
+			seqn->startstill= ts.start- cutframe;
+			seqn->anim_endofs = ts.endofs;
+			seqn->endstill = ts.endstill;
+		}
+		
+		/* normal strip */
+		else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
+			seqn->start = cutframe;
+			seqn->startstill = 0;
+			seqn->startofs = 0;
+			seqn->anim_startofs += cutframe - ts.start;
+			seqn->anim_endofs = ts.endofs;
+			seqn->endstill = ts.endstill;
+		}				
+		
+		/* strips with extended stillframes after */
+		else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
+			seqn->start = cutframe;
+			seqn->startofs = 0;
+			seqn->anim_startofs += ts.len-1;
+			seqn->endstill = ts.enddisp - cutframe -1;
+			seqn->startstill = 0;
+		}
+		
+		reload_sequence_new_file(seqn);
+		calc_sequence(seqn);
+	}
+	return seqn;
+}
+
+static Sequence * cut_seq_soft(Sequence * seq, int cutframe)
+{
+	TransSeq ts;
+	Sequence *seqn = 0;
+	int skip_dup = FALSE;
+
+	/* backup values */
+	ts.start= seq->start;
+	ts.machine= seq->machine;
+	ts.startstill= seq->startstill;
+	ts.endstill= seq->endstill;
+	ts.startdisp= seq->startdisp;
+	ts.enddisp= seq->enddisp;
 	ts.startofs= seq->startofs;
 	ts.endofs= seq->endofs;
 	ts.len= seq->len;
@@ -2372,9 +2464,11 @@
 	return seqn;
 }
 
+
 /* 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(ListBase *old, ListBase *new, int cutframe)
+static int cut_seq_list(ListBase *old, ListBase *new, int cutframe,
+			Sequence * (*cut_seq)(Sequence *, int))
 {
 	int did_something = FALSE;
 	Sequence *seq, *seq_next;
@@ -2406,7 +2500,7 @@
 	return did_something;
 }
 
-void seq_cut(int cutframe)
+void seq_cut(int cutframe, int hard_cut)
 {
 	Editing *ed;
 	ListBase newlist;
@@ -2417,9 +2511,15 @@
 	if(ed==0) return;
 	
 	newlist.first= newlist.last= NULL;
+
+	if (hard_cut) {
+		did_something = cut_seq_list(
+			ed->seqbasep, &newlist, cutframe, cut_seq_hard);
+	} else {
+		did_something = cut_seq_list(
+			ed->seqbasep, &newlist, cutframe, cut_seq_soft);
+	}
 	
-	did_something = cut_seq_list(ed->seqbasep, &newlist, cutframe);
-	
 	if (newlist.first) { /* got new strips ? */
 		Sequence *seq;
 		addlisttolist(ed->seqbasep, &newlist);

Modified: trunk/blender/source/blender/src/header_seq.c
===================================================================
--- trunk/blender/source/blender/src/header_seq.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/src/header_seq.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -420,7 +420,7 @@
 		seq_snap(event);
 		break;
 	case 13: /* Cut at Current Frame */
-		seq_cut(CFRA);
+		seq_cut(CFRA, 1);
 		break;
 	case 14:
 		reassign_inputs_seq_effect();
@@ -446,6 +446,9 @@
 	case 21:
 		seq_mute_sel(0);
 		break;
+	case 22:
+		seq_cut(CFRA, 0);
+		break;
 	}
 }
 
@@ -467,7 +470,8 @@
 
 	uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 	
-	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (hard) at Current Frame|K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cut (soft) at Current Frame|Shift-K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
 	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate Images to Strips|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
 	
 	uiDefBut(block, SEPR, 0, "",        0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");

Modified: trunk/blender/source/blender/src/seqaudio.c
===================================================================
--- trunk/blender/source/blender/src/seqaudio.c	2008-03-24 11:55:43 UTC (rev 14227)
+++ trunk/blender/source/blender/src/seqaudio.c	2008-03-24 17:35:01 UTC (rev 14228)
@@ -471,8 +471,11 @@
 		}
 		if ((seq->type == SEQ_RAM_SOUND) && (seq->sound)) {
 			have_sound = 1;
-			seq->curpos = (int)( (FRA2TIME((double) startframe -
-						       (double) seq->start)
+			seq->curpos = (int)( (FRA2TIME(
+						      (double) startframe -
+						      (double) seq->start +
+						      (double) 
+						      seq->anim_startofs)
 					      * ((float)G.scene->audio.mixrate)
 					      * 4 ));
 		}
@@ -486,7 +489,9 @@
 				seq->hdaudio = sound_open_hdaudio(name);
 			}
 			seq->curpos = (int)( (FRA2TIME((double) startframe - 
-						       (double) seq->start)
+						       (double) seq->start +
+						       (double)
+						       seq->anim_startofs)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list