[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18589] branches/blender2.5/blender/source /blender: WIP, operators SEQUENCER_OT_add_color_strip and SEQUENCER_OT_add_scene_strip

Campbell Barton ideasman42 at gmail.com
Tue Jan 20 15:19:43 CET 2009


Revision: 18589
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18589
Author:   campbellbarton
Date:     2009-01-20 15:19:39 +0100 (Tue, 20 Jan 2009)

Log Message:
-----------
WIP, operators SEQUENCER_OT_add_color_strip and SEQUENCER_OT_add_scene_strip
but no menu to access them yet, for now can access them with R and Tkey

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_sequence.h
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_edit.c
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_intern.h
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_ops.c
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_select.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_sequence.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_sequence.h	2009-01-20 12:20:01 UTC (rev 18588)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_sequence.h	2009-01-20 14:19:39 UTC (rev 18589)
@@ -146,6 +146,7 @@
 struct ImBuf *give_ibuf_seq_direct(struct Scene *scene, int rectx, int recty, int cfra, struct Sequence *seq);
 void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown);
 void calc_sequence(struct Sequence *seq);
+void calc_sequence_disp(struct Sequence *seq);
 void new_tstripdata(struct Sequence *seq);
 void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq);
 void sort_seq(struct Scene *scene);

Added: branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_sequencer/sequencer_add.c	2009-01-20 14:19:39 UTC (rev 18589)
@@ -0,0 +1,1174 @@
+/**
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation, 2003-2009, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#ifndef WIN32
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+#include <sys/types.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+#include "BLI_storage_types.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "DNA_ipo_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_view2d_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_sound_types.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_image.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_plugin_types.h"
+#include "BKE_sequence.h"
+#include "BKE_scene.h"
+#include "BKE_utildefines.h"
+#include "BKE_report.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+/* for menu/popup icons etc etc*/
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "ED_anim_api.h"
+#include "ED_space_api.h"
+#include "ED_types.h"
+#include "ED_screen.h"
+#include "ED_util.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+#include "UI_view2d.h"
+
+/* own include */
+#include "sequencer_intern.h"
+
+static void BIF_undo_push() {}
+static void error() {}
+static void waitcursor() {}
+static void activate_fileselect() {}
+static void std_rmouse_transform() {}
+static int get_mbut() {return 0;}
+static int pupmenu() {return 0;}
+static int pupmenu_col() {return 0;}
+static int okee() {return 0;}
+static void *find_nearest_marker() {return NULL;}
+static void deselect_markers() {}
+static void transform_markers() {}
+static void transform_seq_nomarker() {}
+	
+	
+	
+	
+	
+
+static Sequence *sfile_to_sequence(Scene *scene, SpaceFile *sfile, int cfra, int machine, int last)
+{
+#if 0
+	/* XXX sfile recoded... */
+	Sequence *seq;
+	Strip *strip;
+	StripElem *se;
+	int totsel, a;
+	char name[160];
+	Editing *ed= scene->ed;
+	
+	/* are there selected files? */
+	totsel= 0;
+	for(a=0; a<sfile->totfile; a++) {
+		if(sfile->filelist[a].flags & ACTIVE) {
+			if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
+				totsel++;
+			}
+		}
+	}
+
+	if(last) {
+		/* if not, a file handed to us? */
+		if(totsel==0 && sfile->file[0]) totsel= 1;
+	}
+
+	if(totsel==0) return 0;
+
+	/* make seq */
+	seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
+	seq->len= totsel;
+
+	if(totsel==1) {
+		seq->startstill= 25;
+		seq->endstill= 24;
+	}
+
+	calc_sequence(seq);
+	
+	if(sfile->flag & FILE_STRINGCODE) {
+		strcpy(name, sfile->dir);
+		BLI_makestringcode(G.sce, name);
+	} else {
+		strcpy(name, sfile->dir);
+	}
+
+	/* strip and stripdata */
+	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+	strip->len= totsel;
+	strip->us= 1;
+	strncpy(strip->dir, name, FILE_MAXDIR-1);
+	strip->stripdata= se= MEM_callocN(totsel*sizeof(StripElem), "stripelem");
+
+	for(a=0; a<sfile->totfile; a++) {
+		if(sfile->filelist[a].flags & ACTIVE) {
+			if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
+				strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1);
+				se++;
+			}
+		}
+	}
+	/* no selected file: */
+	if(totsel==1 && se==strip->stripdata) {
+		strncpy(se->name, sfile->file, FILE_MAXFILE-1);
+	}
+
+	/* last active name */
+	strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
+
+	return seq;
+#endif
+	return NULL;
+}
+
+
+#if 0
+static int sfile_to_mv_sequence_load(Scene *scene, SpaceFile *sfile, int cfra, 
+				     int machine, int index )
+{
+	/* XXX sfile recoded... */
+	Sequence *seq;
+	struct anim *anim;
+	Strip *strip;
+	StripElem *se;
+	int totframe;
+	char name[160];
+	char str[FILE_MAXDIR+FILE_MAXFILE];
+	Editing *ed= scene->ed;
+	
+	totframe= 0;
+
+	strncpy(str, sfile->dir, FILE_MAXDIR-1);
+	if(index<0)
+		strncat(str, sfile->file, FILE_MAXDIR-1);
+	else
+		strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
+
+	/* is it a movie? */
+	anim = openanim(str, IB_rect);
+	if(anim==0) {
+		error("The selected file is not a movie or "
+		      "FFMPEG-support not compiled in!");
+		return(cfra);
+	}
+	
+	totframe= IMB_anim_get_duration(anim);
+
+	/* make seq */
+	seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
+	seq->len= totframe;
+	seq->type= SEQ_MOVIE;
+	seq->anim= anim;
+	seq->anim_preseek = IMB_anim_get_preseek(anim);
+
+	calc_sequence(seq);
+	
+	if(sfile->flag & FILE_STRINGCODE) {
+		strcpy(name, sfile->dir);
+		BLI_makestringcode(G.sce, name);
+	} else {
+		strcpy(name, sfile->dir);
+	}
+
+	/* strip and stripdata */
+	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+	strip->len= totframe;
+	strip->us= 1;
+	strncpy(strip->dir, name, FILE_MAXDIR-1);
+	strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+
+	/* name movie in first strip */
+	if(index<0)
+		strncpy(se->name, sfile->file, FILE_MAXFILE-1);
+	else
+		strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
+
+	/* last active name */
+	strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR-1);
+	return(cfra+totframe);
+}
+#endif
+
+static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine)
+{
+#if 0
+	/* XXX sfile recoded... */
+	int a, totsel;
+
+	totsel= 0;
+	for(a= 0; a<sfile->totfile; a++) {
+		if(sfile->filelist[a].flags & ACTIVE) {
+			if ((sfile->filelist[a].type & S_IFDIR)==0) {
+				totsel++;
+			}
+		}
+	}
+
+	if((totsel==0) && (sfile->file[0])) {
+		cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, -1);
+		return;
+	}
+
+	if(totsel==0) return;
+
+	/* ok. check all the select file, and load it. */
+	for(a= 0; a<sfile->totfile; a++) {
+		if(sfile->filelist[a].flags & ACTIVE) {
+			if ((sfile->filelist[a].type & S_IFDIR)==0) {
+				/* load and update current frame. */
+				cfra= sfile_to_mv_sequence_load(sfile, cfra, machine, a);
+			}
+		}
+	}
+#endif
+}
+
+static Sequence *sfile_to_ramsnd_sequence(Scene *scene, SpaceFile *sfile,  int cfra, int machine)
+{
+#if 0
+	/* XXX sfile recoded... */
+	Sequence *seq;
+	bSound *sound;
+	Strip *strip;
+	StripElem *se;
+	double totframe;
+	char name[160];
+	char str[256];
+
+	totframe= 0.0;
+
+	strncpy(str, sfile->dir, FILE_MAXDIR-1);
+	strncat(str, sfile->file, FILE_MAXFILE-1);
+
+	sound= sound_new_sound(str);
+	if (!sound || sound->sample->type == SAMPLE_INVALID) {
+		error("Unsupported audio format");
+		return 0;
+	}
+	if (sound->sample->bits != 16) {
+		error("Only 16 bit audio is supported");
+		return 0;
+	}
+	sound->id.us=1;
+	sound->flags |= SOUND_FLAGS_SEQUENCE;
+	audio_makestream(sound);
+
+	totframe= (int) ( ((float)(sound->streamlen-1)/
+			   ( (float)scene->r.audio.mixrate*4.0 ))* FPS);
+
+	/* make seq */
+	seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);
+	seq->len= totframe;
+	seq->type= SEQ_RAM_SOUND;
+	seq->sound = sound;
+
+	calc_sequence(seq);
+	
+	if(sfile->flag & FILE_STRINGCODE) {
+		strcpy(name, sfile->dir);
+		BLI_makestringcode(G.sce, name);
+	} else {
+		strcpy(name, sfile->dir);
+	}
+
+	/* strip and stripdata */
+	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+	strip->len= totframe;
+	strip->us= 1;
+	strncpy(strip->dir, name, FILE_MAXDIR-1);
+	strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+
+	/* name sound in first strip */
+	strncpy(se->name, sfile->file, FILE_MAXFILE-1);
+
+	/* last active name */
+	strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR-1);
+
+	return seq;
+#endif
+	return NULL;
+}
+
+#if 0
+static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra, 
+					int machine, int index)
+{
+	/* XXX sfile recoded... */
+	Sequence *seq;
+	struct hdaudio *hdaudio;
+	Strip *strip;
+	StripElem *se;
+	int totframe;
+	char name[160];
+	char str[FILE_MAXDIR+FILE_MAXFILE];
+
+	totframe= 0;
+
+	strncpy(str, sfile->dir, FILE_MAXDIR-1);
+	if(index<0)
+		strncat(str, sfile->file, FILE_MAXDIR-1);
+	else
+		strncat(str, sfile->filelist[index].relname, FILE_MAXDIR-1);
+
+	/* is it a sound file? */
+	hdaudio = sound_open_hdaudio(str);
+	if(hdaudio==0) {
+		error("The selected file is not a sound file or "
+		      "FFMPEG-support not compiled in!");
+		return(cfra);
+	}
+
+	totframe= sound_hdaudio_get_duration(hdaudio, FPS);
+
+	/* make seq */
+	seq= alloc_sequence(((Editing *)scene->ed)->seqbasep, cfra, machine);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list