diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-07 17:58:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-07 17:58:29 +0300 |
commit | 9e2081a5fc078bf8bb040f0befe62156b9592436 (patch) | |
tree | beb3f6e50c696e1d464659afd50adf802110bd11 /source/blender | |
parent | c5a15828013f39b476742f3ef1389aba68a3cbd5 (diff) |
made alloc_sequence accept a linkedList so it can be used from Python.
the start/end points for new strips were not set properly.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/include/BIF_editseq.h | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/sceneSequence.c | 26 | ||||
-rw-r--r-- | source/blender/src/editseq.c | 24 |
3 files changed, 20 insertions, 31 deletions
diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index 3d03def7159..3999b4311d4 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -62,6 +62,7 @@ void transform_seq(int mode, int context); void un_meta(void); void seq_cut(int cutframe); void reassign_inputs_seq_effect(void); +struct Sequence* alloc_sequence(ListBase *lb, int cfra, int machine); /*used from python*/ /* drawseq.c */ void do_seqbuttons(short); diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c index 7868ba364fc..71d2566aed9 100644 --- a/source/blender/python/api2_2x/sceneSequence.c +++ b/source/blender/python/api2_2x/sceneSequence.c @@ -106,37 +106,24 @@ static PyMethodDef BPy_SceneSeq_methods[] = { {NULL, NULL, 0, NULL} }; - -static Sequence *alloc_sequence_internal(ListBase *lb) -{ - Sequence *seq; - seq= MEM_callocN( sizeof(Sequence), "addseq"); - BLI_addtail(lb, seq); - *( (short *)seq->name )= ID_SEQ; - seq->name[2]= 0; - seq->flag= SELECT; - seq->mul= 1.0; /*start and machine must be set later */ - - return seq; -} - - /* use to add a sequence to a scene or its listbase */ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce) { PyObject *py_data = NULL; - Sequence *seq = alloc_sequence_internal(seqbase); + Sequence *seq; int a; Strip *strip; StripElem *se; - + int start, machine; - if( !PyArg_ParseTuple( args, "Oii", &py_data, &seq->start, &seq->machine ) ) + if( !PyArg_ParseTuple( args, "Oii", &py_data, &start, &machine ) ) return EXPP_ReturnPyObjError( PyExc_ValueError, "expects a string for chan/bone name and an int for the frame where to put the new key" ); - if (PyTuple_Check(py_data)) { + seq = alloc_sequence(seqbase, start, machine); /* warning, this sets last */ + + if (PyList_Check(py_data)) { /* Image */ PyObject *list; char *name; @@ -227,6 +214,7 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce) seq->type= SEQ_MOVIE; } + intern_pos_update(seq); return Sequence_CreatePyObject(seq, NULL, sce); } diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index b80709d3099..9ed75e5b12f 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -493,15 +493,15 @@ void mouse_select_seq(void) std_rmouse_transform(transform_seq); } -static Sequence *alloc_sequence(int cfra, int machine) + +Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) { - Editing *ed; Sequence *seq; - ed= G.scene->ed; + /*ed= G.scene->ed;*/ seq= MEM_callocN( sizeof(Sequence), "addseq"); - BLI_addtail(ed->seqbasep, seq); + BLI_addtail(lb, seq); set_last_seq(seq); @@ -542,7 +542,7 @@ static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int if(totsel==0) return 0; /* make seq */ - seq= alloc_sequence(cfra, machine); + seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); seq->len= totsel; if(totsel==1) { @@ -610,11 +610,11 @@ static void sfile_to_mv_sequence(SpaceFile *sfile, int cfra, int machine) "FFMPEG-support not compiled in!"); return; } - + totframe= IMB_anim_get_duration(anim); /* make seq */ - seq= alloc_sequence(cfra, machine); + seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); seq->len= totframe; seq->type= SEQ_MOVIE; seq->anim= anim; @@ -682,7 +682,7 @@ static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile, totframe= (int) ( ((float)(sound->streamlen-1)/( (float)G.scene->audio.mixrate*4.0 ))* (float)G.scene->r.frs_sec); /* make seq */ - seq= alloc_sequence(cfra, machine); + seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); seq->len= totframe; seq->type= SEQ_RAM_SOUND; seq->sound = sound; @@ -745,7 +745,7 @@ static void sfile_to_hdsnd_sequence(SpaceFile *sfile, int cfra, int machine) totframe= sound_hdaudio_get_duration(hdaudio, G.scene->r.frs_sec); /* make seq */ - seq= alloc_sequence(cfra, machine); + seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); seq->len= totframe; seq->type= SEQ_HD_SOUND; seq->hdaudio= hdaudio; @@ -1158,7 +1158,7 @@ static int add_seq_effect(int type, char *str) machine= (int)(y+0.5); /* allocate and initialize */ - newseq= alloc_sequence(cfra, machine); + newseq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); newseq->type= event_to_efftype(type); sh = get_sequence_effect(newseq); @@ -1373,7 +1373,7 @@ void add_sequence(int type) cfra= (int)(x+0.5); machine= (int)(y+0.5); - seq= alloc_sequence(cfra, machine); + seq= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, cfra, machine); seq->type= SEQ_SCENE; seq->scene= sce; seq->sfra= sce->r.sfra; @@ -1990,7 +1990,7 @@ void make_meta(void) /* remove all selected from main list, and put in meta */ - seqm= alloc_sequence(1, 1); + seqm= alloc_sequence(((Editing *)G.scene->ed)->seqbasep, 1, 1); seqm->type= SEQ_META; seqm->flag= SELECT; |