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:
Diffstat (limited to 'source/blender/python/api2_2x/sceneSequence.c')
-rw-r--r--source/blender/python/api2_2x/sceneSequence.c123
1 files changed, 103 insertions, 20 deletions
diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c
index 0d3ad3fcb44..c7daea19fe7 100644
--- a/source/blender/python/api2_2x/sceneSequence.c
+++ b/source/blender/python/api2_2x/sceneSequence.c
@@ -33,12 +33,14 @@
#include "DNA_scene_types.h" /* for Base */
#include "BKE_mesh.h"
+#include "BKE_image.h" // RFS: openanim
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_scene.h"
#include "BIF_editseq.h" /* get_last_seq */
+#include "BIF_editsound.h" // RFS: sound_open_hdaudio
#include "BLI_blenlib.h"
#include "BSE_sequence.h"
#include "Ipo.h"
@@ -48,6 +50,9 @@
#include "Sound.h"
#include "gen_utils.h"
+#include "IMB_imbuf_types.h" // RFS: IB_rect
+#include "IMB_imbuf.h" // RFS: IMB_anim_get_duration
+
enum seq_consts {
EXPP_SEQ_ATTR_TYPE = 0,
EXPP_SEQ_ATTR_CHAN,
@@ -145,7 +150,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
seq->len = PyList_Size( list );
-
/* strip and stripdata */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= seq->len;
@@ -185,12 +189,103 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+ } else if (PyTuple_Check(py_data) && PyTuple_GET_SIZE(py_data) == 4) {
+ // MOVIE or AUDIO_HD
+ char *filename;
+ char *dir;
+ char *fullpath;
+ char *type;
+ int totframe;
+
+ if (!PyArg_ParseTuple( py_data, "ssss", &filename, &dir, &fullpath, &type )) {
+ BLI_remlink(seqbase, seq);
+ MEM_freeN(seq);
+
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "movie/audio hd data needs to be a tuple of a string and a list of images - (filename, dir, fullpath, type)" );
+ }
+
+ // RFS - Attempting to support Movie and Audio (HD) strips
+#define RFS
+#ifdef RFS
+ // Movie strips
+ if( strcmp( type, "movie" ) == 0 )
+ {
+ /* open it as an animation */
+ struct anim * an = openanim(fullpath, IB_rect);
+ if(an==0) {
+ BLI_remlink(seqbase, seq);
+ MEM_freeN(seq);
+
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ "invalid movie strip" );
+ }
+
+ /* get the length in frames */
+ totframe = IMB_anim_get_duration( an );
+
+ /* set up sequence */
+ seq->type= SEQ_MOVIE;
+ seq->len= totframe;
+ seq->anim= an;
+ seq->anim_preseek = IMB_anim_get_preseek(an);
+
+ calc_sequence(seq);
+
+ /* strip and stripdata */
+ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+ strip->len= totframe;
+ strip->us= 1;
+ strncpy(strip->dir, dir, FILE_MAXDIR-1); // ????
+ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+
+ /* name movie in first strip */
+ strncpy(se->name, filename, FILE_MAXFILE-1); // ????
+ }
+
+ // Audio (HD) strips
+ if( strcmp( type, "audio_hd" ) == 0 )
+ {
+ struct hdaudio *hdaudio;
+
+ totframe= 0;
+
+ /* is it a sound file? */
+ hdaudio = sound_open_hdaudio( fullpath );
+ if(hdaudio==0) {
+ BLI_remlink(seqbase, seq);
+ MEM_freeN(seq);
+
+ return EXPP_ReturnPyObjError( PyExc_ValueError,
+ fullpath );
+ }
+
+ totframe= sound_hdaudio_get_duration(hdaudio, FPS);
+
+ /* set up sequence */
+ seq->type= SEQ_HD_SOUND;
+ seq->len= totframe;
+ seq->hdaudio= hdaudio;
+
+ calc_sequence(seq);
+
+ /* strip and stripdata - same as for MOVIE */
+ seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+ strip->len= totframe;
+ strip->us= 1;
+ strncpy(strip->dir, dir, FILE_MAXDIR-1); // ????
+ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+
+ /* name movie in first strip */
+ strncpy(se->name, filename, FILE_MAXFILE-1); // ????
+ }
+#endif
+
} else if (BPy_Sound_Check(py_data)) {
- /* sound */
+ /* RAM sound */
int totframe;
bSound *sound = (( BPy_Sound * )py_data)->sound;
-
seq->type= SEQ_RAM_SOUND;
seq->sound = sound;
@@ -198,7 +293,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
sound->flags |= SOUND_FLAGS_SEQUENCE;
-
/* strip and stripdata */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strip->len= totframe;
@@ -211,32 +305,21 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
} else if (BPy_Scene_Check(py_data)) {
/* scene */
- Scene *sce = ((BPy_Scene *)py_data)->scene;
+ Scene *sceseq = ((BPy_Scene *)py_data)->scene;
seq->type= SEQ_SCENE;
- seq->scene= sce;
+ seq->scene= sceseq;
/*seq->sfra= sce->r.sfra;*/
- seq->len= sce->r.efra - sce->r.sfra + 1;
+ seq->len= sceseq->r.efra - sceseq->r.sfra + 1;
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strncpy(seq->name + 2, sce->id.name + 2,
+ strncpy(seq->name + 2, sceseq->id.name + 2,
sizeof(seq->name) - 2);
strip->len= seq->len;
strip->us= 1;
} else {
- /* movie, pydata is a path to a movie file */
- char *name = PyString_AsString ( py_data );
- if (!name) {
- /* only free these 2 because other stuff isnt set */
- BLI_remlink(seqbase, seq);
- MEM_freeN(seq);
-
- return EXPP_ReturnPyObjError( PyExc_TypeError,
- "expects a string for chan/bone name and an int for the frame where to put the new key" );
- }
-
- seq->type= SEQ_MOVIE;
+ // RFS: REMOVED MOVIE FROM HERE
}
strncpy(seq->name+2, "Untitled", 21);
intern_pos_update(seq);