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

Peter Schlaile peter at schlaile.de
Tue Jan 29 13:26:43 CET 2008


Revision: 13451
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13451
Author:   schlaile
Date:     2008-01-29 13:26:42 +0100 (Tue, 29 Jan 2008)

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

This fixes several crashes with the new tstripdata_start/endstill.
dupli_seq was cleaned up as well as add_scene_strip (moved to a 
seperate function)

New features: 
* opacity can be used in replace blend mode
* the scene within in a scene track can be changed now within the panel

Also:
* [#7842] Note: setCodec in FormatTab disappeared...
  should be fixed by this. (Not a big change, so I just commit and see :)
  http://peter.schlaile.de/blender/sequencer/codec_buttons.diff

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/makesdna/DNA_sequence_types.h
    trunk/blender/source/blender/src/buttons_scene.c
    trunk/blender/source/blender/src/editseq.c
    trunk/blender/source/blender/src/sequence.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2008-01-29 12:20:42 UTC (rev 13450)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2008-01-29 12:26:42 UTC (rev 13451)
@@ -3396,6 +3396,8 @@
 			if(seq->strip && seq->strip->done==0) {
 				seq->strip->done= 1;
 				seq->strip->tstripdata = 0;
+				seq->strip->tstripdata_startstill = 0;
+				seq->strip->tstripdata_endstill = 0;
 
 				if(seq->type == SEQ_IMAGE ||
 				   seq->type == SEQ_MOVIE ||

Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2008-01-29 12:20:42 UTC (rev 13450)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2008-01-29 12:26:42 UTC (rev 13451)
@@ -160,6 +160,9 @@
 
 	int blend_mode;
 	float blend_opacity;
+
+	int scenenr;          /* for scene selection */
+	int pad;
 } Sequence;
 
 typedef struct MetaStack {

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c	2008-01-29 12:20:42 UTC (rev 13450)
+++ trunk/blender/source/blender/src/buttons_scene.c	2008-01-29 12:26:42 UTC (rev 13451)
@@ -514,6 +514,43 @@
 	return string;
 }
 
+static char* seq_panel_scenes()
+{
+	static char rstr[8192];
+	char * str;
+
+	IDnames_to_pupstring(&str, NULL, NULL, 
+			     &G.main->scene, (ID *)G.scene, NULL);
+
+	strncpy(rstr, str, 8192);
+	MEM_freeN(str);
+
+	return rstr;
+}
+
+static void seq_update_scenenr(Sequence * seq)
+{
+	Scene * sce;
+	int nr;
+	if (seq->type != SEQ_SCENE) {
+		return;
+	}
+
+	seq->scenenr = 0;
+
+	sce = G.main->scene.first;
+	nr = 1;
+	while(sce) {
+		if (sce == seq->scene) {
+			seq->scenenr = nr;
+			break;
+		}
+		nr++;
+		sce = sce->id.next;
+	}
+}
+
+
 static void seq_panel_editing()
 {
 	Sequence *last_seq = get_last_seq();
@@ -543,12 +580,10 @@
 		  10, 120, 120, 19, &last_seq->blend_mode, 
 		  0,0,0,0, "Strip Blend Mode");
 
-	if (last_seq->blend_mode > 0) {
-		uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Blend:",
-			  130, 120, 120, 19, &last_seq->blend_opacity, 
-			  0.0, 100.0, 100.0, 0, 
-			  "Blend opacity");
-	}
+	uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Blend:",
+		  130, 120, 120, 19, &last_seq->blend_opacity, 
+		  0.0, 100.0, 100.0, 0, 
+		  "Blend opacity");
 
 	uiDefButBitI(block, TOG, SEQ_MUTE,
 		     B_SEQ_BUT_RELOAD_ALL, "Mute",
@@ -716,7 +751,7 @@
 		if (se) {
 			uiDefBut(block, TEX, 
 				 B_SEQ_BUT_RELOAD_FILE, "File: ", 
-				 10, 120, 240,19, se->name, 
+				 10, 120, 190,19, se->name, 
 				 0.0, 80.0, 100, 0, "");
 		}
 
@@ -725,10 +760,21 @@
 		   last_seq->type == SEQ_RAM_SOUND) {
 		uiDefBut(block, TEX, 
 			 B_SEQ_BUT_RELOAD_FILE, "File: ", 
-			 10,120,240,19, last_seq->strip->stripdata->name, 
+			 10,120,190,19, last_seq->strip->stripdata->name, 
 			 0.0, 80.0, 100, 0, "");
+	} else if (last_seq->type == SEQ_SCENE) {
+		seq_update_scenenr(last_seq);
+		uiDefButI(block, MENU, B_SEQ_BUT_RELOAD_FILE, 
+			  seq_panel_scenes(), 
+			  10, 120, 190, 19, &last_seq->scenenr, 
+			  0,0,0,0, "Linked Scene");
 	}
 
