This commit is contained in:
Andre Susano Pinto
2008-07-13 13:21:01 +00:00
parent 7d6e004153
commit 70730c7226
204 changed files with 5657 additions and 2776 deletions

View File

@@ -229,13 +229,6 @@ void BPY_start_python( int argc, char **argv )
/* Initialize thread support (also acquires lock) */
PyEval_InitThreads();
/* Don't allow the Python Interpreter to release the GIL on
* its own, to guarantee PyNodes work properly. For Blender this
* is currently the best default behavior.
* The following code in C is equivalent in Python to:
* "import sys; sys.setcheckinterval(sys.maxint)" */
_Py_CheckInterval = PyInt_GetMax();
//Overrides __import__
init_ourImport( );
init_ourReload( );
@@ -2188,6 +2181,18 @@ void BPY_do_all_scripts( short event )
BPY_do_pyscript( &( G.scene->id ), event );
/* Don't allow the Python Interpreter to release the GIL on
* its own, to guarantee PyNodes work properly. For Blender this
* is currently the best default behavior.
* The following code in C is equivalent in Python to:
* "import sys; sys.setcheckinterval(sys.maxint)" */
if (event == SCRIPT_RENDER) {
_Py_CheckInterval = PyInt_GetMax();
}
else if (event == SCRIPT_POSTRENDER) {
_Py_CheckInterval = 100; /* Python default */
}
return;
}
@@ -2270,9 +2275,9 @@ void BPY_do_pyscript( ID * id, short event )
return;
}
/* tell we're running a scriptlink. The sum also tells if this script
* is running nested inside another. Blender.Load needs this info to
* avoid trouble with invalid slink pointers. */
/* tell we're running a scriptlink. The sum also tells if this
* script is running nested inside another. Blender.Load needs
* this info to avoid trouble with invalid slink pointers. */
during_slink++;
disable_where_scriptlink( (short)during_slink );

View File

@@ -483,7 +483,7 @@ static char MatrixObject_doc[] = "This is a wrapper for matrix objects.";
sequence length*/
static int Matrix_len(MatrixObject * self)
{
return (self->colSize * self->rowSize);
return (self->rowSize);
}
/*----------------------------object[]---------------------------
sequence accessor (get)

View File

@@ -81,6 +81,7 @@ returns None if notfound.\nIf 'name' is not specified, it returns a list of all
static PyObject *Sequence_copy( BPy_Sequence * self );
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 );
static PyObject *SceneSeq_new( BPy_SceneSeq * self, PyObject * args );
static PyObject *SceneSeq_remove( BPy_SceneSeq * self, PyObject * args );
@@ -96,6 +97,8 @@ static PyMethodDef BPy_Sequence_methods[] = {
"() - 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."},
{"rebuildProxy", ( PyCFunction ) Sequence_rebuildProxy, METH_VARARGS,
"() - Rebuild the active strip's Proxy."},
{NULL, NULL, 0, NULL}
};
@@ -309,6 +312,7 @@ static PyObject *Sequence_copy( BPy_Sequence * self )
Py_RETURN_NONE;
}
/*****************************************************************************/
/* PythonTypeObject callback function prototypes */
/*****************************************************************************/
@@ -383,8 +387,6 @@ static PyObject *SceneSeq_nextIter( BPy_Sequence * self )
}
static PyObject *Sequence_getName( BPy_Sequence * self )
{
return PyString_FromString( self->seq->name+2 );
@@ -403,11 +405,13 @@ static int Sequence_setName( BPy_Sequence * self, PyObject * value )
return 0;
}
static PyObject *Sequence_getProxyDir( BPy_Sequence * self )
{
return PyString_FromString( self->seq->strip->proxy ? self->seq->strip->proxy->dir : "" );
}
static int Sequence_setProxyDir( BPy_Sequence * self, PyObject * value )
{
char *name = NULL;
@@ -430,6 +434,14 @@ static int Sequence_setProxyDir( BPy_Sequence * self, PyObject * value )
}
static PyObject *Sequence_rebuildProxy( BPy_Sequence * self )
{
if (self->seq->strip->proxy)
seq_proxy_rebuild(self->seq);
Py_RETURN_NONE;
}
static PyObject *Sequence_getSound( BPy_Sequence * self )
{
if (self->seq->type == SEQ_RAM_SOUND && self->seq->sound)
@@ -622,6 +634,54 @@ static int Sequence_setImages( BPy_Sequence * self, PyObject *value )
return 0;
}
static PyObject *M_Sequence_BlendModesDict( void )
{
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 ) );
}
return M;
}
static PyObject *Sequence_getBlendMode( BPy_Sequence * self )
{
return PyInt_FromLong( self->seq->blend_mode );
}
static int Sequence_setBlendMode( BPy_Sequence * self, PyObject * value )
{
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;
return 0;
}
/*
* get floating point attributes
*/
@@ -836,7 +896,11 @@ static PyGetSetDef BPy_Sequence_getseters[] = {
(getter)Sequence_getImages, (setter)Sequence_setImages,
"Sequence scene",
NULL},
{"blendMode",
(getter)Sequence_getBlendMode, (setter)Sequence_setBlendMode,
"Sequence Blend Mode",
NULL},
{"type",
(getter)getIntAttr, (setter)NULL,
"",
@@ -1131,6 +1195,7 @@ PyObject *M_Sequence_Get( PyObject * self, PyObject * args )
/*****************************************************************************/
PyObject *Sequence_Init( void )
{
PyObject *BlendModesDict = M_Sequence_BlendModesDict( );
PyObject *submodule;
if( PyType_Ready( &Sequence_Type ) < 0 )
return NULL;
@@ -1142,6 +1207,9 @@ PyObject *Sequence_Init( void )
"The Blender Sequence module\n\n\
This module provides access to **Sequence Data** in Blender.\n" );
if( BlendModesDict )
PyModule_AddObject( submodule, "BlendModes", BlendModesDict );
/*Add SUBMODULES to the module*/
/*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module*/
return submodule;