diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-04-17 10:12:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-04-17 10:12:26 +0400 |
commit | 033abf82683b1d70c1ee8ffb913e8b5da428cb56 (patch) | |
tree | 96594a09230fdd371d97f5c48bffa23524402e97 /source/blender/python/api2_2x/sceneSequence.c | |
parent | d40a7ba90152d004eec8ed45e33d1f00a8690798 (diff) |
fixed a python-api bug with adding a new image sequence strip crashing blender.
Diffstat (limited to 'source/blender/python/api2_2x/sceneSequence.c')
-rw-r--r-- | source/blender/python/api2_2x/sceneSequence.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/python/api2_2x/sceneSequence.c b/source/blender/python/api2_2x/sceneSequence.c index 645d52370ea..e8b9b99c218 100644 --- a/source/blender/python/api2_2x/sceneSequence.c +++ b/source/blender/python/api2_2x/sceneSequence.c @@ -122,19 +122,22 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce) 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" ); + "expect sequence data then 2 ints - (seqdata, start, track)" ); seq = alloc_sequence(seqbase, start, machine); /* warning, this sets last */ - if (PyList_Check(py_data)) { + if (PyTuple_Check(py_data)) { /* Image */ PyObject *list; char *name; - if (!PyArg_ParseTuple( py_data, "sO!", &name, &PyList_Type, &list)) + if (!PyArg_ParseTuple( py_data, "sO!", &name, &PyList_Type, &list)) { + BLI_remlink(seqbase, seq); + MEM_freeN(seq); + return EXPP_ReturnPyObjError( PyExc_ValueError, - "images data needs to be a tuple of a string and a list of images" ); - + "images data needs to be a tuple of a string and a list of images - (path, [filenames...])" ); + } seq->type= SEQ_IMAGE; @@ -203,6 +206,7 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce) if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); } 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 */ @@ -213,10 +217,9 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce) "expects a string for chan/bone name and an int for the frame where to put the new key" ); } - /* movie */ seq->type= SEQ_MOVIE; } - + strncpy(seq->name+2, "Untitled", 21); intern_pos_update(seq); return Sequence_CreatePyObject(seq, NULL, sce); } |