+	uiDefBut(block, BUT, B_SEQ_BUT_RELOAD_FILE, 
+		 "Reload",
+		 200,120,50,19, 0, 0, 0, 0, 0, 
+		 "Reload files/scenes from disk and update strip length.");
+
 	if (last_seq->type == SEQ_MOVIE 
 	    || last_seq->type == SEQ_IMAGE 
 	    || last_seq->type == SEQ_SCENE) {
@@ -2306,11 +2352,7 @@
 
 	if(G.scene->r.quality==0) G.scene->r.quality= 90;
 
-#ifdef WITH_QUICKTIME
 	if (G.scene->r.imtype == R_AVICODEC || G.scene->r.imtype == R_QUICKTIME) {
-#else /* WITH_QUICKTIME */
-	if (0) {
-#endif
 		if(G.scene->r.imtype == R_QUICKTIME) {
 #ifdef WITH_QUICKTIME
 #if defined (_WIN32) || defined (__APPLE__)

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c	2008-01-29 12:20:42 UTC (rev 13450)
+++ trunk/blender/source/blender/src/editseq.c	2008-01-29 12:26:42 UTC (rev 13451)
@@ -1458,6 +1458,50 @@
 	transform_seq_nomarker('g', 0);
 }
 
+static void add_scene_strip(short event)
+{
+	Sequence *seq;
+	Strip *strip;
+	float x, y;
+	int cfra, machine;
+	short mval[2];
+
+	if(event> -1) {
+		int nr= 1;
+		Scene * sce= G.main->scene.first;
+		while(sce) {
+			if( event==nr) break;
+			nr++;
+			sce= sce->id.next;
+		}
+		if(sce) {
+
+			deselect_all_seq();
+
+			/* where ? */
+			getmouseco_areawin(mval);
+			areamouseco_to_ipoco(G.v2d, mval, &x, &y);
+			cfra= (int)(x+0.5);
+			machine= (int)(y+0.5);
+			
+			seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
+			seq->type= SEQ_SCENE;
+			seq->scene= sce;
+			seq->sfra= sce->r.sfra;
+			seq->len= sce->r.efra - sce->r.sfra + 1;
+			
+			seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+			strncpy(seq->name + 2, sce->id.name + 2, 
+				sizeof(seq->name) - 2);
+			strip->len= seq->len;
+			strip->us= 1;
+			
+			BIF_undo_push("Add Scene Strip, Sequencer");
+			transform_seq_nomarker('g', 0);
+		}
+	}
+}
+
 #if 0
 static void reload_sound_strip(char *name)
 {
@@ -1713,12 +1757,7 @@
 void add_sequence(int type)
 {
 	Editing *ed;
-	Sequence *seq;
-	Strip *strip;
-	Scene *sce;
-	float x, y;
-	int cfra, machine;
-	short nr, event, mval[2];
+	short event;
 	char *str;
 
 	if (type >= 0){
@@ -1844,43 +1883,8 @@
 		/* new menu: */
 		IDnames_to_pupstring(&str, NULL, NULL, &G.main->scene, (ID *)G.scene, NULL);
 
-		event= pupmenu_col(str, 20);
+		add_scene_strip(pupmenu_col(str, 20));
 
-		if(event> -1) {
-			nr= 1;
-			sce= G.main->scene.first;
-			while(sce) {
-				if( event==nr) break;
-				nr++;
-				sce= sce->id.next;
-			}
-			if(sce) {
-
-				deselect_all_seq();
-
-				/* where ? */
-				getmouseco_areawin(mval);
-				areamouseco_to_ipoco(G.v2d, mval, &x, &y);
-				cfra= (int)(x+0.5);
-				machine= (int)(y+0.5);
-
-				seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine);
-				seq->type= SEQ_SCENE;
-				seq->scene= sce;
-				seq->sfra= sce->r.sfra;
-				seq->len= sce->r.efra - sce->r.sfra + 1;
-
-				seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-				strncpy(seq->name + 2, sce->id.name + 2, 
-					sizeof(seq->name) - 2);
-				strip->len= seq->len;
-				strip->us= 1;
-				if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
-				BIF_undo_push("Add Scene Strip, Sequencer");
-				transform_seq_nomarker('g', 0);
-			}
-		}
 		MEM_freeN(str);
 
 		break;
@@ -2161,81 +2165,60 @@
 	allqueue(REDRAWSEQ, 0);
 }
 
-static Sequence *dupli_seq(Sequence *seq) {
-	Sequence *seqn = NULL;
+static Sequence *dupli_seq(Sequence *seq) 
+{
+	Sequence *seqn = MEM_dupallocN(seq);
+
+	seq->tmp = seqn;
+		
+	seqn->strip= MEM_dupallocN(seq->strip);
+
+	if(seqn->ipo) seqn->ipo->id.us++;
+
+	seqn->strip->tstripdata = 0;
+	seqn->strip->tstripdata_startstill = 0;
+	seqn->strip->tstripdata_endstill = 0;
+
+	if (seq->strip->crop) {
+		seqn->strip->crop = MEM_dupallocN(seq->strip->crop);
+	}
+
+	if (seq->strip->transform) {
+		seqn->strip->transform = MEM_dupallocN(seq->strip->transform);
+	}
+
+	if (seq->strip->proxy) {
+		seqn->strip->proxy = MEM_dupallocN(seq->strip->proxy);
+	}
 	
 	if(seq->type==SEQ_META) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-		
-		seqn->strip= MEM_dupallocN(seq->strip);
 		seqn->strip->stripdata = 0;
-		seqn->strip->tstripdata = 0;
 
 		seqn->seqbase.first= seqn->seqbase.last= 0;
 		/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
 		/* - recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);*/
-	}
-	else if(seq->type == SEQ_SCENE) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
-		seqn->strip= MEM_dupallocN(seq->strip);
+	} else if(seq->type == SEQ_SCENE) {
 		seqn->strip->stripdata = 0;
-		seqn->strip->tstripdata = 0;
-	}
-	else if(seq->type == SEQ_MOVIE) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
-		seqn->strip= MEM_dupallocN(seq->strip);
+	} else if(seq->type == SEQ_MOVIE) {
 		seqn->strip->stripdata = 
 				MEM_dupallocN(seq->strip->stripdata);
-		seqn->strip->tstripdata = 0;
 		seqn->anim= 0;
-	}
-	else if(seq->type == SEQ_RAM_SOUND) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
-		seqn->strip= MEM_dupallocN(seq->strip);
+	} else if(seq->type == SEQ_RAM_SOUND) {
 		seqn->strip->stripdata = 
 				MEM_dupallocN(seq->strip->stripdata);
-		seqn->strip->tstripdata = 0;
-
-		seqn->anim= 0;
 		seqn->sound->id.us++;
-		if(seqn->ipo) seqn->ipo->id.us++;
-	}
-	else if(seq->type == SEQ_HD_SOUND) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
-		seqn->strip= MEM_dupallocN(seq->strip);
+	} else if(seq->type == SEQ_HD_SOUND) {
 		seqn->strip->stripdata = 
 				MEM_dupallocN(seq->strip->stripdata);
-		seqn->strip->tstripdata = 0;
-		seqn->anim= 0;
 		seqn->hdaudio = 0;
-		if(seqn->ipo) seqn->ipo->id.us++;
 	} else if(seq->type == SEQ_IMAGE) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
-		seqn->strip= MEM_dupallocN(seq->strip);
 		seqn->strip->stripdata = 
 				MEM_dupallocN(seq->strip->stripdata);
-		seqn->strip->tstripdata = 0;
 	} else if(seq->type >= SEQ_EFFECT) {
-		seqn= MEM_dupallocN(seq);
-		seq->tmp= seqn;
-
 		if(seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
 		if(seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
 		if(seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
 
-		if(seqn->ipo) seqn->ipo->id.us++;
-
 		if (seq->type & SEQ_EFFECT) {
 			struct SeqEffectHandle sh;
 			sh = get_sequence_effect(seq);
@@ -2243,27 +2226,13 @@
 				sh.copy(seq, seqn);
 		}
 
-		seqn->strip= MEM_dupallocN(seq->strip);
 		seqn->strip->stripdata = 0;
-		seqn->strip->tstripdata = 0;
 		
 	} else {
 		fprintf(stderr, "Aiiiiekkk! sequence type not "
 				"handled in duplicate!\nExpect a crash"
 						" now...\n");
 	}
-
-	if (seq->strip->crop) {
-		seqn->strip->crop = MEM_dupallocN(seq->strip->crop);
-	}
-
-	if (seq->strip->transform) {
-		seqn->strip->transform = MEM_dupallocN(seq->strip->transform);
-	}
-
-	if (seq->strip->proxy) {
-		seqn->strip->proxy = MEM_dupallocN(seq->strip->proxy);
-	}
 	
 	return seqn;
 }

Modified: trunk/blender/source/blender/src/sequence.c
===================================================================
--- trunk/blender/source/blender/src/sequence.c	2008-01-29 12:20:42 UTC (rev 13450)
+++ trunk/blender/source/blender/src/sequence.c	2008-01-29 12:26:42 UTC (rev 13451)
@@ -401,8 +401,10 @@
 		return;
 	}
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list