2007-03-05 15:26:03 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2007-03-05 15:26:03 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2007-03-05 15:26:03 +00:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* This is a new part of Blender.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Campbell Barton
|
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2007-03-05 15:26:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "sceneSequence.h" /* This must come first */
|
|
|
|
|
|
2007-03-09 21:48:47 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
|
|
|
|
#include "DNA_scene_types.h" /* for Base */
|
|
|
|
|
|
|
|
|
|
#include "BKE_mesh.h"
|
2008-09-07 14:02:58 +00:00
|
|
|
#include "BKE_image.h" // RFS: openanim
|
2007-03-05 15:26:03 +00:00
|
|
|
#include "BKE_library.h"
|
|
|
|
|
#include "BKE_global.h"
|
|
|
|
|
#include "BKE_main.h"
|
|
|
|
|
#include "BKE_scene.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_editseq.h" /* get_last_seq */
|
2008-09-07 14:02:58 +00:00
|
|
|
#include "BIF_editsound.h" // RFS: sound_open_hdaudio
|
2007-03-05 15:26:03 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
#include "BSE_sequence.h"
|
2009-01-12 15:58:32 +00:00
|
|
|
#include "BSE_seqeffects.h"
|
2007-03-05 15:26:03 +00:00
|
|
|
#include "Ipo.h"
|
|
|
|
|
#include "blendef.h" /* CLAMP */
|
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
#include "Scene.h"
|
|
|
|
|
#include "Sound.h"
|
|
|
|
|
#include "gen_utils.h"
|
|
|
|
|
|
2008-09-07 14:02:58 +00:00
|
|
|
#include "IMB_imbuf_types.h" // RFS: IB_rect
|
|
|
|
|
#include "IMB_imbuf.h" // RFS: IMB_anim_get_duration
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
enum seq_consts
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
EXPP_SEQ_ATTR_TYPE = 0,
|
|
|
|
|
EXPP_SEQ_ATTR_CHAN,
|
|
|
|
|
EXPP_SEQ_ATTR_LENGTH,
|
|
|
|
|
EXPP_SEQ_ATTR_START,
|
|
|
|
|
EXPP_SEQ_ATTR_STARTOFS,
|
2007-06-29 05:33:43 +00:00
|
|
|
EXPP_SEQ_ATTR_ENDOFS,
|
|
|
|
|
EXPP_SEQ_ATTR_STARTSTILL,
|
2009-02-06 14:03:29 +00:00
|
|
|
EXPP_SEQ_ATTR_ENDSTILL,
|
|
|
|
|
EXPP_SEQ_ATTR_STARTDISP,
|
|
|
|
|
EXPP_SEQ_ATTR_ENDDISP
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum seq_effect_consts
|
|
|
|
|
{
|
|
|
|
|
/* speed */
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_GLOBAL_SPEED,
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_IPO_IS_VELOCITY,
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_FRAME_BLENDING,
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_NORMALIZE_IPO_0_1,
|
|
|
|
|
|
|
|
|
|
/* wipe */
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_ANGLE,
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_BLUR,
|
|
|
|
|
EXPP_SEQ_ATTR_EFFECT_WIPE_IN
|
2007-03-05 15:26:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python API function prototypes for the Blender module. */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*PyObject *M_Sequence_Get( PyObject * self, PyObject * args );*/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python method structure definition for Blender.Object module: */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*struct PyMethodDef M_Sequence_methods[] = {
|
|
|
|
|
{"Get", ( PyCFunction ) M_Sequence_Get, METH_VARARGS,
|
|
|
|
|
"(name) - return the sequence with the name 'name',\
|
|
|
|
|
returns None if notfound.\nIf 'name' is not specified, it returns a list of all sequences."},
|
|
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python BPy_Sequence methods table: */
|
|
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_copy(BPy_Sequence * self);
|
2009-02-09 04:18:30 +00:00
|
|
|
static PyObject *Sequence_update(BPy_Sequence * self, PyObject *args);
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_new(BPy_Sequence * self, PyObject * args);
|
|
|
|
|
static PyObject *Sequence_remove(BPy_Sequence * self, PyObject * args);
|
|
|
|
|
static PyObject *Sequence_rebuildProxy(BPy_Sequence * self);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_new(BPy_SceneSeq * self, PyObject * args);
|
|
|
|
|
static PyObject *SceneSeq_remove(BPy_SceneSeq * self, PyObject * args);
|
|
|
|
|
static void intern_pos_update(Sequence * seq);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
static PyMethodDef BPy_Sequence_methods[] = {
|
|
|
|
|
/* name, method, flags, doc */
|
2009-02-06 14:03:29 +00:00
|
|
|
{"new", (PyCFunction) Sequence_new, METH_VARARGS,
|
|
|
|
|
"(data) - Return a new sequence."},
|
|
|
|
|
{"remove", (PyCFunction) Sequence_remove, METH_VARARGS,
|
|
|
|
|
"(data) - Remove a strip."},
|
|
|
|
|
{"__copy__", (PyCFunction) Sequence_copy, METH_NOARGS,
|
|
|
|
|
"() - Return a copy of the sequence containing the same objects."},
|
|
|
|
|
{"copy", (PyCFunction) Sequence_copy, METH_NOARGS,
|
|
|
|
|
"() - Return a copy of the sequence containing the same objects."},
|
2009-02-09 04:18:30 +00:00
|
|
|
{"update", (PyCFunction) Sequence_update, METH_VARARGS,
|
2009-02-06 14:03:29 +00:00
|
|
|
"() - Force and update of the sequence strip"},
|
|
|
|
|
{"rebuildProxy", (PyCFunction) Sequence_rebuildProxy, METH_VARARGS,
|
|
|
|
|
"() - Rebuild the active strip's Proxy."},
|
2007-03-05 15:26:03 +00:00
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static PyMethodDef BPy_SceneSeq_methods[] = {
|
|
|
|
|
/* name, method, flags, doc */
|
2009-02-06 14:03:29 +00:00
|
|
|
{"new", (PyCFunction) SceneSeq_new, METH_VARARGS,
|
|
|
|
|
"(data) - Return a new sequence."},
|
|
|
|
|
{"remove", (PyCFunction) SceneSeq_remove, METH_VARARGS,
|
|
|
|
|
"(data) - Remove a strip."},
|
2007-03-05 15:26:03 +00:00
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* 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;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-07 14:58:29 +00:00
|
|
|
Sequence *seq;
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *pyob1 = NULL, *pyob2 = NULL, *pyob3 = NULL; /* for effects */
|
2009-01-12 15:58:32 +00:00
|
|
|
int type;
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
int a;
|
|
|
|
|
Strip *strip;
|
|
|
|
|
StripElem *se;
|
2007-03-07 14:58:29 +00:00
|
|
|
int start, machine;
|
2009-01-12 15:58:32 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "Oii", &py_data, &start, &machine))
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"expect sequence data then 2 ints - (seqdata, start, track)");
|
|
|
|
|
|
|
|
|
|
if (machine < 1 || machine >= MAXSEQ)
|
|
|
|
|
{
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"track out of range");
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-07 14:58:29 +00:00
|
|
|
seq = alloc_sequence(seqbase, start, machine); /* warning, this sets last */
|
2009-01-12 15:58:32 +00:00
|
|
|
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (PyList_Check(py_data)) /* new metastrip, list of seqs */
|
|
|
|
|
{
|
|
|
|
|
/* Warning, no checks for audio which should not be allowed, or a blank metaseq if an empty list */
|
|
|
|
|
int fail= 0;
|
|
|
|
|
Sequence *seq_iter;
|
|
|
|
|
PyObject *item;
|
|
|
|
|
seq->type= SEQ_META;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(a=PyList_GET_SIZE(py_data)-1; a >= 0; a--) {
|
|
|
|
|
item= PyList_GET_ITEM(py_data, a);
|
|
|
|
|
if (!BPy_Sequence_Check(item)) { /* ignore non seq types */
|
|
|
|
|
fail= 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
seq_iter = ((BPy_Sequence *) item)->seq;
|
|
|
|
|
if (BLI_findindex(seqbase, seq_iter) == -1) {
|
|
|
|
|
fail= 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fail) {
|
|
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
|
|
|
|
|
|
|
|
|
if (fail==1)
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError, "One of more of the list items was not a sequence strip");
|
|
|
|
|
else
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError, "One of more of the list items sequence strips is not in this meta or scene");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(a=PyList_GET_SIZE(py_data)-1; a >= 0; a--) {
|
|
|
|
|
item= PyList_GET_ITEM(py_data, a);
|
|
|
|
|
seq_iter = ((BPy_Sequence *) item)->seq;
|
|
|
|
|
BLI_remlink(seqbase, seq_iter);
|
|
|
|
|
BLI_addtail(&seq->seqbase, seq_iter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clear_last_seq(); /* just incase */
|
|
|
|
|
calc_sequence(seq);
|
|
|
|
|
|
|
|
|
|
seq->strip= MEM_callocN(sizeof(Strip), "metastrip");
|
|
|
|
|
seq->strip->len= seq->len;
|
|
|
|
|
seq->strip->us= 1;
|
|
|
|
|
}
|
|
|
|
|
else if (PyTuple_Check(py_data) && PyTuple_GET_SIZE(py_data) >= 2 && BPy_Sequence_Check(PyTuple_GET_ITEM(py_data, 1)))
|
|
|
|
|
{
|
|
|
|
|
|
2009-01-12 15:58:32 +00:00
|
|
|
struct SeqEffectHandle sh;
|
2009-02-06 14:03:29 +00:00
|
|
|
Sequence *seq1, *seq2 = NULL, *seq3 = NULL; /* for effects */
|
2009-01-12 15:58:32 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!PyArg_ParseTuple(py_data, "iO!|O!O!", &type, &Sequence_Type, &pyob1, &Sequence_Type, &pyob2, &Sequence_Type, &pyob3))
|
|
|
|
|
{
|
2009-01-13 05:55:48 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"effect stripts expected an effect type int and 1 to 3 sequence strips");
|
2009-01-13 05:55:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
seq1 = ((BPy_Sequence *) pyob1)->seq;
|
|
|
|
|
if (pyob2) seq2 = ((BPy_Sequence *) pyob2)->seq;
|
|
|
|
|
if (pyob3) seq3 = ((BPy_Sequence *) pyob3)->seq;
|
2009-01-12 15:58:32 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (type <= SEQ_EFFECT || type > SEQ_EFFECT_MAX || type == SEQ_PLUGIN)
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"sequencer type out of range, expected a value from 9 to 29, plugins not supported");
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (BLI_findindex(seqbase, seq1) == -1 || (seq2 && BLI_findindex(seqbase, seq2) == -1) || (seq3 && BLI_findindex(seqbase, seq3) == -1))
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"one of the given effect sequences wasnt in accessible at the same level as the sequence being added");
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if ((seq2 && seq2 == seq1) || (seq3 && (seq3 == seq1 || seq3 == seq2)))
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"2 or more of the sequence arguments were the same");
|
2009-01-12 15:58:32 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* allocate and initialize */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->type = type;
|
2009-01-12 15:58:32 +00:00
|
|
|
|
|
|
|
|
sh = get_sequence_effect(seq);
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->seq1 = seq1;
|
|
|
|
|
seq->seq2 = seq2;
|
|
|
|
|
seq->seq3 = seq3;
|
2009-01-12 15:58:32 +00:00
|
|
|
|
|
|
|
|
sh.init(seq);
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!seq1)
|
|
|
|
|
{
|
|
|
|
|
seq->len = 1;
|
|
|
|
|
seq->startstill = 25;
|
|
|
|
|
seq->endstill = 24;
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
calc_sequence(seq);
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->strip = strip = MEM_callocN(sizeof (Strip), "strip");
|
|
|
|
|
strip->len = seq->len;
|
|
|
|
|
strip->us = 1;
|
|
|
|
|
if (seq->len > 0)
|
|
|
|
|
strip->stripdata = MEM_callocN(seq->len * sizeof (StripElem), "stripelem");
|
2009-01-12 15:58:32 +00:00
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/* initialize plugin */
|
2009-02-06 14:03:29 +00:00
|
|
|
if (newseq->type == SEQ_PLUGIN)
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
sh.init_plugin(seq, str);
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (newseq->plugin == 0)
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
BLI_remlink(ed->seqbasep, seq);
|
|
|
|
|
free_sequence(seq);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
update_changed_seq_and_deps(seq, 1, 1);
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
}
|
|
|
|
|
else if (PyTuple_Check(py_data) && PyTuple_GET_SIZE(py_data) == 2)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
/* Image */
|
|
|
|
|
PyObject *list;
|
|
|
|
|
char *name;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(py_data, "sO!", &name, &PyList_Type, &list))
|
|
|
|
|
{
|
2007-04-17 06:12:26 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
2009-01-12 15:58:32 +00:00
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"images data needs to be a tuple of a string and a list of images - (path, [filenames...])");
|
2007-04-17 06:12:26 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
seq->type = SEQ_IMAGE;
|
|
|
|
|
|
|
|
|
|
seq->len = PyList_Size(list);
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/* strip and stripdata */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->strip = strip = MEM_callocN(sizeof (Strip), "strip");
|
|
|
|
|
strip->len = seq->len;
|
|
|
|
|
strip->us = 1;
|
|
|
|
|
strncpy(strip->dir, name, FILE_MAXDIR - 1);
|
|
|
|
|
strip->stripdata = se = MEM_callocN(seq->len * sizeof (StripElem), "stripelem");
|
|
|
|
|
|
|
|
|
|
for (a = 0; a < seq->len; a++)
|
|
|
|
|
{
|
|
|
|
|
name = PyString_AsString(PyList_GetItem(list, a));
|
|
|
|
|
strncpy(se->name, name, FILE_MAXFILE - 1);
|
2007-03-05 15:26:03 +00:00
|
|
|
se++;
|
2009-02-06 14:03:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (PyTuple_Check(py_data) && PyTuple_GET_SIZE(py_data) == 3)
|
|
|
|
|
{
|
|
|
|
|
float r, g, b;
|
2008-04-21 22:17:49 +00:00
|
|
|
SolidColorVars *colvars;
|
2009-01-12 15:58:32 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!PyArg_ParseTuple(py_data, "fff", &r, &g, &b))
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
|
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"color needs to be a tuple of 3 floats - (r,g,b)");
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
2009-01-12 15:58:32 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->effectdata = MEM_callocN(sizeof (struct SolidColorVars), "solidcolor");
|
|
|
|
|
colvars = (SolidColorVars *) seq->effectdata;
|
|
|
|
|
|
|
|
|
|
seq->type = SEQ_COLOR;
|
|
|
|
|
|
|
|
|
|
CLAMP(r, 0, 1);
|
|
|
|
|
CLAMP(g, 0, 1);
|
|
|
|
|
CLAMP(b, 0, 1);
|
2009-01-13 05:55:48 +00:00
|
|
|
|
2008-04-21 22:17:49 +00:00
|
|
|
colvars->col[0] = r;
|
|
|
|
|
colvars->col[1] = b;
|
|
|
|
|
colvars->col[2] = g;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2008-04-21 22:17:49 +00:00
|
|
|
/* basic defaults */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->strip = strip = MEM_callocN(sizeof (Strip), "strip");
|
2008-04-21 22:17:49 +00:00
|
|
|
strip->len = seq->len = 1;
|
2009-02-06 14:03:29 +00:00
|
|
|
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)
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
// MOVIE or AUDIO_HD
|
|
|
|
|
char *filename;
|
|
|
|
|
char *dir;
|
|
|
|
|
char *fullpath;
|
|
|
|
|
char *type;
|
|
|
|
|
int totframe;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!PyArg_ParseTuple(py_data, "ssss", &filename, &dir, &fullpath, &type))
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
2009-01-12 15:58:32 +00:00
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
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)");
|
2008-09-07 14:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RFS - Attempting to support Movie and Audio (HD) strips
|
|
|
|
|
#define RFS
|
|
|
|
|
#ifdef RFS
|
|
|
|
|
// Movie strips
|
2009-02-06 14:03:29 +00:00
|
|
|
if (strcmp(type, "movie") == 0)
|
2008-09-07 14:02:58 +00:00
|
|
|
{
|
|
|
|
|
/* open it as an animation */
|
|
|
|
|
struct anim * an = openanim(fullpath, IB_rect);
|
2009-02-06 14:03:29 +00:00
|
|
|
if (an == 0)
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
2009-01-12 15:58:32 +00:00
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"invalid movie strip");
|
2008-09-07 14:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get the length in frames */
|
2009-02-06 14:03:29 +00:00
|
|
|
totframe = IMB_anim_get_duration(an);
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
/* set up sequence */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->type = SEQ_MOVIE;
|
|
|
|
|
seq->len = totframe;
|
|
|
|
|
seq->anim = an;
|
2008-09-07 14:02:58 +00:00
|
|
|
seq->anim_preseek = IMB_anim_get_preseek(an);
|
|
|
|
|
|
|
|
|
|
calc_sequence(seq);
|
|
|
|
|
|
|
|
|
|
/* strip and stripdata */
|
2009-02-06 14:03:29 +00:00
|
|
|
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");
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
/* name movie in first strip */
|
2009-02-06 14:03:29 +00:00
|
|
|
strncpy(se->name, filename, FILE_MAXFILE - 1); // ????
|
2008-09-07 14:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Audio (HD) strips
|
2009-02-06 14:03:29 +00:00
|
|
|
if (strcmp(type, "audio_hd") == 0)
|
2008-09-07 14:02:58 +00:00
|
|
|
{
|
|
|
|
|
struct hdaudio *hdaudio;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
totframe = 0;
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
/* is it a sound file? */
|
2009-02-06 14:03:29 +00:00
|
|
|
hdaudio = sound_open_hdaudio(fullpath);
|
|
|
|
|
if (hdaudio == 0)
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
BLI_remlink(seqbase, seq);
|
2009-01-12 15:58:32 +00:00
|
|
|
free_sequence(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
fullpath);
|
2008-09-07 14:02:58 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
totframe = sound_hdaudio_get_duration(hdaudio, FPS);
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
/* set up sequence */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->type = SEQ_HD_SOUND;
|
|
|
|
|
seq->len = totframe;
|
|
|
|
|
seq->hdaudio = hdaudio;
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
calc_sequence(seq);
|
|
|
|
|
|
|
|
|
|
/* strip and stripdata - same as for MOVIE */
|
2009-02-06 14:03:29 +00:00
|
|
|
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");
|
2008-09-07 14:02:58 +00:00
|
|
|
|
|
|
|
|
/* name movie in first strip */
|
2009-02-06 14:03:29 +00:00
|
|
|
strncpy(se->name, filename, FILE_MAXFILE - 1); // ????
|
2008-09-07 14:02:58 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
}
|
|
|
|
|
else if (BPy_Sound_Check(py_data))
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
/* RAM sound */
|
2007-03-05 15:26:03 +00:00
|
|
|
int totframe;
|
2009-02-06 14:03:29 +00:00
|
|
|
bSound *sound = ((BPy_Sound *) py_data)->sound;
|
|
|
|
|
|
|
|
|
|
seq->type = SEQ_RAM_SOUND;
|
2007-03-05 15:26:03 +00:00
|
|
|
seq->sound = sound;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
totframe = (int) (((float) (sound->streamlen - 1) / ((float) sce->audio.mixrate * 4.0))* (float) sce->r.frs_sec / sce->r.frs_sec_base);
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
sound->flags |= SOUND_FLAGS_SEQUENCE;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/* strip and stripdata */
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->strip = strip = MEM_callocN(sizeof (Strip), "strip");
|
|
|
|
|
strip->len = totframe;
|
|
|
|
|
strip->us = 1;
|
|
|
|
|
strncpy(strip->dir, sound->name, FILE_MAXDIR - 1);
|
|
|
|
|
strip->stripdata = se = MEM_callocN(sizeof (StripElem), "stripelem");
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* name sound in first strip */
|
2009-02-06 14:03:29 +00:00
|
|
|
strncpy(se->name, sound->name, FILE_MAXFILE - 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (BPy_Scene_Check(py_data))
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
/* scene */
|
2009-02-06 14:03:29 +00:00
|
|
|
Scene *sceseq = ((BPy_Scene *) py_data)->scene;
|
|
|
|
|
|
|
|
|
|
seq->type = SEQ_SCENE;
|
|
|
|
|
seq->scene = sceseq;
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*seq->sfra= sce->r.sfra;*/
|
2009-02-06 14:03:29 +00:00
|
|
|
seq->len = sceseq->r.efra - sceseq->r.sfra + 1;
|
|
|
|
|
|
|
|
|
|
seq->strip = strip = MEM_callocN(sizeof (Strip), "strip");
|
|
|
|
|
strncpy(seq->name + 2, sceseq->id.name + 2,
|
|
|
|
|
sizeof (seq->name) - 2);
|
|
|
|
|
strip->len = seq->len;
|
|
|
|
|
strip->us = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-09-07 14:02:58 +00:00
|
|
|
// RFS: REMOVED MOVIE FROM HERE
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
strncpy(seq->name + 2, "Untitled", 21);
|
2007-03-07 14:58:29 +00:00
|
|
|
intern_pos_update(seq);
|
2007-03-05 15:26:03 +00:00
|
|
|
return Sequence_CreatePyObject(seq, NULL, sce);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_new(BPy_Sequence * self, PyObject * args)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
return NewSeq_internal(&self->seq->seqbase, args, self->scene);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_new(BPy_SceneSeq * self, PyObject * args)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return NewSeq_internal(&((Editing *) self->scene->ed)->seqbase, args, self->scene);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void del_seq__internal(Sequence *seq)
|
|
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
if (seq->ipo) seq->ipo->id.us--;
|
|
|
|
|
|
|
|
|
|
if (seq->type == SEQ_RAM_SOUND && seq->sound)
|
2007-03-05 15:26:03 +00:00
|
|
|
seq->sound->id.us--;
|
|
|
|
|
free_sequence(seq);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void recurs_del_seq(ListBase *lb)
|
|
|
|
|
{
|
|
|
|
|
Sequence *seq, *seqn;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = lb->first;
|
|
|
|
|
while (seq)
|
|
|
|
|
{
|
|
|
|
|
seqn = seq->next;
|
2007-03-05 15:26:03 +00:00
|
|
|
BLI_remlink(lb, seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
if (seq->type == SEQ_META) recurs_del_seq(&seq->seqbase);
|
2007-03-05 15:26:03 +00:00
|
|
|
del_seq__internal(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = seqn;
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static PyObject *RemoveSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
|
|
|
|
|
{
|
|
|
|
|
BPy_Sequence *bpy_seq = NULL;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "O!", &Sequence_Type, &bpy_seq))
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_ValueError,
|
|
|
|
|
"expects a sequence object");
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/* quick way to tell if we dont have the seq */
|
|
|
|
|
if (sce != bpy_seq->scene)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
|
"Sequence does not exist here, cannot remove");
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
recurs_del_seq(&bpy_seq->seq->seqbase);
|
|
|
|
|
del_seq__internal(bpy_seq->seq);
|
|
|
|
|
clear_last_seq(); /* just incase */
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_remove(BPy_Sequence * self, PyObject * args)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
return RemoveSeq_internal(&self->seq->seqbase, args, self->scene);
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_remove(BPy_SceneSeq * self, PyObject * args)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return RemoveSeq_internal(&((Editing *) self->scene->ed)->seqbase, args, self->scene);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_copy(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
printf("Sequence Copy not implimented yet!\n");
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-09 04:18:30 +00:00
|
|
|
static PyObject *Sequence_update(BPy_Sequence * self, PyObject *args)
|
2009-02-06 14:03:29 +00:00
|
|
|
{
|
2009-02-09 04:18:30 +00:00
|
|
|
int data= 0;
|
|
|
|
|
if (!PyArg_ParseTuple(args, "|i:update", &data))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
|
update_changed_seq_and_deps(self->seq, 1, 1);
|
|
|
|
|
new_tstripdata(self->seq);
|
|
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
calc_sequence(self->seq);
|
|
|
|
|
calc_sequence_disp(self->seq);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-07 04:17:03 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* PythonTypeObject callback function prototypes */
|
|
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_repr(BPy_Sequence * obj);
|
|
|
|
|
static PyObject *SceneSeq_repr(BPy_SceneSeq * obj);
|
|
|
|
|
static int Sequence_compare(BPy_Sequence * a, BPy_Sequence * b);
|
|
|
|
|
static int SceneSeq_compare(BPy_SceneSeq * a, BPy_SceneSeq * b);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python BPy_Sequence methods: */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getIter(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Sequence *iter = self->seq->seqbase.first;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (!self->iter)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
self->iter = iter;
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_incr_ret((PyObject *) self);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
return Sequence_CreatePyObject(self->seq, iter, self->scene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_getIter(BPy_SceneSeq * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
Sequence *iter = ((Editing *) self->scene->ed)->seqbase.first;
|
|
|
|
|
|
|
|
|
|
if (!self->iter)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
self->iter = iter;
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_incr_ret((PyObject *) self);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
return SceneSeq_CreatePyObject(self->scene, iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return next Seq
|
|
|
|
|
*/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_nextIter(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
PyObject *object;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!(self->iter))
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
self->iter = NULL; /* so we can add objects again */
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_StopIteration,
|
|
|
|
|
"iterator at end");
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
object = Sequence_CreatePyObject(self->iter, NULL, self->scene);
|
|
|
|
|
self->iter = self->iter->next;
|
2007-03-05 15:26:03 +00:00
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return next Seq
|
|
|
|
|
*/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_nextIter(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
PyObject *object;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!(self->iter))
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
self->iter = NULL; /* so we can add objects again */
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_StopIteration,
|
|
|
|
|
"iterator at end");
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
object = Sequence_CreatePyObject(self->iter, NULL, self->scene);
|
|
|
|
|
self->iter = self->iter->next;
|
2007-03-05 15:26:03 +00:00
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getName(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyString_FromString(self->seq->name + 2);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_setName(BPy_Sequence * self, PyObject * value)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
char *name = NULL;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
name = PyString_AsString(value);
|
|
|
|
|
if (!name)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected string argument");
|
|
|
|
|
|
|
|
|
|
strncpy(self->seq->name + 2, name, 21);
|
2007-03-05 15:26:03 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getProxyDir(BPy_Sequence * self)
|
2008-04-21 22:17:49 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyString_FromString(self->seq->strip->proxy ? self->seq->strip->proxy->dir : "");
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_setProxyDir(BPy_Sequence * self, PyObject * value)
|
2008-04-21 22:17:49 +00:00
|
|
|
{
|
|
|
|
|
char *name = NULL;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
name = PyString_AsString(value);
|
|
|
|
|
if (!name)
|
|
|
|
|
{
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected string argument");
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (strlen(name) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (self->seq->strip->proxy)
|
|
|
|
|
{
|
|
|
|
|
MEM_freeN(self->seq->strip->proxy);
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
self->seq->strip->proxy = MEM_callocN(sizeof (struct StripProxy), "StripProxy");
|
2009-06-03 14:55:41 +00:00
|
|
|
strncpy(self->seq->strip->proxy->dir, name, 160);
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_rebuildProxy(BPy_Sequence * self)
|
2008-07-07 04:17:03 +00:00
|
|
|
{
|
|
|
|
|
if (self->seq->strip->proxy)
|
|
|
|
|
seq_proxy_rebuild(self->seq);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getSound(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
if (self->seq->type == SEQ_RAM_SOUND && self->seq->sound)
|
|
|
|
|
return Sound_CreatePyObject(self->seq->sound);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getIpo(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
struct Ipo *ipo;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
ipo = self->seq->ipo;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (ipo)
|
|
|
|
|
return Ipo_CreatePyObject(ipo);
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_getActive(BPy_SceneSeq * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Sequence *last_seq = NULL, *seq;
|
|
|
|
|
Editing *ed = self->scene->ed;
|
|
|
|
|
|
|
|
|
|
if (!ed)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
|
"scene has no sequence data to edit");
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
seq = ed->seqbasep->first;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
while (seq)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
if (seq->flag & SELECT)
|
|
|
|
|
last_seq = seq;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
seq = seq->next;
|
|
|
|
|
}
|
|
|
|
|
if (last_seq)
|
2009-02-06 14:03:29 +00:00
|
|
|
return Sequence_CreatePyObject(last_seq, NULL, self->scene);
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *SceneSeq_getMetaStrip(BPy_SceneSeq * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Sequence *seq = NULL;
|
|
|
|
|
Editing *ed = self->scene->ed;
|
|
|
|
|
MetaStack *ms;
|
|
|
|
|
if (!ed)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
|
"scene has no sequence data to edit");
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
ms = ed->metastack.last;
|
|
|
|
|
if (!ms)
|
|
|
|
|
Py_RETURN_NONE;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
seq = ms->parseq;
|
|
|
|
|
return Sequence_CreatePyObject(seq, NULL, self->scene);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* this should accept a Py_None argument and just delete the Ipo link
|
|
|
|
|
* (as Object_clearIpo() does)
|
|
|
|
|
*/
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_setIpo(BPy_Sequence * self, PyObject * value)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Ipo *ipo = NULL;
|
|
|
|
|
Ipo *oldipo;
|
|
|
|
|
ID *id;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
oldipo = self->seq->ipo;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/* if parameter is not None, check for valid Ipo */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (value != Py_None)
|
|
|
|
|
{
|
|
|
|
|
if (!BPy_Ipo_Check(value))
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected an Ipo object");
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
ipo = Ipo_FromPyObject(value);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!ipo)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"null ipo!");
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (ipo->blocktype != ID_SEQ)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"Ipo is not a sequence data Ipo");
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if already linked to Ipo, delete link */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (oldipo)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
id = &oldipo->id;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (id->us > 0)
|
2007-03-05 15:26:03 +00:00
|
|
|
id->us--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* assign new Ipo and increment user count, or set to NULL if deleting */
|
|
|
|
|
|
|
|
|
|
self->seq->ipo = ipo;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (ipo)
|
2007-03-05 15:26:03 +00:00
|
|
|
id_us_plus(&ipo->id);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getScene(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
struct Scene *scene;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
scene = self->seq->scene;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (scene)
|
|
|
|
|
return Scene_CreatePyObject(scene);
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getImages(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Strip *strip;
|
|
|
|
|
StripElem *se;
|
|
|
|
|
int i;
|
2007-05-27 21:33:48 +00:00
|
|
|
PyObject *list, *ret;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (self->seq->type != SEQ_IMAGE)
|
|
|
|
|
{
|
2007-05-27 21:33:48 +00:00
|
|
|
list = PyList_New(0);
|
2009-02-06 14:03:29 +00:00
|
|
|
ret = Py_BuildValue("sO", "", list);
|
2007-05-27 21:33:48 +00:00
|
|
|
Py_DECREF(list);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
/*return EXPP_ReturnPyObjError( PyExc_TypeError,
|
|
|
|
|
"Sequence is not an image type" );*/
|
|
|
|
|
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
strip = self->seq->strip;
|
|
|
|
|
se = strip->stripdata;
|
2007-05-27 21:33:48 +00:00
|
|
|
list = PyList_New(strip->len);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
for (i = 0; i < strip->len; i++, se++)
|
|
|
|
|
{
|
|
|
|
|
PyList_SetItem(list, i, PyString_FromString(se->name));
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
ret = Py_BuildValue("sO", strip->dir, list);
|
2007-05-27 21:33:48 +00:00
|
|
|
Py_DECREF(list);
|
|
|
|
|
return ret;
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_setImages(BPy_Sequence * self, PyObject *value)
|
2007-12-12 14:20:12 +00:00
|
|
|
{
|
|
|
|
|
Strip *strip;
|
|
|
|
|
StripElem *se;
|
|
|
|
|
int i;
|
2007-12-13 15:06:02 +00:00
|
|
|
PyObject *list;
|
2007-12-12 14:20:12 +00:00
|
|
|
char *basepath, *name;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (self->seq->type != SEQ_IMAGE)
|
|
|
|
|
{
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"Sequence is not an image type");
|
2007-12-12 14:20:12 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple
|
|
|
|
|
(value, "sO!", &basepath, &PyList_Type, &list))
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected string and optional list argument");
|
|
|
|
|
|
2007-12-12 14:20:12 +00:00
|
|
|
strip = self->seq->strip;
|
|
|
|
|
se = strip->stripdata;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-12-12 14:20:12 +00:00
|
|
|
/* for now dont support different image list sizes */
|
2009-02-06 14:03:29 +00:00
|
|
|
if (PyList_Size(list) != strip->len)
|
|
|
|
|
{
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"at the moment only image lista with the same number of images as the strip are supported");
|
2007-12-12 14:20:12 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
strncpy(strip->dir, basepath, sizeof (strip->dir));
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < strip->len; i++, se++)
|
|
|
|
|
{
|
2007-12-12 14:20:12 +00:00
|
|
|
name = PyString_AsString(PyList_GetItem(list, i));
|
2009-02-06 14:03:29 +00:00
|
|
|
if (name)
|
|
|
|
|
{
|
|
|
|
|
strncpy(se->name, name, sizeof (se->name));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-12-13 08:49:09 +00:00
|
|
|
PyErr_Clear();
|
2007-12-12 14:20:12 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-12-12 14:20:12 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *M_Sequence_BlendModesDict(void)
|
2008-07-07 04:17:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *M = PyConstant_New();
|
|
|
|
|
|
|
|
|
|
if (M)
|
|
|
|
|
{
|
|
|
|
|
BPy_constant *d = (BPy_constant *) M;
|
|
|
|
|
PyConstant_Insert(d, "CROSS", PyInt_FromLong(SEQ_CROSS));
|
|
|
|
|
PyConstant_Insert(d, "ADD", PyInt_FromLong(SEQ_ADD));
|
|
|
|
|
PyConstant_Insert(d, "SUBTRACT", PyInt_FromLong(SEQ_SUB));
|
|
|
|
|
PyConstant_Insert(d, "ALPHAOVER", PyInt_FromLong(SEQ_ALPHAOVER));
|
|
|
|
|
PyConstant_Insert(d, "ALPHAUNDER", PyInt_FromLong(SEQ_ALPHAUNDER));
|
|
|
|
|
PyConstant_Insert(d, "GAMMACROSS", PyInt_FromLong(SEQ_GAMCROSS));
|
|
|
|
|
PyConstant_Insert(d, "MULTIPLY", PyInt_FromLong(SEQ_MUL));
|
|
|
|
|
PyConstant_Insert(d, "OVERDROP", PyInt_FromLong(SEQ_OVERDROP));
|
|
|
|
|
PyConstant_Insert(d, "PLUGIN", PyInt_FromLong(SEQ_PLUGIN));
|
|
|
|
|
PyConstant_Insert(d, "WIPE", PyInt_FromLong(SEQ_WIPE));
|
|
|
|
|
PyConstant_Insert(d, "GLOW", PyInt_FromLong(SEQ_GLOW));
|
|
|
|
|
PyConstant_Insert(d, "TRANSFORM", PyInt_FromLong(SEQ_TRANSFORM));
|
|
|
|
|
PyConstant_Insert(d, "COLOR", PyInt_FromLong(SEQ_COLOR));
|
|
|
|
|
PyConstant_Insert(d, "SPEED", PyInt_FromLong(SEQ_SPEED));
|
2008-07-07 04:17:03 +00:00
|
|
|
}
|
|
|
|
|
return M;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_getBlendMode(BPy_Sequence * self)
|
2008-07-07 04:17:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyInt_FromLong(self->seq->blend_mode);
|
2008-07-07 04:17:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_setBlendMode(BPy_Sequence * self, PyObject * value)
|
2008-07-07 04:17:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
struct Sequence *seq = self->seq;
|
|
|
|
|
int number = PyInt_AsLong(value);
|
|
|
|
|
|
|
|
|
|
if (number == -1 && PyErr_Occurred())
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "expected an int value");
|
|
|
|
|
|
|
|
|
|
if (!seq_can_blend(seq))
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_AttributeError, "this sequence type dosnt support blending");
|
|
|
|
|
|
|
|
|
|
if (number < SEQ_EFFECT || number > SEQ_EFFECT_MAX)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "expected an int value");
|
|
|
|
|
|
|
|
|
|
seq->blend_mode = number;
|
|
|
|
|
|
2008-07-07 04:17:03 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*
|
|
|
|
|
* get floating point attributes
|
|
|
|
|
*/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *getIntAttr(BPy_Sequence *self, void *type)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
int param;
|
2009-02-06 14:03:29 +00:00
|
|
|
struct Sequence *seq = self->seq;
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*printf("%i %i %i %i %i %i %i %i %i\n", seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->startdisp, seq->enddisp, seq->depth );*/
|
2009-02-06 14:03:29 +00:00
|
|
|
switch (GET_INT_FROM_POINTER(type))
|
|
|
|
|
{
|
|
|
|
|
case EXPP_SEQ_ATTR_TYPE:
|
2007-03-05 15:26:03 +00:00
|
|
|
param = seq->type;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_CHAN:
|
|
|
|
|
param = seq->machine;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_LENGTH:
|
|
|
|
|
param = seq->len;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_START:
|
|
|
|
|
param = seq->start;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_STARTOFS:
|
|
|
|
|
param = seq->startofs;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_ENDOFS:
|
|
|
|
|
param = seq->endofs;
|
|
|
|
|
break;
|
2007-06-29 05:33:43 +00:00
|
|
|
case EXPP_SEQ_ATTR_STARTSTILL:
|
|
|
|
|
param = seq->startstill;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_ENDSTILL:
|
|
|
|
|
param = seq->endstill;
|
|
|
|
|
break;
|
2009-02-06 14:03:29 +00:00
|
|
|
case EXPP_SEQ_ATTR_STARTDISP:
|
|
|
|
|
param = seq->startdisp;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_ENDDISP:
|
|
|
|
|
param = seq->enddisp;
|
|
|
|
|
break;
|
2007-03-05 15:26:03 +00:00
|
|
|
default:
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
|
|
|
|
|
"undefined type in getIntAttr");
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyInt_FromLong(param);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* internal functions for recursivly updating metastrip locatons */
|
2009-02-06 14:03:29 +00:00
|
|
|
static void intern_pos_update(Sequence * seq)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
/* update startdisp and enddisp */
|
2007-10-17 23:24:09 +00:00
|
|
|
calc_sequence_disp(seq);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
void intern_recursive_pos_update(Sequence * seq, int offset)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
Sequence *iterseq;
|
|
|
|
|
intern_pos_update(seq);
|
|
|
|
|
if (seq->type != SEQ_META) return;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
for (iterseq = seq->seqbase.first; iterseq; iterseq = iterseq->next)
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
iterseq->start -= offset;
|
|
|
|
|
intern_recursive_pos_update(iterseq, offset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int setIntAttrClamp(BPy_Sequence *self, PyObject *value, void *type)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
struct Sequence *seq = self->seq;
|
|
|
|
|
int number, origval = 0, regen_data;
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!PyInt_Check(value))
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "expected an int value");
|
|
|
|
|
|
|
|
|
|
number = PyInt_AS_LONG(value);
|
|
|
|
|
|
|
|
|
|
switch (GET_INT_FROM_POINTER(type))
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
case EXPP_SEQ_ATTR_CHAN:
|
|
|
|
|
CLAMP(number, 1, 1024);
|
|
|
|
|
seq->machine = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 0;
|
2007-03-05 15:26:03 +00:00
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_START:
|
|
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"cannot set the location of an effect directly");
|
2007-03-05 15:26:03 +00:00
|
|
|
CLAMP(number, -MAXFRAME, MAXFRAME);
|
|
|
|
|
origval = seq->start;
|
|
|
|
|
seq->start = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 0;
|
2007-03-05 15:26:03 +00:00
|
|
|
break;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
case EXPP_SEQ_ATTR_STARTOFS:
|
2007-06-29 05:33:43 +00:00
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"This property dosnt apply to an effect");
|
2007-06-29 05:33:43 +00:00
|
|
|
CLAMP(number, 0, seq->len - seq->endofs);
|
2008-04-21 22:17:49 +00:00
|
|
|
origval = seq->startofs;
|
2007-03-05 15:26:03 +00:00
|
|
|
seq->startofs = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 1;
|
2007-03-05 15:26:03 +00:00
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_ENDOFS:
|
|
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"This property dosnt apply to an effect");
|
2007-03-05 15:26:03 +00:00
|
|
|
CLAMP(number, 0, seq->len - seq->startofs);
|
2008-04-21 22:17:49 +00:00
|
|
|
origval = seq->endofs;
|
2007-03-05 15:26:03 +00:00
|
|
|
seq->endofs = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 1;
|
2007-03-05 15:26:03 +00:00
|
|
|
break;
|
2007-06-29 05:33:43 +00:00
|
|
|
case EXPP_SEQ_ATTR_STARTSTILL:
|
|
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"This property dosnt apply to an effect");
|
2007-06-29 05:33:43 +00:00
|
|
|
CLAMP(number, 1, MAXFRAME);
|
2008-04-21 22:17:49 +00:00
|
|
|
origval = seq->startstill;
|
2007-06-29 05:33:43 +00:00
|
|
|
seq->startstill = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 1;
|
2007-06-29 05:33:43 +00:00
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_ENDSTILL:
|
|
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"This property dosnt apply to an effect");
|
|
|
|
|
CLAMP(number, seq->startstill + 1, MAXFRAME);
|
2008-04-21 22:17:49 +00:00
|
|
|
origval = seq->endstill;
|
2007-06-29 05:33:43 +00:00
|
|
|
seq->endstill = number;
|
2008-04-21 22:17:49 +00:00
|
|
|
regen_data = 1;
|
2007-06-29 05:33:43 +00:00
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_LENGTH:
|
|
|
|
|
if (self->seq->type == SEQ_EFFECT)
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"cannot set the length of an effect directly");
|
2007-06-29 05:33:43 +00:00
|
|
|
CLAMP(number, 1, MAXFRAME);
|
|
|
|
|
origval = seq->len;
|
2008-04-21 22:17:49 +00:00
|
|
|
seq->len = number;
|
|
|
|
|
regen_data = 1;
|
2007-06-29 05:33:43 +00:00
|
|
|
break;
|
2007-03-05 15:26:03 +00:00
|
|
|
default:
|
2009-02-06 14:03:29 +00:00
|
|
|
return EXPP_ReturnIntError(PyExc_RuntimeError,
|
|
|
|
|
"undefined type in setFloatAttrClamp");
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2008-04-21 22:17:49 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (number != origval)
|
|
|
|
|
{
|
2008-04-21 22:17:49 +00:00
|
|
|
intern_pos_update(seq);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2008-04-21 22:17:49 +00:00
|
|
|
if (GET_INT_FROM_POINTER(type) == EXPP_SEQ_ATTR_START)
|
|
|
|
|
intern_recursive_pos_update(seq, origval - seq->start);
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
if (regen_data)
|
|
|
|
|
{
|
2008-04-21 22:17:49 +00:00
|
|
|
new_tstripdata(seq);
|
|
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
calc_sequence(seq);
|
|
|
|
|
calc_sequence_disp(seq);
|
2008-04-21 22:17:49 +00:00
|
|
|
}
|
2007-03-05 15:26:03 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *getFlagAttr(BPy_Sequence *self, void *type)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2008-04-21 22:17:49 +00:00
|
|
|
if (self->seq->flag & GET_INT_FROM_POINTER(type))
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_TRUE;
|
|
|
|
|
else
|
|
|
|
|
Py_RETURN_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* set floating point attributes which require clamping
|
|
|
|
|
*/
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int setFlagAttr(BPy_Sequence *self, PyObject *value, void *type)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2008-04-21 22:17:49 +00:00
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
2009-02-06 14:03:29 +00:00
|
|
|
int param = PyObject_IsTrue(value);
|
|
|
|
|
|
|
|
|
|
if (param == -1)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected True/False or 0/1");
|
|
|
|
|
|
2007-07-12 11:51:21 +00:00
|
|
|
if (param)
|
2007-03-05 15:26:03 +00:00
|
|
|
self->seq->flag |= t;
|
2009-02-06 14:03:29 +00:00
|
|
|
else
|
|
|
|
|
{
|
2007-03-05 15:26:03 +00:00
|
|
|
/* dont allow leftsel and rightsel when its not selected */
|
|
|
|
|
if (t == SELECT)
|
|
|
|
|
t = t + SEQ_LEFTSEL + SEQ_RIGHTSEL;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
self->seq->flag &= ~t;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *getEffectSeq(BPy_Sequence *self, void *type)
|
2009-01-12 15:58:32 +00:00
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
2009-02-06 14:03:29 +00:00
|
|
|
Sequence *seq = NULL;
|
|
|
|
|
switch (t)
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
case 1:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = self->seq->seq1;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = self->seq->seq2;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
case 3:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = self->seq->seq3;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (seq)
|
|
|
|
|
{
|
|
|
|
|
return Sequence_CreatePyObject(seq, NULL, self->scene);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* set one of the effect sequences
|
|
|
|
|
*/
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int setEffectSeq(BPy_Sequence *self, PyObject *value, void *type)
|
2009-01-12 15:58:32 +00:00
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
|
|
|
|
Sequence **seq;
|
2009-02-06 14:03:29 +00:00
|
|
|
if ((value == Py_None || BPy_Sequence_Check(value)) == 0)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError,
|
|
|
|
|
"expected Sequence or None");
|
|
|
|
|
|
|
|
|
|
switch (t)
|
|
|
|
|
{
|
2009-01-12 15:58:32 +00:00
|
|
|
case 1:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = &self->seq->seq1;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = &self->seq->seq2;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
case 3:
|
2009-02-06 14:03:29 +00:00
|
|
|
seq = &self->seq->seq3;
|
2009-01-12 15:58:32 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (value == Py_None)
|
|
|
|
|
*seq = NULL;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Sequence *newseq = ((BPy_Sequence *) value)->seq;
|
|
|
|
|
if (newseq == self->seq)
|
|
|
|
|
{
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "cannot set a sequence as its own effect");
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
*seq = ((BPy_Sequence *) value)->seq;
|
2009-01-12 15:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
calc_sequence(self->seq);
|
|
|
|
|
update_changed_seq_and_deps(self->seq, 1, 1);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
static PyObject *getSpeedEffect(BPy_Sequence *self, PyObject *value, void *type)
|
|
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
|
|
|
|
Sequence *seq= self->seq;
|
|
|
|
|
SpeedControlVars * v;
|
|
|
|
|
|
|
|
|
|
if (seq->type != SEQ_SPEED)
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_TypeError, "Not a speed effect strip" );
|
|
|
|
|
|
|
|
|
|
v = (SpeedControlVars *)seq->effectdata;
|
|
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_GLOBAL_SPEED:
|
|
|
|
|
return PyFloat_FromDouble(v->globalSpeed);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_IPO_IS_VELOCITY:
|
|
|
|
|
return PyBool_FromLong(v->flags & SEQ_SPEED_INTEGRATE);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_FRAME_BLENDING:
|
|
|
|
|
return PyBool_FromLong(v->flags & SEQ_SPEED_BLEND);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_NORMALIZE_IPO_0_1:
|
|
|
|
|
return PyBool_FromLong(v->flags & SEQ_SPEED_COMPRESS_IPO_Y);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* set one of the effect sequences
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static int setSpeedEffect(BPy_Sequence *self, PyObject *value, void *type)
|
|
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
|
|
|
|
Sequence *seq= self->seq;
|
|
|
|
|
SpeedControlVars * v;
|
|
|
|
|
|
|
|
|
|
if (seq->type != SEQ_SPEED)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "Not a speed effect strip" );
|
|
|
|
|
|
|
|
|
|
v = (SpeedControlVars *)seq->effectdata;
|
|
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_GLOBAL_SPEED:
|
|
|
|
|
v->globalSpeed= PyFloat_AsDouble(value);
|
|
|
|
|
CLAMP(v->globalSpeed, 0.0f, 100.0f);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_IPO_IS_VELOCITY:
|
|
|
|
|
if (PyObject_IsTrue( value )) v->flags |= SEQ_SPEED_INTEGRATE;
|
|
|
|
|
else v->flags &= ~SEQ_SPEED_INTEGRATE;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_FRAME_BLENDING:
|
|
|
|
|
if (PyObject_IsTrue( value )) v->flags |= SEQ_SPEED_BLEND;
|
|
|
|
|
else v->flags &= ~SEQ_SPEED_BLEND;
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_NORMALIZE_IPO_0_1:
|
|
|
|
|
if (PyObject_IsTrue( value )) v->flags |= SEQ_SPEED_COMPRESS_IPO_Y;
|
|
|
|
|
else v->flags &= ~SEQ_SPEED_COMPRESS_IPO_Y;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject *getWipeEffect(BPy_Sequence *self, PyObject *value, void *type)
|
|
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
|
|
|
|
Sequence *seq= self->seq;
|
|
|
|
|
WipeVars * v;
|
|
|
|
|
|
|
|
|
|
if (seq->type != SEQ_WIPE)
|
|
|
|
|
return EXPP_ReturnPyObjError(PyExc_TypeError, "Not a wipe effect strip" );
|
|
|
|
|
|
|
|
|
|
v = (WipeVars *)seq->effectdata;
|
|
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_ANGLE:
|
|
|
|
|
return PyFloat_FromDouble(v->angle);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_BLUR:
|
|
|
|
|
return PyFloat_FromDouble(v->edgeWidth);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_WIPE_IN:
|
|
|
|
|
return PyBool_FromLong(v->forward);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* set one of the effect sequences
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static int setWipeEffect(BPy_Sequence *self, PyObject *value, void *type)
|
|
|
|
|
{
|
|
|
|
|
int t = GET_INT_FROM_POINTER(type);
|
|
|
|
|
Sequence *seq= self->seq;
|
|
|
|
|
WipeVars * v;
|
|
|
|
|
|
|
|
|
|
if (seq->type != SEQ_WIPE)
|
|
|
|
|
return EXPP_ReturnIntError(PyExc_TypeError, "Not a wipe effect strip" );
|
|
|
|
|
|
|
|
|
|
v = (WipeVars *)seq->effectdata;
|
|
|
|
|
|
|
|
|
|
switch (t) {
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_ANGLE:
|
|
|
|
|
v->angle= PyFloat_AsDouble(value);
|
|
|
|
|
CLAMP(v->angle, -90.0f, 90.0f);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_BLUR:
|
|
|
|
|
v->edgeWidth= PyFloat_AsDouble(value);
|
|
|
|
|
CLAMP(v->edgeWidth, -90.0f, 90.0f);
|
|
|
|
|
break;
|
|
|
|
|
case EXPP_SEQ_ATTR_EFFECT_WIPE_IN:
|
|
|
|
|
if (PyObject_IsTrue( value )) v->forward= 1;
|
|
|
|
|
else v->forward= 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python attributes get/set structure: */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
static PyGetSetDef BPy_Sequence_getseters[] = {
|
|
|
|
|
{"name",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getName, (setter) Sequence_setName,
|
|
|
|
|
"Sequence name",
|
|
|
|
|
NULL},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"proxyDir",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getProxyDir, (setter) Sequence_setProxyDir,
|
|
|
|
|
"Sequence proxy directory",
|
|
|
|
|
NULL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"ipo",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getIpo, (setter) Sequence_setIpo,
|
|
|
|
|
"Sequence ipo",
|
|
|
|
|
NULL},
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
{"scene",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getScene, (setter) NULL,
|
|
|
|
|
"Sequence scene",
|
|
|
|
|
NULL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"sound",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getSound, (setter) NULL,
|
|
|
|
|
"Sequence name",
|
|
|
|
|
NULL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"images",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getImages, (setter) Sequence_setImages,
|
|
|
|
|
"Sequence scene",
|
|
|
|
|
NULL},
|
2008-07-07 04:17:03 +00:00
|
|
|
{"blendMode",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) Sequence_getBlendMode, (setter) Sequence_setBlendMode,
|
|
|
|
|
"Sequence Blend Mode",
|
|
|
|
|
NULL},
|
2008-07-07 04:17:03 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
{"type",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) NULL,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_TYPE},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"channel",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_CHAN},
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
{"length",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_LENGTH},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"start",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_START},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"startOffset",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_STARTOFS},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"endOffset",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_ENDOFS},
|
2007-06-29 05:33:43 +00:00
|
|
|
{"startStill",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_STARTSTILL},
|
2007-06-29 05:33:43 +00:00
|
|
|
{"endStill",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getIntAttr, (setter) setIntAttrClamp,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_ENDSTILL},
|
|
|
|
|
{"startDisp",
|
|
|
|
|
(getter) getIntAttr, (setter) NULL,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_STARTDISP},
|
|
|
|
|
{"endDisp",
|
|
|
|
|
(getter) getIntAttr, (setter) NULL,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_ENDDISP},
|
|
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
{"sel",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"Sequence audio mute option",
|
|
|
|
|
(void *) SELECT},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"selLeft",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_LEFTSEL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"selRight",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_RIGHTSEL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"filtery",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_FILTERY},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"flipX",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_FLIPX},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"flipY",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_FLIPY},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"mute",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_MUTE},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"floatBuffer",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_MAKE_FLOAT},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"lock",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_LOCK},
|
2008-04-21 22:17:49 +00:00
|
|
|
{"useProxy",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_USE_PROXY},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"premul",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_MAKE_PREMUL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"reversed",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_REVERSE_FRAMES},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"ipoLocked",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getFlagAttr, (setter) setFlagAttr,
|
|
|
|
|
"",
|
|
|
|
|
(void *) SEQ_IPO_FRAME_LOCKED},
|
2009-01-12 15:58:32 +00:00
|
|
|
{"seq1",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getEffectSeq, (setter) setEffectSeq,
|
|
|
|
|
"",
|
|
|
|
|
(void *) 1},
|
2009-01-12 15:58:32 +00:00
|
|
|
{"seq2",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getEffectSeq, (setter) setEffectSeq,
|
|
|
|
|
"",
|
|
|
|
|
(void *) 2},
|
2009-01-12 15:58:32 +00:00
|
|
|
{"seq3",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) getEffectSeq, (setter) setEffectSeq,
|
|
|
|
|
"",
|
|
|
|
|
(void *) 3},
|
|
|
|
|
|
|
|
|
|
/* effects */
|
|
|
|
|
{"speedEffectGlobalSpeed",
|
|
|
|
|
(getter) getSpeedEffect, (setter) setSpeedEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_GLOBAL_SPEED},
|
|
|
|
|
{"speedEffectIpoVelocity",
|
|
|
|
|
(getter) getSpeedEffect, (setter) setSpeedEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_IPO_IS_VELOCITY},
|
|
|
|
|
{"speedEffectFrameBlending",
|
|
|
|
|
(getter) getSpeedEffect, (setter) setSpeedEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_FRAME_BLENDING},
|
|
|
|
|
{"speedEffectIpoNormalize",
|
|
|
|
|
(getter) getSpeedEffect, (setter) setSpeedEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_NORMALIZE_IPO_0_1},
|
|
|
|
|
|
|
|
|
|
{"wipeEffectAngle",
|
|
|
|
|
(getter) getWipeEffect, (setter) setWipeEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_ANGLE},
|
|
|
|
|
{"wipeEffectBlur",
|
|
|
|
|
(getter) getWipeEffect, (setter) setWipeEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_BLUR},
|
|
|
|
|
{"wipeEffectWipeIn",
|
|
|
|
|
(getter) getWipeEffect, (setter) setWipeEffect,
|
|
|
|
|
"",
|
|
|
|
|
(void *) EXPP_SEQ_ATTR_EFFECT_WIPE_IN},
|
|
|
|
|
|
|
|
|
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
2007-03-05 15:26:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python attributes get/set structure: */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
static PyGetSetDef BPy_SceneSeq_getseters[] = {
|
|
|
|
|
{"active",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) SceneSeq_getActive, (setter) NULL,
|
|
|
|
|
"the active strip",
|
|
|
|
|
NULL},
|
2007-03-05 15:26:03 +00:00
|
|
|
{"metastrip",
|
2009-02-06 14:03:29 +00:00
|
|
|
(getter) SceneSeq_getMetaStrip, (setter) NULL,
|
|
|
|
|
"The currently active metastrip the user is editing",
|
|
|
|
|
NULL},
|
|
|
|
|
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
|
2007-03-05 15:26:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python TypeSequence structure definition: */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
PyTypeObject Sequence_Type = {
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject_HEAD_INIT(NULL) /* required py macro */
|
|
|
|
|
0, /* ob_size */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* For printing, in format "<module>.<name>" */
|
2009-02-06 14:03:29 +00:00
|
|
|
"Blender Sequence", /* char *tp_name; */
|
|
|
|
|
sizeof ( BPy_Sequence), /* int tp_basicsize; */
|
|
|
|
|
0, /* tp_itemsize; For allocation */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Methods to implement standard operations */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* destructor tp_dealloc; */
|
|
|
|
|
NULL, /* printfunc tp_print; */
|
|
|
|
|
NULL, /* getattrfunc tp_getattr; */
|
|
|
|
|
NULL, /* setattrfunc tp_setattr; */
|
|
|
|
|
(cmpfunc) Sequence_compare, /* cmpfunc tp_compare; */
|
|
|
|
|
(reprfunc) Sequence_repr, /* reprfunc tp_repr; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Method suites for standard classes */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyNumberMethods *tp_as_number; */
|
|
|
|
|
NULL, /* PySequenceMethods *tp_as_sequence; */
|
|
|
|
|
NULL, /* PyMappingMethods *tp_as_mapping; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* More standard operations (here for binary compatibility) */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* hashfunc tp_hash; */
|
|
|
|
|
NULL, /* ternaryfunc tp_call; */
|
|
|
|
|
NULL, /* reprfunc tp_str; */
|
|
|
|
|
NULL, /* getattrofunc tp_getattro; */
|
|
|
|
|
NULL, /* setattrofunc tp_setattro; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Functions to access object as input/output buffer */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyBufferProcs *tp_as_buffer; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Flags to define presence of optional/expanded features ***/
|
|
|
|
|
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* char *tp_doc; Documentation string */
|
|
|
|
|
/*** Assigned meaning in release 2.0 ***/
|
2007-03-05 15:26:03 +00:00
|
|
|
/* call function for all accessible objects */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* traverseproc tp_traverse; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* delete references to contained objects */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* inquiry tp_clear; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Assigned meaning in release 2.1 ***/
|
|
|
|
|
/*** rich comparisons ***/
|
|
|
|
|
NULL, /* richcmpfunc tp_richcompare; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** weak reference enabler ***/
|
|
|
|
|
0, /* long tp_weaklistoffset; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Added in release 2.2 ***/
|
2007-03-05 15:26:03 +00:00
|
|
|
/* Iterators */
|
2009-02-06 14:03:29 +00:00
|
|
|
(getiterfunc) Sequence_getIter, /* getiterfunc tp_iter; */
|
|
|
|
|
(iternextfunc) Sequence_nextIter, /* iternextfunc tp_iternext; */
|
|
|
|
|
|
|
|
|
|
/*** Attribute descriptor and subclassing stuff ***/
|
|
|
|
|
BPy_Sequence_methods, /* struct PyMethodDef *tp_methods; */
|
|
|
|
|
NULL, /* struct PyMemberDef *tp_members; */
|
|
|
|
|
BPy_Sequence_getseters, /* struct PyGetSetDef *tp_getset; */
|
|
|
|
|
NULL, /* struct _typeobject *tp_base; */
|
|
|
|
|
NULL, /* PyObject *tp_dict; */
|
|
|
|
|
NULL, /* descrgetfunc tp_descr_get; */
|
|
|
|
|
NULL, /* descrsetfunc tp_descr_set; */
|
|
|
|
|
0, /* long tp_dictoffset; */
|
|
|
|
|
NULL, /* initproc tp_init; */
|
|
|
|
|
NULL, /* allocfunc tp_alloc; */
|
|
|
|
|
NULL, /* newfunc tp_new; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* Low-level free-memory routine */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* freefunc tp_free; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* For PyObject_IS_GC */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* inquiry tp_is_gc; */
|
|
|
|
|
NULL, /* PyObject *tp_bases; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* method resolution order */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyObject *tp_mro; */
|
|
|
|
|
NULL, /* PyObject *tp_cache; */
|
|
|
|
|
NULL, /* PyObject *tp_subclasses; */
|
|
|
|
|
NULL, /* PyObject *tp_weaklist; */
|
2007-03-05 15:26:03 +00:00
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Python TypeSequence structure definition: */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
PyTypeObject SceneSeq_Type = {
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject_HEAD_INIT(NULL) /* required py macro */
|
|
|
|
|
0, /* ob_size */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* For printing, in format "<module>.<name>" */
|
2009-02-06 14:03:29 +00:00
|
|
|
"Blender SceneSeq", /* char *tp_name; */
|
|
|
|
|
sizeof ( BPy_Sequence), /* int tp_basicsize; */
|
|
|
|
|
0, /* tp_itemsize; For allocation */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Methods to implement standard operations */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* destructor tp_dealloc; */
|
|
|
|
|
NULL, /* printfunc tp_print; */
|
|
|
|
|
NULL, /* getattrfunc tp_getattr; */
|
|
|
|
|
NULL, /* setattrfunc tp_setattr; */
|
|
|
|
|
(cmpfunc) SceneSeq_compare, /* cmpfunc tp_compare; */
|
|
|
|
|
(reprfunc) SceneSeq_repr, /* reprfunc tp_repr; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Method suites for standard classes */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyNumberMethods *tp_as_number; */
|
|
|
|
|
NULL, /* PySequenceMethods *tp_as_sequence; */
|
|
|
|
|
NULL, /* PyMappingMethods *tp_as_mapping; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* More standard operations (here for binary compatibility) */
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* hashfunc tp_hash; */
|
|
|
|
|
NULL, /* ternaryfunc tp_call; */
|
|
|
|
|
NULL, /* reprfunc tp_str; */
|
|
|
|
|
NULL, /* getattrofunc tp_getattro; */
|
|
|
|
|
NULL, /* setattrofunc tp_setattro; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* Functions to access object as input/output buffer */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyBufferProcs *tp_as_buffer; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Flags to define presence of optional/expanded features ***/
|
|
|
|
|
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* char *tp_doc; Documentation string */
|
|
|
|
|
/*** Assigned meaning in release 2.0 ***/
|
2007-03-05 15:26:03 +00:00
|
|
|
/* call function for all accessible objects */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* traverseproc tp_traverse; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/* delete references to contained objects */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* inquiry tp_clear; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Assigned meaning in release 2.1 ***/
|
|
|
|
|
/*** rich comparisons ***/
|
|
|
|
|
NULL, /* richcmpfunc tp_richcompare; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** weak reference enabler ***/
|
|
|
|
|
0, /* long tp_weaklistoffset; */
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
/*** Added in release 2.2 ***/
|
2007-03-05 15:26:03 +00:00
|
|
|
/* Iterators */
|
2009-02-06 14:03:29 +00:00
|
|
|
(getiterfunc) SceneSeq_getIter, /* getiterfunc tp_iter; */
|
|
|
|
|
(iternextfunc) SceneSeq_nextIter, /* iternextfunc tp_iternext; */
|
|
|
|
|
|
|
|
|
|
/*** Attribute descriptor and subclassing stuff ***/
|
|
|
|
|
BPy_SceneSeq_methods, /* struct PyMethodDef *tp_methods; */
|
|
|
|
|
NULL, /* struct PyMemberDef *tp_members; */
|
|
|
|
|
BPy_SceneSeq_getseters, /* struct PyGetSetDef *tp_getset; */
|
|
|
|
|
NULL, /* struct _typeobject *tp_base; */
|
|
|
|
|
NULL, /* PyObject *tp_dict; */
|
|
|
|
|
NULL, /* descrgetfunc tp_descr_get; */
|
|
|
|
|
NULL, /* descrsetfunc tp_descr_set; */
|
|
|
|
|
0, /* long tp_dictoffset; */
|
|
|
|
|
NULL, /* initproc tp_init; */
|
|
|
|
|
NULL, /* allocfunc tp_alloc; */
|
|
|
|
|
NULL, /* newfunc tp_new; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* Low-level free-memory routine */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* freefunc tp_free; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* For PyObject_IS_GC */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* inquiry tp_is_gc; */
|
|
|
|
|
NULL, /* PyObject *tp_bases; */
|
2007-03-05 15:26:03 +00:00
|
|
|
/* method resolution order */
|
2009-02-06 14:03:29 +00:00
|
|
|
NULL, /* PyObject *tp_mro; */
|
|
|
|
|
NULL, /* PyObject *tp_cache; */
|
|
|
|
|
NULL, /* PyObject *tp_subclasses; */
|
|
|
|
|
NULL, /* PyObject *tp_weaklist; */
|
2007-03-05 15:26:03 +00:00
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: M_Sequence_Get */
|
|
|
|
|
/* Python equivalent: Blender.Sequence.Get */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*
|
|
|
|
|
PyObject *M_Sequence_Get( PyObject * self, PyObject * args )
|
|
|
|
|
{
|
|
|
|
|
return SceneSeq_CreatePyObject( G.scene, NULL );
|
|
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
*/
|
2007-03-05 15:26:03 +00:00
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: initObject */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *Sequence_Init(void)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *BlendModesDict = M_Sequence_BlendModesDict();
|
2007-03-05 15:26:03 +00:00
|
|
|
PyObject *submodule;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (PyType_Ready(&Sequence_Type) < 0)
|
2007-03-05 15:26:03 +00:00
|
|
|
return NULL;
|
2009-02-06 14:03:29 +00:00
|
|
|
if (PyType_Ready(&SceneSeq_Type) < 0)
|
2007-03-05 15:26:03 +00:00
|
|
|
return NULL;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/* NULL was M_Sequence_methods*/
|
2009-02-06 14:03:29 +00:00
|
|
|
submodule = Py_InitModule3("Blender.Scene.Sequence", NULL,
|
|
|
|
|
"The Blender Sequence module\n\n\
|
|
|
|
|
This module provides access to **Sequence Data** in Blender.\n");
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (BlendModesDict)
|
|
|
|
|
PyModule_AddObject(submodule, "BlendModes", BlendModesDict);
|
2008-07-07 04:17:03 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*Add SUBMODULES to the module*/
|
|
|
|
|
/*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module*/
|
|
|
|
|
return submodule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: Sequence_CreatePyObject */
|
|
|
|
|
/* Description: This function will create a new BlenObject from an existing */
|
|
|
|
|
/* Object structure. */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *Sequence_CreatePyObject(struct Sequence * seq, struct Sequence * iter, struct Scene *sce)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
BPy_Sequence *pyseq;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!seq)
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
|
|
|
|
|
pyseq =
|
2009-02-06 14:03:29 +00:00
|
|
|
(BPy_Sequence *) PyObject_NEW(BPy_Sequence, &Sequence_Type);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (pyseq == NULL)
|
|
|
|
|
{
|
|
|
|
|
return ( NULL);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
pyseq->seq = seq;
|
|
|
|
|
pyseq->iter = iter;
|
|
|
|
|
pyseq->scene = sce;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return ( (PyObject *) pyseq);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: SceneSeq_CreatePyObject */
|
|
|
|
|
/* Description: This function will create a new BlenObject from an existing */
|
|
|
|
|
/* Object structure. */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
PyObject *SceneSeq_CreatePyObject(struct Scene * scn, struct Sequence * iter)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
BPy_SceneSeq *pysceseq;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!scn)
|
2007-03-05 15:26:03 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (!scn->ed)
|
|
|
|
|
{
|
2008-03-03 21:43:31 +00:00
|
|
|
Editing *ed;
|
2009-02-06 14:03:29 +00:00
|
|
|
ed = scn->ed = MEM_callocN(sizeof (Editing), "addseq");
|
|
|
|
|
ed->seqbasep = &ed->seqbase;
|
2008-03-03 21:43:31 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
pysceseq =
|
2009-02-06 14:03:29 +00:00
|
|
|
(BPy_SceneSeq *) PyObject_NEW(BPy_SceneSeq, &SceneSeq_Type);
|
2007-03-05 15:26:03 +00:00
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
if (pysceseq == NULL)
|
|
|
|
|
{
|
|
|
|
|
return ( NULL);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
pysceseq->scene = scn;
|
|
|
|
|
pysceseq->iter = iter;
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
return ( (PyObject *) pysceseq);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: Sequence_FromPyObject */
|
|
|
|
|
/* Description: This function returns the Blender sequence from the given */
|
|
|
|
|
/* PyObject. */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
struct Sequence *Sequence_FromPyObject(PyObject * py_seq)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
BPy_Sequence *blen_seq;
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
blen_seq = (BPy_Sequence *) py_seq;
|
|
|
|
|
return ( blen_seq->seq);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: Sequence_compare */
|
|
|
|
|
/* Description: This is a callback function for the BPy_Sequence type. It */
|
|
|
|
|
/* compares two Sequence_Type objects. Only the "==" and "!=" */
|
|
|
|
|
/* comparisons are meaninful. Returns 0 for equality and -1 if */
|
|
|
|
|
/* they don't point to the same Blender Object struct. */
|
|
|
|
|
/* In Python it becomes 1 if they are equal, 0 otherwise. */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
static int Sequence_compare(BPy_Sequence * a, BPy_Sequence * b)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
|
|
|
|
Sequence *pa = a->seq, *pb = b->seq;
|
2009-02-06 14:03:29 +00:00
|
|
|
return ( pa == pb) ? 0 : -1;
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-06 14:03:29 +00:00
|
|
|
static int SceneSeq_compare(BPy_SceneSeq * a, BPy_SceneSeq * b)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
Scene *pa = a->scene, *pb = b->scene;
|
2009-02-06 14:03:29 +00:00
|
|
|
return ( pa == pb) ? 0 : -1;
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function: Sequence_repr / SceneSeq_repr */
|
|
|
|
|
/* Description: This is a callback function for the BPy_Sequence type. It */
|
|
|
|
|
/* builds a meaninful string to represent object objects. */
|
2009-02-06 14:03:29 +00:00
|
|
|
|
2007-03-05 15:26:03 +00:00
|
|
|
/*****************************************************************************/
|
2009-02-06 14:03:29 +00:00
|
|
|
static PyObject *Sequence_repr(BPy_Sequence * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyString_FromFormat("[Sequence Strip \"%s\"]",
|
|
|
|
|
self->seq->name + 2);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
2009-02-06 14:03:29 +00:00
|
|
|
|
|
|
|
|
static PyObject *SceneSeq_repr(BPy_SceneSeq * self)
|
2007-03-05 15:26:03 +00:00
|
|
|
{
|
2009-02-06 14:03:29 +00:00
|
|
|
return PyString_FromFormat("[Scene Sequence \"%s\"]",
|
|
|
|
|
self->scene->id.name + 2);
|
2007-03-05 15:26:03 +00:00
|
|
|
}
|
|
|
|
|
|