soc-2008-mxcurioni: merged changes to revision 17246

This commit is contained in:
Maxime Curioni
2008-10-31 20:05:24 +00:00
456 changed files with 30443 additions and 9943 deletions

View File

@@ -95,12 +95,13 @@
PyObject *bpy_pydriver_Dict = NULL;
PyObject *bpy_orig_syspath_List = NULL;
/*
* set up a weakref list for Armatures
* creates list in __main__ module dict
*/
int setup_armature_weakrefs()
static int setup_armature_weakrefs()
{
PyObject *maindict;
PyObject *main_module;
@@ -159,19 +160,18 @@ ScriptError g_script_error;
/***************************************************************************
* Function prototypes
***************************************************************************/
PyObject *RunPython( Text * text, PyObject * globaldict );
PyObject *CreateGlobalDictionary( void );
void ReleaseGlobalDictionary( PyObject * dict );
void DoAllScriptsFromList( ListBase * list, short event );
static PyObject *RunPython( Text * text, PyObject * globaldict );
static PyObject *CreateGlobalDictionary( void );
static void ReleaseGlobalDictionary( PyObject * dict );
static void DoAllScriptsFromList( ListBase * list, short event );
static PyObject *importText( char *name );
void init_ourImport( void );
void init_ourReload( void );
PyObject *blender_import( PyObject * self, PyObject * args );
PyObject *RunPython2( Text * text, PyObject * globaldict, PyObject *localdict );
static void init_ourImport( void );
static void init_ourReload( void );
static PyObject *blender_import( PyObject * self, PyObject * args );
void BPY_Err_Handle( char *script_name );
PyObject *traceback_getFilename( PyObject * tb );
static void BPY_Err_Handle( char *script_name );
static PyObject *traceback_getFilename( PyObject * tb );
/****************************************************************************
* Description: This function will start the interpreter and load all modules
@@ -195,7 +195,7 @@ void BPY_start_python( int argc, char **argv )
//stuff for Registry module
bpy_registryDict = PyDict_New( );/* check comment at start of this file */
if( !bpy_registryDict )
printf( "Error: Couldn't create the Registry Python Dictionary!" );
printf( "Warning: Couldn't create the Registry Python Dictionary!" );
Py_SetProgramName( "blender" );
/* Py_Initialize() will attempt to import the site module and
@@ -223,11 +223,11 @@ void BPY_start_python( int argc, char **argv )
//Start the interpreter
Py_Initialize( );
PySys_SetArgv( argc_copy, argv_copy );
/* Initialize thread support (also acquires lock) */
PyEval_InitThreads();
//Overrides __import__
init_ourImport( );
init_ourReload( );
@@ -237,7 +237,6 @@ void BPY_start_python( int argc, char **argv )
//Look for a python installation
init_syspath( first_time ); /* not first_time: some msgs are suppressed */
py_tstate = PyGILState_GetThisThreadState();
PyEval_ReleaseThread(py_tstate);
@@ -290,9 +289,6 @@ void syspath_append( char *dirname )
{
PyObject *mod_sys= NULL, *dict= NULL, *path= NULL, *dir= NULL;
short ok=1;
PyErr_Clear( );
dir = PyString_FromString( dirname );
mod_sys = PyImport_ImportModule( "sys" ); /* new ref */
@@ -304,16 +300,21 @@ void syspath_append( char *dirname )
}
} else {
/* cant get the sys module */
/* PyErr_Clear(); is called below */
ok = 0;
}
if (PySequence_Contains(path, dir)==0) { /* Only add if we need to */
if (ok && PyList_Append( path, dir ) != 0) /* decref below */
ok = 0; /* append failed */
dir = PyString_FromString( dirname );
if( (ok==0) || PyErr_Occurred( ) )
Py_FatalError( "could import or build sys.path, can't continue" );
if (ok && PySequence_Contains(path, dir)==0) { /* Only add if we need to */
if (PyList_Append( path, dir ) != 0) /* decref below */
ok = 0; /* append failed */
}
if( (ok==0) || PyErr_Occurred( ) )
fprintf(stderr, "Warning: could import or build sys.path\n" );
PyErr_Clear();
Py_DECREF( dir );
Py_XDECREF( mod_sys );
}
@@ -332,8 +333,10 @@ void init_syspath( int first_time )
d = PyModule_GetDict( mod );
EXPP_dict_set_item_str( d, "progname", PyString_FromString( bprogname ) );
Py_DECREF( mod );
} else
printf( "Warning: could not set Blender.sys.progname\n" );
} else {
printf( "Warning: could not set Blender.sys\n" );
PyErr_Clear();
}
progname = BLI_last_slash( bprogname ); /* looks for the last dir separator */
@@ -392,7 +395,8 @@ void init_syspath( int first_time )
Py_DECREF( mod );
} else{
printf("import of sys module failed\n");
PyErr_Clear( );
printf("Warning: import of sys module failed\n");
}
}
@@ -405,13 +409,14 @@ void BPY_rebuild_syspath( void )
mod = PyImport_ImportModule( "sys" );
if (!mod) {
printf("error: could not import python sys module. some modules may not import.\n");
printf("Warning: could not import python sys module. some modules may not import.\n");
PyErr_Clear( );
PyGILState_Release(gilstate);
return;
}
if (!bpy_orig_syspath_List) { /* should never happen */
printf("error refershing python path\n");
printf("Warning: cant refresh python path, bpy_orig_syspath_List is NULL\n");
Py_DECREF(mod);
PyGILState_Release(gilstate);
return;
@@ -507,7 +512,7 @@ const char *BPY_Err_getFilename( void )
/*****************************************************************************/
/* Description: Return PyString filename from a traceback object */
/*****************************************************************************/
PyObject *traceback_getFilename( PyObject * tb )
static PyObject *traceback_getFilename( PyObject * tb )
{
PyObject *v = NULL;
@@ -527,16 +532,27 @@ PyObject *traceback_getFilename( PyObject * tb )
else return PyString_FromString("unknown");
}
static void BPY_Err_Clear(void)
{
/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
* their user count. Not to mention holding references to wrapped data.
* This is especially bad when the PyObject for the wrapped data is free'd, after blender
* has alredy dealocated the pointer */
PySys_SetObject( "last_traceback", Py_None);
PyErr_Clear();
}
/****************************************************************************
* Description: Blender Python error handler. This catches the error and
* stores filename and line number in a global
*****************************************************************************/
void BPY_Err_Handle( char *script_name )
static void BPY_Err_Handle( char *script_name )
{
PyObject *exception, *err, *tb, *v;
if( !script_name ) {
printf( "Error: script has NULL name\n" );
BPY_Err_Clear();
return;
}
@@ -563,8 +579,9 @@ void BPY_Err_Handle( char *script_name )
} else {
g_script_error.lineno = -1;
}
/* this avoids an abort in Python 2.3's garbage collecting: */
PyErr_Clear( );
/* this avoids an abort in Python 2.3's garbage collecting:
PyErr_Clear() */
BPY_Err_Clear(); /* Calls PyErr_Clear as well */
return;
} else {
PyErr_NormalizeException( &exception, &err, &tb );
@@ -574,6 +591,7 @@ void BPY_Err_Handle( char *script_name )
if( !tb ) {
printf( "\nCan't get traceback\n" );
BPY_Err_Clear(); /* incase there is still some data hanging about */
return;
}
@@ -611,7 +629,8 @@ void BPY_Err_Handle( char *script_name )
}
Py_DECREF( tb );
}
BPY_Err_Clear();
return;
}
@@ -1227,6 +1246,8 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "Blender", mod);
PyDict_SetItemString(d, "b", mod);
Py_DECREF(mod);
} else {
PyErr_Clear();
}
mod = PyImport_ImportModule("math");
@@ -1244,6 +1265,8 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "noise", mod);
PyDict_SetItemString(d, "n", mod);
Py_DECREF(mod);
} else {
PyErr_Clear();
}
/* If there's a Blender text called pydrivers.py, import it.
@@ -1269,6 +1292,8 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "ob", fcn);
Py_DECREF(fcn);
}
} else {
PyErr_Clear();
}
/* TODO - change these */
@@ -1281,6 +1306,8 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "me", fcn);
Py_DECREF(fcn);
}
} else {
PyErr_Clear();
}
/* ma(matname) == Blender.Material.Get(matname) */
@@ -1292,6 +1319,8 @@ static int bpy_pydriver_create_dict(void)
PyDict_SetItemString(d, "ma", fcn);
Py_DECREF(fcn);
}
} else {
PyErr_Clear();
}
return 0;
@@ -2712,8 +2741,10 @@ int BPY_call_importloader( char *name )
* Description: This function executes the python script passed by text.
* The Python dictionary containing global variables needs to
* be passed in globaldict.
* NOTE: Make sure BPY_Err_Handle() runs if this returns NULL
* otherwise pointers can be left in sys.last_traceback that become invalid.
*****************************************************************************/
PyObject *RunPython( Text * text, PyObject * globaldict )
static PyObject *RunPython( Text * text, PyObject * globaldict )
{
char *buf = NULL;
@@ -2741,7 +2772,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
*****************************************************************************/
PyObject *CreateGlobalDictionary( void )
static PyObject *CreateGlobalDictionary( void )
{
PyObject *dict = PyDict_New( );
@@ -2755,7 +2786,7 @@ PyObject *CreateGlobalDictionary( void )
/*****************************************************************************
* Description: This function deletes a given Python dictionary object.
*****************************************************************************/
void ReleaseGlobalDictionary( PyObject * dict )
static void ReleaseGlobalDictionary( PyObject * dict )
{
PyDict_Clear( dict );
Py_DECREF( dict ); /* Release dictionary. */
@@ -2768,7 +2799,7 @@ void ReleaseGlobalDictionary( PyObject * dict )
* list argument. The event by which the function has been
* called, is passed in the event argument.
*****************************************************************************/
void DoAllScriptsFromList( ListBase * list, short event )
static void DoAllScriptsFromList( ListBase * list, short event )
{
ID *id;
@@ -2821,17 +2852,24 @@ static PyMethodDef bimport[] = {
{"blimport", blender_import, METH_VARARGS, "our own import"}
};
PyObject *blender_import( PyObject * self, PyObject * args )
static PyObject *blender_import( PyObject * self, PyObject * args )
{
PyObject *exception, *err, *tb;
char *name;
PyObject *globals = NULL, *locals = NULL, *fromlist = NULL;
PyObject *m;
//PyObject_Print(args, stderr, 0);
#if (PY_VERSION_HEX >= 0x02060000)
int dummy_val; /* what does this do?*/
if( !PyArg_ParseTuple( args, "s|OOOi:bimport",
&name, &globals, &locals, &fromlist, &dummy_val) )
return NULL;
#else
if( !PyArg_ParseTuple( args, "s|OOO:bimport",
&name, &globals, &locals, &fromlist ) )
return NULL;
#endif
m = PyImport_ImportModuleEx( name, globals, locals, fromlist );
if( m )
@@ -2852,7 +2890,7 @@ PyObject *blender_import( PyObject * self, PyObject * args )
return m;
}
void init_ourImport( void )
static void init_ourImport( void )
{
PyObject *m, *d;
PyObject *import = PyCFunction_New( bimport, NULL );
@@ -2953,7 +2991,7 @@ static PyMethodDef breload[] = {
{"blreload", blender_reload, METH_VARARGS, "our own reload"}
};
void init_ourReload( void )
static void init_ourReload( void )
{
PyObject *m, *d;
PyObject *reload = PyCFunction_New( breload, NULL );

View File

@@ -479,7 +479,7 @@ static int bpymenu_CreateFromFile( void )
char line[255], w1[255], w2[255], tooltip[255], *tip;
char upythondir[FILE_MAX];
char *homedir = NULL;
int parsing, version, is_userdir;
int parsing, version, w2_len, is_userdir;
short group;
BPyMenu *pymenu = NULL;
@@ -554,17 +554,32 @@ will use 'Misc'.\n", w1 );
else if( line[0] == '\n' )
continue;
else if( line[0] == '\'' ) { /* menu entry */
parsing =
/* parsing =
sscanf( line,
"'%[^']' %d %s %d '%[^']'\n",
w1, &version, w2, &is_userdir,
tooltip );
if( parsing <= 0 ) { /* invalid line, get rid of it */
*/
/* previously filenames with spaces were not supported;
* this adds support for that w/o breaking the existing
* few, exotic scripts that parse the Bpymenus file */
parsing = sscanf( line,
"'%[^']' %d %[^'\n] '%[^']'\n",
w1, &version, w2, tooltip );
if( parsing <= 0 ) { /* invalid line, get rid of it */
fgets( line, 255, fp );
} else if( parsing == 5 )
} else if( parsing == 4 )
tip = tooltip; /* has tooltip */
w2_len = strlen(w2);
if( w2[w2_len-1] == ' ') {
w2[w2_len-1] = '\0';
w2_len -= 1;
}
if( w2[w2_len-1] == '1') is_userdir = 1;
else is_userdir = 0;
w2[w2_len-2] = '\0';
pymenu = bpymenu_AddEntry( group,
( short ) version,
w1, w2, is_userdir,
@@ -693,13 +708,7 @@ void BPyMenu_PrintAllEntries( void )
}
/* bpymenu_ParseFile:
* recursively scans folders looking for scripts to register.
*
* This function scans the scripts directory looking for .py files with the
* right header and menu info, using that to fill the bpymenu structs.
* is_userdir defines if the script is in the default scripts dir or the
* user defined one (U.pythondir: is_userdir == 1).
* Speed is important.
* parse a given .py file looking for a proper header.
*
* The first line of the script must be '#!BPY'.
* The header registration lines must appear between the first pair of

View File

@@ -1,7 +1,7 @@
#!/usr/bin/python
Import ('env')
sources = Split('BPY_interface.c BPY_menus.c') + env.Glob('api2_2x/*.c')
sources = env.Glob('*.c') + env.Glob('api2_2x/*.c')
incs = 'api2_2x ../blenkernel ../nodes ../blenlib ../blenloader'
incs += ' ../render/extern/include ../radiosity/extern/include ../freestyle/intern/python'
@@ -14,17 +14,17 @@ defs = []
if env['OURPLATFORM'] in ('win32-mingw') and env['BF_DEBUG']:
defs.append('Py_TRACE_REFS')
if env['WITH_BF_QUICKTIME']==1:
if env['WITH_BF_QUICKTIME']:
incs += ' ' + env['BF_QUICKTIME_INC']
defs.append('WITH_QUICKTIME')
if env['WITH_BF_OPENEXR'] == 1:
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
if env['WITH_BF_FFMPEG'] == 1:
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
if env['BF_BUILDINFO'] == 1:
if env['BF_BUILDINFO']:
defs.append('NAN_BUILDINFO')
env.BlenderLib ( libname='blender_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype=['core','game2'], priority = [60,115] )

View File

@@ -57,9 +57,9 @@ static const char sArmatureBadArgs[] = "ArmatureType - Bad Arguments: ";
static const char sModuleError[] = "Blender.Armature - Error: ";
static const char sModuleBadArgs[] = "Blender.Armature - Bad Arguments: ";
PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref);
static PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref);
/* python callable */
PyObject * arm_weakref_callback_weakref_dealloc__pyfunc;
static PyObject * arm_weakref_callback_weakref_dealloc__pyfunc;
//################## BonesDict_Type (internal) ########################
/*This is an internal psuedo-dictionary type that allows for manipulation
@@ -923,7 +923,7 @@ AttributeError:
sArmatureError, "You are not allowed to change the .Bones attribute");
}
//------------------------Bone.layerMask (get)
//------------------------Armature.layerMask (get)
static PyObject *Armature_getLayerMask(BPy_Armature *self)
{
/* do this extra stuff because the short's bits can be negative values */
@@ -931,7 +931,7 @@ static PyObject *Armature_getLayerMask(BPy_Armature *self)
laymask |= self->armature->layer;
return PyInt_FromLong((int)laymask);
}
//------------------------Bone.layerMask (set)
//------------------------Armature.layerMask (set)
static int Armature_setLayerMask(BPy_Armature *self, PyObject *value)
{
int laymask;
@@ -1295,7 +1295,6 @@ static PyObject *M_Armature_New(PyObject * self, PyObject * args)
return (PyObject *)obj;
}
//-------------------MODULE METHODS DEFINITION-----------------------------
static char M_Armature_Get_doc[] = "(name) - return the armature with the name 'name', \
@@ -1323,7 +1322,7 @@ PyObject *Armature_RebuildBones(PyObject *pyarmature)
}
/* internal func to remove weakref from weakref list */
PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref)
static PyObject * arm_weakref_callback_weakref_dealloc(PyObject *self, PyObject *weakref)
{
char *list_name = ARM_WEAKREF_LIST_NAME;
PyObject *maindict = NULL, *armlist = NULL;

View File

@@ -694,6 +694,7 @@ PyObject *newBezTriple( float *numbuf )
}
bzt->h1 = HD_ALIGN;
bzt->h2 = HD_ALIGN;
bzt->radius = 1.0;
/* wrap it */
pyobj = BezTriple_CreatePyObject( bzt );

View File

@@ -522,7 +522,7 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
else if( PySequence_Check( value ) ) {
size = PySequence_Size( value );
/* printf("\ndbg: got a sequence of size %d\n", size ); */
if( size == 4 || size == 5 ) {
if( size == 4 || size == 5 || size == 6) {
BPoint *tmp;
tmp = nurb->bp; /* save old pts */
@@ -556,8 +556,8 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
Py_DECREF( item );
}
if (size == 5) {
PyObject *item = PySequence_GetItem( value, i );
if (size >= 5) {
PyObject *item = PySequence_GetItem( value, 4 );
if (item == NULL)
return NULL;
@@ -568,18 +568,33 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
else {
nurb->bp[npoints].alfa = 0.0f;
}
if (size == 6) {
PyObject *item = PySequence_GetItem( value, 5 );
if (item == NULL)
return NULL;
nurb->bp[npoints].radius = ( float ) PyFloat_AsDouble( item );
Py_DECREF( item );
}
else {
nurb->bp[npoints].radius = 1.0f;
}
nurb->bp[npoints].weight = 0.0; /* softbody weight TODO - add access to this, is zero elsewhere but through blender is 1.0 by default */
makeknots( nurb, 1, nurb->flagu >> 1 );
} else {
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a sequence of 4 or 5 floats" );
"expected a sequence of 4 or 6 floats" );
}
} else {
/* bail with error */
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a sequence of 4 or 5 floats" );
"expected a sequence of 4 to 6 floats" );
}

View File

@@ -822,6 +822,7 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
new_nurb->bezt->f2 = SELECT;
new_nurb->bezt->f3 = SELECT;
new_nurb->bezt->hide = 0;
new_nurb->bezt->radius = 1.0;
/* calchandlesNurb( new_nurb ); */
} else { /* set up bp */
new_nurb->pntsv = 1;
@@ -831,6 +832,7 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
new_nurb->flagv = 0;
new_nurb->bp->f1 = 0;
new_nurb->bp->hide = 0;
new_nurb->bp->radius = 1.0;
new_nurb->knotsu = 0;
/*makenots( new_nurb, 1, new_nurb->flagu >> 1); */
}

View File

@@ -141,7 +141,7 @@ static uiBlock *uiblock=NULL;
static char Draw_doc[] = "The Blender.Draw submodule";
static char Method_UIBlock_doc[] = "(drawfunc, x,y) - Popup dialog where buttons can be drawn (expemental)";
static char Method_UIBlock_doc[] = "(drawfunc, mouse_exit) - Popup dialog where buttons can be drawn (expemental)";
static char Method_Register_doc[] =
"(draw, event, button) - Register callbacks for windowing\n\n\
@@ -290,9 +290,9 @@ static char Method_Text_doc[] =
This function returns the width of the drawn string.";
static char Method_Label_doc[] =
"(text, x, y) - Draw a text label onscreen\n\n\
"(text, x, y, w, h, tip, callback) - Draw a text label onscreen\n\n\
(text) The text to draw\n\
(x, y) The lower left coordinate of the lable";
(x, y, w, h) The lower left coordinate of the lable, width and height";
static char Method_PupMenu_doc[] =
"(string, maxrow = None) - Display a pop-up menu at the screen.\n\
@@ -1101,15 +1101,16 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
PyObject *val = NULL;
PyObject *result = NULL;
ListBase listb= {NULL, NULL};
int mouse_exit = 1;
if (G.background) {
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Can't run Draw.UIBlock() in background mode." );
}
if ( !PyArg_ParseTuple( args, "O", &val ) || !PyCallable_Check( val ) )
if ( !PyArg_ParseTuple( args, "O|i", &val, &mouse_exit ) || !PyCallable_Check( val ) )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected 1 python function and 2 ints" );
"expected 1 python function and an optional int" );
if (uiblock)
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
@@ -1121,7 +1122,7 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
uiblock= uiNewBlock(&listb, "numbuts", UI_EMBOSS, UI_HELV, G.curscreen->mainwin);
uiBlockSetFlag(uiblock, UI_BLOCK_LOOP|UI_BLOCK_REDRAW);
result = PyObject_CallObject( val, Py_BuildValue( "()" ) );
result = PyObject_CallObject( val, NULL );
if (!result) {
PyErr_Print( );
@@ -1146,7 +1147,7 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
/* Done clearing events */
uiBoundsBlock(uiblock, 5);
uiDoBlocks(&listb, 0, 1);
uiDoBlocks(&listb, 0, mouse_exit);
}
uiFreeBlocks(&listb);
uiblock = NULL;
@@ -1156,10 +1157,12 @@ static PyObject *Method_UIBlock( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
void Set_uiBlock(uiBlock *block)
#if 0 /* not used yet */
static void Set_uiBlock(uiBlock *block)
{
uiblock = block;
}
#endif
static uiBlock *Get_uiBlock( void )
{

View File

@@ -54,6 +54,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq );
static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args );
static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args );
static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args );
static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args );
static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * args );
@@ -62,7 +63,8 @@ static char M_Geometry_doc[] = "The Blender Geometry module\n\n";
static char M_Geometry_PolyFill_doc[] = "(veclist_list) - takes a list of polylines (each point a vector) and returns the point indicies for a polyline filled with triangles";
static char M_Geometry_LineIntersect2D_doc[] = "(lineA_p1, lineA_p2, lineB_p1, lineB_p2) - takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None";
static char M_Geometry_ClosestPointOnLine_doc[] = "(pt, line_p1, line_p2) - takes a point and a line and returns a (Vector, Bool) for the point on the line, and the bool so you can know if the point was between the 2 points";
static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triabgle, only the x and y are used from the vectors";
static char M_Geometry_PointInTriangle2D_doc[] = "(pt, tri_p1, tri_p2, tri_p3) - takes 4 vectors, one is the point and the next 3 define the triangle, only the x and y are used from the vectors";
static char M_Geometry_PointInQuad2D_doc[] = "(pt, quad_p1, quad_p2, quad_p3, quad_p4) - takes 5 vectors, one is the point and the next 4 define the quad, only the x and y are used from the vectors";
static char M_Geometry_BoxPack2D_doc[] = "";
/*-----------------------METHOD DEFINITIONS ----------------------*/
struct PyMethodDef M_Geometry_methods[] = {
@@ -70,6 +72,7 @@ struct PyMethodDef M_Geometry_methods[] = {
{"LineIntersect2D", ( PyCFunction ) M_Geometry_LineIntersect2D, METH_VARARGS, M_Geometry_LineIntersect2D_doc},
{"ClosestPointOnLine", ( PyCFunction ) M_Geometry_ClosestPointOnLine, METH_VARARGS, M_Geometry_ClosestPointOnLine_doc},
{"PointInTriangle2D", ( PyCFunction ) M_Geometry_PointInTriangle2D, METH_VARARGS, M_Geometry_PointInTriangle2D_doc},
{"PointInQuad2D", ( PyCFunction ) M_Geometry_PointInQuad2D, METH_VARARGS, M_Geometry_PointInQuad2D_doc},
{"BoxPack2D", ( PyCFunction ) M_Geometry_BoxPack2D, METH_O, M_Geometry_BoxPack2D_doc},
{NULL, NULL, 0, NULL}
};
@@ -313,9 +316,6 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args
return ret;
}
#define SIDE_OF_LINE(pa,pb,pp) ((pa[0]-pp[0])*(pb[1]-pp[1]))-((pb[0]-pp[0])*(pa[1]-pp[1]))
#define POINT_IN_TRI(p0,p1,p2,p3) ((SIDE_OF_LINE(p1,p2,p0)>=0) && (SIDE_OF_LINE(p2,p3,p0)>=0) && (SIDE_OF_LINE(p3,p1,p0)>=0))
static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args )
{
VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3;
@@ -329,13 +329,27 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected 4 vector types\n" ) );
if POINT_IN_TRI(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
return PyInt_FromLong(IsectPT2Df(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec));
}
int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args )
{
VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4;
if( !PyArg_ParseTuple ( args, "O!O!O!O!O!",
&vector_Type, &pt_vec,
&vector_Type, &quad_p1,
&vector_Type, &quad_p2,
&vector_Type, &quad_p3,
&vector_Type, &quad_p4)
)
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected 5 vector types\n" ) );
return PyInt_FromLong(IsectPQ2Df(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec));
}
static int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
{
int len, i;
PyObject *list_item, *item_1, *item_2;
@@ -379,7 +393,7 @@ int boxPack_FromPyObject(PyObject * value, boxPack **boxarray )
return 0;
}
void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
{
int len, i;
PyObject *list_item;
@@ -399,7 +413,7 @@ void boxPack_ToPyObject(PyObject * value, boxPack **boxarray)
static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist )
{
boxPack *boxarray;
boxPack *boxarray = NULL;
float tot_width, tot_height;
int len;
int error;

View File

@@ -56,8 +56,8 @@
/* Python API function prototypes for the Blender module. */
/*****************************************************************************/
static PyObject *M_Group_New( PyObject * self, PyObject * args );
PyObject *M_Group_Get( PyObject * self, PyObject * args );
PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
static PyObject *M_Group_Get( PyObject * self, PyObject * args );
static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
/* internal */
static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter );
@@ -405,7 +405,7 @@ PyObject *M_Group_New( PyObject * self, PyObject * args )
/* Function: M_Group_Get */
/* Python equivalent: Blender.Group.Get */
/*****************************************************************************/
PyObject *M_Group_Get( PyObject * self, PyObject * args )
static PyObject *M_Group_Get( PyObject * self, PyObject * args )
{
char *name = NULL;
Group *group_iter;
@@ -475,7 +475,7 @@ PyObject *M_Group_Get( PyObject * self, PyObject * args )
/* Function: M_Group_Unlink */
/* Python equivalent: Blender.Group.Unlink */
/*****************************************************************************/
PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
{
Group *group;
if( !BPy_Group_Check(pygrp) )

View File

@@ -154,7 +154,7 @@ PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh)
return PyString_FromString(self->prop->name);
}
int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
{
char *st;
if (!PyString_Check(value))
@@ -168,7 +168,7 @@ int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh)
return 0;
}
PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
{
return PyInt_FromLong((long)self->prop->type);
}
@@ -181,7 +181,7 @@ static PyGetSetDef BPy_IDGroup_getseters[] = {
{NULL, NULL, NULL, NULL, NULL}
};
int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
static int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
{
if (self->prop->type != IDP_GROUP)
return EXPP_ReturnIntError( PyExc_TypeError,
@@ -190,7 +190,7 @@ int BPy_IDGroup_Map_Len(BPy_IDProperty *self)
return self->prop->len;
}
PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
{
IDProperty *loop;
char *st;
@@ -212,7 +212,7 @@ PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
}
/*returns NULL on success, error string on failure*/
char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
static char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObject *ob)
{
IDProperty *prop = NULL;
IDPropertyTemplate val = {0};
@@ -297,7 +297,7 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje
return NULL;
}
int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
static int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
{
char *err;
@@ -325,7 +325,7 @@ int BPy_IDGroup_Map_SetItem(BPy_IDProperty *self, PyObject *key, PyObject *val)
return 0;
}
PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
{
BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
@@ -339,7 +339,7 @@ PyObject *BPy_IDGroup_SpawnIterator(BPy_IDProperty *self)
return (PyObject*) iter;
}
PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
case IDP_STRING:
@@ -401,7 +401,7 @@ PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
"eek!! a property exists with a bad type code!!!" );
}
PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
{
IDProperty *loop;
PyObject *pyform;
@@ -431,7 +431,7 @@ PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
"item not in group" );
}
PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
{
BPy_IDGroup_Iter *iter = PyObject_New(BPy_IDGroup_Iter, &IDGroup_Iter_Type);
@@ -446,7 +446,7 @@ PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
return (PyObject*) iter;
}
PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
{
PyObject *seq = PyList_New(self->prop->len);
IDProperty *loop;
@@ -481,7 +481,7 @@ PyObject *BPy_IDGroup_GetKeys(BPy_IDProperty *self)
return seq;
}
PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
{
PyObject *seq = PyList_New(self->prop->len);
IDProperty *loop;
@@ -517,7 +517,7 @@ PyObject *BPy_IDGroup_GetValues(BPy_IDProperty *self)
return seq;
}
PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
static PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
{
IDProperty *loop;
char *name = PyString_AsString(value);
@@ -533,7 +533,7 @@ PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
Py_RETURN_FALSE;
}
PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
{
PyObject *pyob, *pkey, *pval;
Py_ssize_t i=0;
@@ -555,7 +555,7 @@ PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
Py_RETURN_NONE;
}
PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
static PyObject *BPy_IDGroup_ConvertToPy(BPy_IDProperty *self)
{
return BPy_IDGroup_MapDataToPy(self->prop);
}
@@ -665,18 +665,18 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent)
/********Array Wrapper********/
PyObject *IDArray_repr(BPy_IDArray *self)
static PyObject *IDArray_repr(BPy_IDArray *self)
{
return PyString_FromString("(ID Array)");
}
PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
{
return PyInt_FromLong( (long)self->prop->subtype );
}
PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
static PyObject *BPy_IDArray_GetLen(BPy_IDArray *self)
{
return PyInt_FromLong( (long)self->prop->len );
}
@@ -693,12 +693,12 @@ static PyGetSetDef BPy_IDArray_getseters[] = {
{NULL, NULL, NULL, NULL, NULL},
};
int BPy_IDArray_Len(BPy_IDArray *self)
static int BPy_IDArray_Len(BPy_IDArray *self)
{
return self->prop->len;
}
PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
{
if (index < 0 || index >= self->prop->len)
return EXPP_ReturnPyObjError( PyExc_IndexError,
@@ -719,7 +719,7 @@ PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
"invalid/corrupt array type!");
}
int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *val)
{
int i;
float f;
@@ -865,18 +865,18 @@ PyTypeObject IDArray_Type = {
/*********** ID Property Group iterator ********/
PyObject *IDGroup_Iter_iterself(PyObject *self)
static PyObject *IDGroup_Iter_iterself(PyObject *self)
{
Py_XINCREF(self);
return self;
}
PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
{
return PyString_FromString("(ID Property Group)");
}
PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
{
IDProperty *cur=NULL;
PyObject *tmpval;

View File

@@ -1380,6 +1380,8 @@ static PyGetSetDef BPy_Image_getseters[] = {
"image odd fields toggle", (void *)IMA_STD_FIELD },
{"antialias", (getter)Image_getFlag, (setter)Image_setFlag,
"image antialiasing toggle", (void *)IMA_ANTIALI },
{"premul", (getter)Image_getFlag, (setter)Image_setFlag,
"image premultiply alpha toggle", (void *)IMA_DO_PREMUL },
{"reflect", (getter)Image_getFlag, (setter)Image_setFlag,
"image reflect toggle", (void *)IMA_REFLECT },
{"clampX", (getter)Image_getFlagTpage, (setter)Image_setFlagTpage,

View File

@@ -1027,7 +1027,6 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
{
namefunc lookup_name;
int size;
PyObject *dict;
int *vals = NULL;
char name[32];
PyObject *attr = Py_None;
@@ -1131,7 +1130,6 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
* with string as key and adrcode as value
*/
dict = PyModule_GetDict( submodule );
attr = PyConstant_New();
while( size-- ) {
@@ -1148,7 +1146,7 @@ static PyObject *Ipo_getCurveNames( BPy_Ipo * self )
return attr;
}
void generate_curveconsts( PyObject* module )
static void generate_curveconsts( PyObject* module )
{
namefunc lookup_name = NULL;
int size = 0;

View File

@@ -41,6 +41,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_scene_types.h"
#include "BezTriple.h"
#include "gen_utils.h"
@@ -80,6 +81,7 @@ static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self );
static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self );
static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getPoints( C_IpoCurve * self );
static PyObject *IpoCurve_clean( C_IpoCurve * self, PyObject *value );
static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getDriver( C_IpoCurve * self );
static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args );
@@ -127,6 +129,8 @@ static PyMethodDef C_IpoCurve_methods[] = {
"() - Returns list of all bezTriples of the curve"},
{"evaluate", ( PyCFunction ) IpoCurve_evaluate, METH_VARARGS,
"(float) - Evaluate curve at given time"},
{"clean", ( PyCFunction ) IpoCurve_clean, METH_VARARGS,
"(float) - Clean BezTriples using the given threshold value"},
{NULL, NULL, 0, NULL}
};
@@ -770,6 +774,29 @@ static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args )
}
/***************************************************************************/
/* Function: IpoCurve_clean( thresh ) */
/* Description: Cleans IPO curve with the (optional) threshold. */
/***************************************************************************/
static PyObject *IpoCurve_clean( C_IpoCurve * self, PyObject * args )
{
float thresh, othresh;
thresh= othresh= G.scene->toolsettings->clean_thresh;
/* expecting float */
if( !PyArg_ParseTuple( args, "|f", &thresh ) )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected float argument" ) );
/* set IPO-cleaning threshold based on value provided by user (temporarily) */
G.scene->toolsettings->clean_thresh= thresh;
clean_ipo_curve( self->ipocurve );
G.scene->toolsettings->clean_thresh= othresh;
Py_RETURN_NONE;
}
static PyObject *IpoCurve_getDriver( C_IpoCurve * self )
{
if( !self->ipocurve->driver )

View File

@@ -109,7 +109,7 @@
#define EXPP_MAT_SUBSIZE_MAX 25.0
#define EXPP_MAT_HARD_MIN 1
#define EXPP_MAT_HARD_MAX 255 /* 127 with MODE HALO ON */
#define EXPP_MAT_HARD_MAX 511 /* 127 with MODE HALO ON */
#define EXPP_MAT_HALOSEED_MIN 0
#define EXPP_MAT_HALOSEED_MAX 255
#define EXPP_MAT_NFLARES_MIN 1
@@ -699,7 +699,7 @@ static PyObject *Material_clearScriptLinks(BPy_Material *self, PyObject *args);
static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
static PyObject *Material_getColorband( BPy_Material * self, void * type);
int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
static int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
static PyObject *Material_copy( BPy_Material * self );
static PyObject *Material_freeNodes( BPy_Material * self );
@@ -2506,10 +2506,10 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args )
if( !PyArg_ParseTuple( args, "iO!|ii", &texnum, &Texture_Type, &pytex,
&texco, &mapto ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int in [0,9] and Texture" );
"expected int in [0,17] and Texture" );
if( ( texnum < 0 ) || ( texnum >= MAX_MTEX ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int in [0,9] and Texture" );
"expected int in [0,17] and Texture" );
bltex = Texture_FromPyObject( pytex );
@@ -2782,10 +2782,10 @@ int EXPP_Colorband_fromPyList( ColorBand **coba, PyObject * value )
for (i=0; i<5; i++) {
pyflt = PySequence_GetItem( colseq, i );
if (!PyNumber_Check(pyflt)) {
return ( EXPP_ReturnIntError( PyExc_ValueError,
"Colorband colors must be sequences of 5 floats" ) );
Py_DECREF ( pyflt );
Py_DECREF ( colseq );
return ( EXPP_ReturnIntError( PyExc_ValueError,
"Colorband colors must be sequences of 5 floats" ) );
}
Py_DECREF ( pyflt );
}
@@ -3038,7 +3038,7 @@ static PyObject *Material_getColorband( BPy_Material * self, void * type)
Py_RETURN_NONE;
}
int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
static int Material_setColorband( BPy_Material * self, PyObject * value, void * type)
{
switch( (long)type ) {
case 0: /* these are backwards, but that how it works */

View File

@@ -160,7 +160,7 @@ typedef struct FaceEdges {
* compare edges by vertex indices
*/
int medge_comp( const void *va, const void *vb )
static int medge_comp( const void *va, const void *vb )
{
const unsigned int *a = ((SrchEdges *)va)->v;
const unsigned int *b = ((SrchEdges *)vb)->v;
@@ -180,7 +180,7 @@ int medge_comp( const void *va, const void *vb )
* compare edges by insert list indices
*/
int medge_index_comp( const void *va, const void *vb )
static int medge_index_comp( const void *va, const void *vb )
{
const SrchEdges *a = (SrchEdges *)va;
const SrchEdges *b = (SrchEdges *)vb;
@@ -196,7 +196,7 @@ int medge_index_comp( const void *va, const void *vb )
* compare faces by vertex indices
*/
int mface_comp( const void *va, const void *vb )
static int mface_comp( const void *va, const void *vb )
{
const SrchFaces *a = va;
const SrchFaces *b = vb;
@@ -231,7 +231,7 @@ int mface_comp( const void *va, const void *vb )
* compare faces by insert list indices
*/
int mface_index_comp( const void *va, const void *vb )
static int mface_index_comp( const void *va, const void *vb )
{
const SrchFaces *a = va;
const SrchFaces *b = vb;
@@ -248,7 +248,7 @@ int mface_index_comp( const void *va, const void *vb )
* compare edges by vertex indices
*/
int faceedge_comp( const void *va, const void *vb )
static int faceedge_comp( const void *va, const void *vb )
{
const unsigned int *a = ((FaceEdges *)va)->v;
const unsigned int *b = ((FaceEdges *)vb)->v;
@@ -4239,7 +4239,7 @@ static int MFace_setTransp( BPy_MFace *self, PyObject *value )
return -1;
return EXPP_setIValueRange( value,
&self->mesh->mtface[self->index].transp, TF_SOLID, TF_SUB, 'b' );
&self->mesh->mtface[self->index].transp, TF_SOLID, TF_CLIP, 'b' );
}
/*
@@ -6271,19 +6271,12 @@ static PyObject *Mesh_getFromObject( BPy_Mesh * self, PyObject * args )
if( origmesh->mat ) {
for( i = origmesh->totcol; i-- > 0; ) {
/* are we an object material or data based? */
if (ob->colbits & 1<<i) {
if (ob->colbits & 1<<i)
self->mesh->mat[i] = ob->mat[i];
if (ob->mat[i])
ob->mat[i]->id.us++;
if (origmesh->mat[i])
origmesh->mat[i]->id.us--;
} else {
else
self->mesh->mat[i] = origmesh->mat[i];
if (origmesh->mat[i])
origmesh->mat[i]->id.us++;
}
if (self->mesh->mat[i])
self->mesh->mat[i]->id.us++;
}
}
}
@@ -8743,6 +8736,7 @@ static PyObject *M_Mesh_FaceTranspModesDict( void )
PyConstant_Insert( d, "ADD", PyInt_FromLong( TF_ADD ) );
PyConstant_Insert( d, "ALPHA", PyInt_FromLong( TF_ALPHA ) );
PyConstant_Insert( d, "SUB", PyInt_FromLong( TF_SUB ) );
PyConstant_Insert( d, "CLIP", PyInt_FromLong( TF_CLIP ) );
}
return FTM;

View File

@@ -1438,7 +1438,11 @@ static PyObject *ActionStrips_append( BPy_ActionStrips *self, PyObject * args )
strip->flag = ACTSTRIP_LOCK_ACTION;
find_stridechannel(ob, strip);
if(ob->nlastrips.first == NULL)
ob->nlaflag |= OB_NLA_OVERRIDE;
strip->repeat = 1.0;
strip->scale = 1.0;
act->id.us++;
BLI_addtail(&ob->nlastrips, strip);

View File

@@ -88,9 +88,6 @@ extern void countall(void);
#define NMESH_SUBDIV_MIN 0
#define NMESH_SUBDIV_MAX 6
/* Globals */
static PyObject *g_nmeshmodule = NULL;
static int unlink_existingMeshData( Mesh * mesh );
static int convert_NMeshToMesh( Mesh *mesh, BPy_NMesh *nmesh );
static void check_dverts(Mesh *me, int old_totverts);
@@ -2161,8 +2158,8 @@ static PyObject *new_NMesh_displist(ListBase *lb, Object *ob)
for(a=0; a<dl->parts; a++) {
DL_SURFINDEX(dl->flag & DL_CYCL_U, dl->flag & DL_CYCL_V, dl->nr, dl->parts);
if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
break;
for(; b<dl->nr; b++) {
vidx[0] = p2 + ioffset;
@@ -3321,7 +3318,6 @@ PyObject *NMesh_Init( void )
if( EdgeFlags )
PyModule_AddObject( submodule, "EdgeFlags", EdgeFlags );
g_nmeshmodule = submodule;
return submodule;
}

View File

@@ -299,26 +299,25 @@ static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int par
/* In Python these will be written to the console when doing a */
/* Blender.Object.__doc__ */
/*****************************************************************************/
char M_Object_doc[] = "The Blender Object module\n\n\
static char M_Object_doc[] = "The Blender Object module\n\n\
This module provides access to **Object Data** in Blender.\n";
char M_Object_New_doc[] =
static char M_Object_New_doc[] =
"(type) - Add a new object of type 'type' in the current scene";
char M_Object_Get_doc[] =
static char M_Object_Get_doc[] =
"(name) - return the object with the name 'name', returns None if not\
found.\n\
If 'name' is not specified, it returns a list of all objects in the\n\
current scene.";
char M_Object_GetSelected_doc[] =
static char M_Object_GetSelected_doc[] =
"() - Returns a list of selected Objects in the active layer(s)\n\
The active object is the first in the list, if visible";
char M_Object_Duplicate_doc[] =
static char M_Object_Duplicate_doc[] =
"(linked) - Duplicate all selected, visible objects in the current scene";
/*****************************************************************************/
/* Python method structure definition for Blender.Object module: */
/*****************************************************************************/
@@ -342,9 +341,8 @@ static int setupSB(Object* ob); /*Make sure Softbody Pointer is initialized */
static int setupPI(Object* ob);
static PyObject *Object_getParticleSys( BPy_Object * self );
/* fixme Object_newParticleSys( self, default-partsys-name ) */
static PyObject *Object_addVertexGroupsFromArmature( BPy_Object * self, PyObject * args);
static PyObject *Object_newParticleSys( BPy_Object * self );
static PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args );
static PyObject *Object_buildParts( BPy_Object * self );
static PyObject *Object_clearIpo( BPy_Object * self );
static PyObject *Object_clrParent( BPy_Object * self, PyObject * args );
@@ -478,7 +476,7 @@ static PyMethodDef BPy_Object_methods[] = {
/* name, method, flags, doc */
{"getParticleSystems", ( PyCFunction ) Object_getParticleSys, METH_NOARGS,
"Return a list of particle systems"},
{"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_NOARGS,
{"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_VARARGS,
"Create and link a new particle system"},
{"addVertexGroupsFromArmature" , ( PyCFunction ) Object_addVertexGroupsFromArmature, METH_VARARGS,
"Add vertex groups from armature using the bone heat method"},
@@ -1038,48 +1036,53 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
Py_RETURN_NONE;
}
/*****************************************************************************/
/* Python BPy_Object methods: */
/*****************************************************************************/
PyObject *Object_getParticleSys( BPy_Object * self ){
ParticleSystem *blparticlesys = 0;
PyObject *list;
ParticleSystem *psys= NULL;
Object *ob = self->object;
PyObject *partsyslist,*current;
int i= 0;
blparticlesys = ob->particlesystem.first;
list = PyList_New( BLI_countlist( &ob->particlesystem ) );
if( !list )
return EXPP_ReturnPyObjError( PyExc_MemoryError,
"PyList_New() failed" );
partsyslist = PyList_New( 0 );
for( psys=ob->particlesystem.first; psys; psys=psys->next )
PyList_SET_ITEM( list, i++, ParticleSys_CreatePyObject( psys, ob ) );
if (!blparticlesys)
return partsyslist;
/* fixme: for(;;) */
current = ParticleSys_CreatePyObject( blparticlesys, ob );
PyList_Append(partsyslist,current);
Py_DECREF(current);
while((blparticlesys = blparticlesys->next)){
current = ParticleSys_CreatePyObject( blparticlesys, ob );
PyList_Append(partsyslist,current);
Py_DECREF(current);
}
return partsyslist;
return list;
}
PyObject *Object_newParticleSys( BPy_Object * self ){
PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args ) {
ParticleSystem *psys = 0;
ParticleSystem *rpsys = 0;
ModifierData *md;
ParticleSystemModifierData *psmd;
Object *ob = self->object;
/* char *name = NULL; optional name param */
char *name = NULL;
ID *id;
int nr;
int nr;
id = (ID *)psys_new_settings("PSys", G.main);
if( !PyArg_ParseTuple( args, "|s", &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string or nothing" );
if( name ) {
for( id= G.main->particle.first; id; id= id->next ) {
if( !strcmp( name, id->name + 2 ) )
break;
}
if( !id )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"specified particle system not found" );
else
id->us++;
} else
id = (ID *)psys_new_settings("PSys", G.main);
psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
psys->pointcache = BKE_ptcache_add();
@@ -1698,11 +1701,9 @@ static PyObject *Object_getBoundBox( BPy_Object * self, PyObject *args )
"This object isn't linked to any object data (mesh, curve, etc) yet" );
if( !self->object->bb ) { /* if no ob bbox, we look in obdata */
Mesh *me;
Curve *curve;
switch ( self->object->type ) {
case OB_MESH:
me = self->object->data;
vec = (float*) mesh_get_bb(self->object)->vec;
break;
case OB_CURVE:

View File

@@ -138,7 +138,7 @@ static PyObject *Part_GetAge( BPy_PartSys * self, PyObject * args );
/*****************************************************************************/
/* Python Effect_Type callback function prototypes: */
/*****************************************************************************/
static PyObject *ParticleSys_repr( void );
static PyObject *ParticleSys_repr( BPy_PartSys * self );
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
@@ -415,13 +415,14 @@ PyTypeObject ParticleSys_Type = {
/*****************************************************************************/
/* Function: PARTICLESYS_repr */
/* Description: This is a callback function for the BPy_Effect type. It */
/* builds a meaninful string to represent effcte objects. */
/* Description: This is a callback function for the BPy_PartSys type. It */
/* builds a meaningful string to represent effect objects. */
/*****************************************************************************/
static PyObject *ParticleSys_repr( void )
static PyObject *ParticleSys_repr( BPy_PartSys * self )
{
return PyString_FromString( "ParticleSys" );
return PyString_FromFormat( "ParticleSys \"%s\"",
self->psys->part->id.name+2 );
}
/*****************************************************************************/

View File

@@ -591,7 +591,7 @@ PyObject *Scene_CreatePyObject( Scene * scene )
}
/*-----------------------FromPyObject-----------------------------------*/
Scene *Scene_FromPyObject( PyObject * pyobj )
static Scene *Scene_FromPyObject( PyObject * pyobj )
{
return ( ( BPy_Scene * ) pyobj )->scene;
}
@@ -1221,7 +1221,7 @@ static PyObject *SceneObSeq_getObjects( BPy_SceneObSeq *self, void *mode)
return SceneObSeq_CreatePyObject(self->bpyscene, NULL, (int)((long)mode));
}
int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
static int SceneObSeq_setObjects( BPy_SceneObSeq *self, PyObject *value, void *_mode_)
{
/*
ONLY SUPPORTS scn.objects.selected and scn.objects.context
@@ -1642,7 +1642,7 @@ static PyObject *SceneObSeq_unlink( BPy_SceneObSeq * self, PyObject *args )
Py_RETURN_FALSE;
}
PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self)
static PyObject *SceneObSeq_getActive(BPy_SceneObSeq *self)
{
Base *base;
SCENE_DEL_CHECK_PY(self->bpyscene);
@@ -1687,7 +1687,7 @@ static int SceneObSeq_setActive(BPy_SceneObSeq *self, PyObject *value)
return 0;
}
PyObject *SceneObSeq_getCamera(BPy_SceneObSeq *self)
static PyObject *SceneObSeq_getCamera(BPy_SceneObSeq *self)
{
SCENE_DEL_CHECK_PY(self->bpyscene);

View File

@@ -149,16 +149,12 @@ struct PyMethodDef M_sys_methods[] = {
/* Module Functions */
static PyObject *g_sysmodule = NULL; /* pointer to Blender.sys module */
PyObject *sys_Init( void )
{
PyObject *submodule, *dict;
submodule = Py_InitModule3( "Blender.sys", M_sys_methods, M_sys_doc );
g_sysmodule = submodule;
dict = PyModule_GetDict( submodule );
EXPP_dict_set_item_str( dict, "dirsep", PyString_FromString(DIRSEP_STR) );

View File

@@ -26,8 +26,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
#include "Types.h"
#include "Types.h"
#include "IDProp.h"
#include "gen_utils.h"
#include "BLI_blenlib.h"
/*
stuff pasted from the old Types.h
is only need here now
@@ -65,10 +67,126 @@ extern PyTypeObject ThemeSpace_Type;
extern PyTypeObject ThemeUI_Type;
extern PyTypeObject TimeLine_Type;
/* includes to get structs for CSizeof */
#include "Armature.h"
#include "Bone.h"
#include "BezTriple.h"
#include "Camera.h"
#include "Constraint.h"
#include "Curve.h"
#include "CurNurb.h"
#include "Draw.h"
#include "Effect.h"
#include "Ipo.h"
#include "Ipocurve.h"
#include "Key.h"
#include "Lamp.h"
#include "Lattice.h"
#include "Library.h"
#include "Mathutils.h"
#include "Geometry.h"
#include "Mesh.h"
#include "Metaball.h"
#include "Modifier.h"
#include "NMesh.h"
#include "Node.h"
#include "Object.h"
#include "Group.h"
#include "Registry.h"
#include "Scene.h"
#include "Sound.h"
#include "SurfNurb.h"
#include "Sys.h"
#include "Text.h"
#include "Texture.h"
#include "Window.h"
#include "World.h"
#include "Particle.h"
char M_Types_doc[] = "The Blender Types module\n\n\
This module is a dictionary of all Blender Python types";
struct PyMethodDef Null_methods[] = { {NULL, NULL, 0, NULL} };
static PyObject *Types_CSizeof(PyObject * self, PyObject *o)
{
int ret = 0;
if(o) {
if((void *)o == (void *)&Action_Type) {
ret = sizeof(struct bAction);
} else if ((void *)o==(void *)&Armature_Type) {
ret = sizeof(struct bArmature);
} else if ((void *)o==(void *)&BezTriple_Type) {
ret = sizeof(struct BezTriple);
} else if ((void *)o==(void *)&Bone_Type) {
ret = sizeof(struct Bone);
} else if ((void *)o==(void *)&Camera_Type) {
ret = sizeof(struct Camera);
} else if ((void *)o==(void *)&CurNurb_Type) {
ret = sizeof(struct Nurb);
} else if ((void *)o==(void *)&Curve_Type) {
ret = sizeof(struct Curve);
} else if ((void *)o==(void *)&Group_Type) {
ret = sizeof(struct Group);
} else if ((void *)o==(void *)&IDGroup_Type) {
ret = sizeof(struct IDProperty);
} else if ((void *)o==(void *)&Image_Type) {
ret = sizeof(struct Image);
} else if ((void *)o==(void *)&Ipo_Type) {
ret = sizeof(struct Ipo);
} else if ((void *)o==(void *)&IpoCurve_Type) {
ret = sizeof(struct IpoCurve);
} else if ((void *)o==(void *)&Lamp_Type) {
ret = sizeof(struct Lamp);
} else if ((void *)o==(void *)&Lattice_Type) {
ret = sizeof(struct Lattice);
} else if ((void *)o==(void *)&MCol_Type) {
ret = sizeof(struct MCol);
} else if ((void *)o==(void *)&MEdge_Type) {
ret = sizeof(struct MEdge);
} else if ((void *)o==(void *)&MFace_Type) {
ret = sizeof(struct MFace);
} else if ((void *)o==(void *)&MTex_Type) {
ret = sizeof(struct MTex);
} else if ((void *)o==(void *)&MVert_Type) {
ret = sizeof(struct MVert);
} else if ((void *)o==(void *)&Material_Type) {
ret = sizeof(struct Material);
} else if ((void *)o==(void *)&Mesh_Type) {
ret = sizeof(struct Mesh);
} else if ((void *)o==(void *)&Metaball_Type) {
ret = sizeof(struct MetaBall);
} else if ((void *)o==(void *)&ModSeq_Type) {
ret = sizeof(struct ModifierData);
} else if ((void *)o==(void *)&Modifier_Type) {
ret = sizeof(struct ModifierData);
} else if ((void *)o==(void *)&Object_Type) {
ret = sizeof(struct Object);
} else if ((void *)o==(void *)&Pose_Type) {
ret = sizeof(struct bPose);
} else if ((void *)o==(void *)&RenderData_Type) {
ret = sizeof(struct RenderData);
} else if ((void *)o==(void *)&Scene_Type) {
ret = sizeof(struct Scene);
} else if ((void *)o==(void *)&SurfNurb_Type) {
ret = sizeof(struct Nurb);
} else if ((void *)o==(void *)&Text3d_Type) {
ret = sizeof(struct Curve);
} else if ((void *)o==(void *)&Text_Type) {
ret = sizeof(struct Text);
} else if ((void *)o==(void *)&Texture_Type) {
ret = sizeof(struct Tex);
} else {
ret = -1;
}
}
return PyInt_FromLong(ret);
}
struct PyMethodDef M_Types_methods[] = {
{"CSizeof", Types_CSizeof, METH_O,
"(type) - Returns sizeof of the underlying C structure of the given type"},
{NULL, NULL, 0, NULL}
};
@@ -145,7 +263,7 @@ PyObject *Types_Init( void )
PyObject *submodule, *dict;
submodule =
Py_InitModule3( "Blender.Types", Null_methods, M_Types_doc );
Py_InitModule3( "Blender.Types", M_Types_methods, M_Types_doc );
dict = PyModule_GetDict( submodule );
@@ -187,13 +305,14 @@ PyObject *Types_Init( void )
( PyObject * ) &Armature_Type );
PyDict_SetItemString( dict, "BoneType", ( PyObject * ) &Bone_Type );
PyDict_SetItemString( dict, "CurNurb_Type",
PyDict_SetItemString( dict, "CurNurbType",
( PyObject * ) &CurNurb_Type );
PyDict_SetItemString( dict, "SurfNurb_Type",
PyDict_SetItemString( dict, "SurfNurbType",
( PyObject * ) &SurfNurb_Type );
PyDict_SetItemString( dict, "CurveType", ( PyObject * ) &Curve_Type );
PyDict_SetItemString( dict, "IpoType", ( PyObject * ) &Ipo_Type );
PyDict_SetItemString( dict, "IpoCurveType", ( PyObject * ) &IpoCurve_Type );
PyDict_SetItemString( dict, "MetaballType",
( PyObject * ) &Metaball_Type );
@@ -226,7 +345,7 @@ PyObject *Types_Init( void )
( PyObject * ) &constant_Type );
PyDict_SetItemString( dict, "rgbTupleType",
( PyObject * ) &rgbTuple_Type );
PyDict_SetItemString( dict, "matrix_Type",
PyDict_SetItemString( dict, "matrixType",
( PyObject * ) &matrix_Type );
PyDict_SetItemString( dict, "eulerType", ( PyObject * ) &euler_Type );
PyDict_SetItemString( dict, "quaternionType",
@@ -249,7 +368,7 @@ PyObject *Types_Init( void )
( PyObject * ) &EditBone_Type);
PyDict_SetItemString( dict, "ThemeSpaceType",
( PyObject * ) &ThemeSpace_Type);
PyDict_SetItemString( dict, "ThemeUI_Type",
PyDict_SetItemString( dict, "ThemeUIType",
( PyObject * ) &ThemeUI_Type);
PyDict_SetItemString( dict, "IDGroupType",
( PyObject * ) &IDGroup_Type);

View File

@@ -577,8 +577,6 @@ static PyObject * FileAndImageSelector(PyObject * self, PyObject * args, int typ
"\nexpected a callback function (and optionally one or two strings) "
"as argument(s)" );
Py_INCREF(pycallback);
/* trick: we move to a spacescript because then the fileselector will properly
* unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
* selection. This is necessary because when a user cancels, the
@@ -605,9 +603,18 @@ static PyObject * FileAndImageSelector(PyObject * self, PyObject * args, int typ
script->lastspace = startspace;
sc->script = script;
}
if (!script) {
/* should never happen unless we are executed
* from the BGE or somthing really strange like that */
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"Could not allocate a screen for an unknown reason." );
}
Py_INCREF(pycallback);
script->flags |= SCRIPT_FILESEL;
/* clear any previous callback (nested calls to selector) */
if (script->py_browsercallback) {
Py_DECREF((PyObject *)script->py_browsercallback);
@@ -1209,7 +1216,7 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
if( sa ) {
BWinEvent evt;
short do_redraw = 0, do_change = 0;
short do_redraw = 0;
if( sa != curarea || sa->win != mywinget( ) ) {
oldsa = curarea;
@@ -1221,7 +1228,6 @@ static PyObject *M_Window_QHandle( PyObject * self, PyObject * args )
do_redraw = 1;
} else if( evt.event == CHANGED ) {
sa->win_swap = 0;
do_change = 1;
do_redraw = 1;
} else {
scrarea_do_winhandle( sa, &evt );

View File

@@ -243,7 +243,7 @@ static PyObject *LibBlockSeq_nextIter( BPy_LibBlockSeq * self )
return object;
}
PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
static PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
{
switch (self->type) {
case ID_SCE:
@@ -382,7 +382,7 @@ static int LibBlockSeq_setTag(BPy_LibBlockSeq *self, PyObject *value)
/* New Data, internal functions */
Mesh *add_mesh__internal(char *name)
static Mesh *add_mesh__internal(char *name)
{
Mesh *mesh = add_mesh(name); /* doesn't return NULL now, but might someday */
@@ -453,8 +453,7 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
return EXPP_ReturnPyObjError( PyExc_IOError,
"couldn't create pyobject on load, unknown error" );
if (name) {
ID *id = ((BPy_GenericLib *)ret)->id;
rename_id( id, name );
rename_id( ((BPy_GenericLib *)ret)->id, name );
}
return ret;
}
@@ -599,7 +598,7 @@ PyObject *LibBlockSeq_new(BPy_LibBlockSeq *self, PyObject * args, PyObject *kwd)
}
PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
static PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
{
switch (self->type) {
case ID_SCE:
@@ -790,15 +789,12 @@ PyTypeObject LibBlockSeq_Type = {
PyObject * Data_Init( void )
{
PyObject *module;
PyObject *dict;
PyType_Ready( &LibBlockSeq_Type );
PyType_Ready( &Config_Type );
/*submodule = Py_InitModule3( "Blender.Main", NULL, M_Main_doc );*/
module = Py_InitModule3( "bpy.data", NULL, "The bpy.data submodule" );
dict = PyModule_GetDict( module );
/* Python Data Types */
PyModule_AddObject( module, "scenes", LibBlockSeq_CreatePyObject(NULL, ID_SCE) );

View File

@@ -37,19 +37,19 @@ PyTypeObject constant_Type;
//------------------METHOD IMPLEMENTATIONS-----------------------------
//------------------------constant.items()
//Returns a list of key:value pairs like dict.items()
PyObject* constant_items(BPy_constant *self)
static PyObject* constant_items(BPy_constant *self)
{
return PyDict_Items(self->dict);
}
//------------------------constant.keys()
//Returns a list of keys like dict.keys()
PyObject* constant_keys(BPy_constant *self)
static PyObject* constant_keys(BPy_constant *self)
{
return PyDict_Keys(self->dict);
}
//------------------------constant.values()
//Returns a list of values like dict.values()
PyObject* constant_values(BPy_constant *self)
static PyObject* constant_values(BPy_constant *self)
{
return PyDict_Values(self->dict);
}

View File

@@ -146,11 +146,11 @@ def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap):
@type width, height: int
@param width, height: Specify the pixel width and height of the bitmap image.
@type xorig,yorig: float
@param xorig,yorig: Specify the location of the origin in the bitmap image. The origin is measured
@type xorig, yorig: float
@param xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured
from the lower left corner of the bitmap, with right and up being the positive axes.
@type xmove,ymove: float
@param xmove,ymove: Specify the x and y offsets to be added to the current raster position after
@type xmove, ymove: float
@param xmove, ymove: Specify the x and y offsets to be added to the current raster position after
the bitmap is drawn.
@type bitmap: Buffer object I{type GL_BYTE}
@param bitmap: Specifies the address of the bitmap image.
@@ -207,8 +207,8 @@ def glClearAccum(red, green, blue, alpha):
Specify clear values for the accumulation buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html}
@type red,green,blue,alpha: float
@param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the
@type red, green, blue, alpha: float
@param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
accumulation buffer is cleared. The initial values are all 0.
"""
@@ -217,8 +217,8 @@ def glClearColor(red, green, blue, alpha):
Specify clear values for the color buffers
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html}
@type red,green,blue,alpha: float
@param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the
@type red, green, blue, alpha: float
@param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
color buffers are cleared. The initial values are all 0.
"""
@@ -274,8 +274,8 @@ def glColor (red, green, blue, alpha):
Set a new color.
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html}
@type red,green,blue,alpha: Depends on function prototype.
@param red,green,blue: Specify new red, green, and blue values for the current color.
@type red, green, blue, alpha: Depends on function prototype.
@param red, green, blue: Specify new red, green, and blue values for the current color.
@param alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only)
"""
@@ -285,8 +285,8 @@ def glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html}
@type red,green,blue,alpha: int (boolean)
@param red,green,blue,alpha: Specify whether red, green, blue, and alpha can or cannot be
@type red, green, blue, alpha: int (boolean)
@param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be
written into the frame buffer. The initial values are all GL_TRUE, indicating that the
color components can be written.
"""
@@ -308,8 +308,8 @@ def glCopyPixels(x, y, width, height, type):
Copy pixels in the frame buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html}
@type x,y: int
@param x,y: Specify the window coordinates of the lower left corner of the rectangular
@type x, y: int
@param x, y: Specify the window coordinates of the lower left corner of the rectangular
region of pixels to be copied.
@type width, height: int
@param width,height: Specify the dimensions of the rectangular region of pixels to be copied.
@@ -1079,7 +1079,7 @@ def glNormal3 (nx, ny, nz, v):
@param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal.
The initial value of the current normal is the unit vector, (0, 0, 1).
@type v: Buffer object. Depends on function prototype. ('v' prototypes)
@param v: Specifies a pointer to an array of three elements: the x,y, and z coordinates
@param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates
of the new current normal.
"""
@@ -1290,7 +1290,7 @@ def glRasterPos (x,y,z,w):
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html}
@type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only)
@param x,y,z,w: Specify the x,y,z, and w object coordinates (if present) for the
@param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the
raster position. If function prototype ends in 'v' specifies a pointer to an array of two,
three, or four elements, specifying x, y, z, and w coordinates, respectively.
@note:
@@ -1326,8 +1326,8 @@ def glReadPixels(x, y, width, height, format, type, pixels):
Read a block of pixels from the frame buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html}
@type x,y: int
@param x,y:Specify the window coordinates of the first pixel that is read
@type x, y: int
@param x, y:Specify the window coordinates of the first pixel that is read
from the frame buffer. This location is the lower left corner of a rectangular
block of pixels.
@type width, height: int
@@ -1375,8 +1375,8 @@ def glRotate (angle, x, y, z):
@type angle: Depends on function prototype.
@param angle: Specifies the angle of rotation in degrees.
@type x,y,z: Depends on function prototype.
@param x,y,z: Specify the x,y, and z coordinates of a vector respectively.
@type x, y, z: Depends on function prototype.
@param x, y, z: Specify the x, y, and z coordinates of a vector respectively.
"""
def glScale (x,y,z):
@@ -1386,8 +1386,8 @@ def glScale (x,y,z):
Multiply the current matrix by a general scaling matrix
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html}
@type x,y,z: Depends on function prototype.
@param x,y,z: Specify scale factors along the x,y, and z axes, respectively.
@type x, y, z: Depends on function prototype.
@param x, y, z: Specify scale factors along the x, y, and z axes, respectively.
"""
def glScissor(x,y,width,height):
@@ -1395,8 +1395,8 @@ def glScissor(x,y,width,height):
Define the scissor box
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html}
@type x,y: int
@param x,y: Specify the lower left corner of the scissor box. Initially (0, 0).
@type x, y: int
@param x, y: Specify the lower left corner of the scissor box. Initially (0, 0).
@type width, height: int
@param width height: Specify the width and height of the scissor box. When a
GL context is first attached to a window, width and height are set to the
@@ -1480,8 +1480,8 @@ def glTexCoord (s,t,r,q,v):
Set the current texture coordinates
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html}
@type s,t,r,q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
@param s,t,r,q: Specify s, t, r, and q texture coordinates. Not all parameters are
@type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
@param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are
present in all forms of the command.
@type v: Buffer object. Depends on function prototype. (for 'v' prototypes only)
@param v: Specifies a pointer to an array of one, two, three, or four elements,
@@ -1604,8 +1604,8 @@ def glTranslate (x, y, z):
Multiply the current matrix by a translation matrix
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html}
@type x,y,z: Depends on function prototype.
@param x,y,z: Specify the x, y, and z coordinates of a translation vector.
@type x, y, z: Depends on function prototype.
@param x, y, z: Specify the x, y, and z coordinates of a translation vector.
"""
def glVertex (x,y,z,w,v):
@@ -1618,8 +1618,8 @@ def glVertex (x,y,z,w,v):
Specify a vertex
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html}
@type x,y,z,w: Depends on function prototype (z and w for '3' and '4' prototypes only)
@param x,y,z,w: Specify x, y, z, and w coordinates of a vertex. Not all parameters
@type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only)
@param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters
are present in all forms of the command.
@type v: Buffer object. Depends of function prototype (for 'v' prototypes only)
@param v: Specifies a pointer to an array of two, three, or four elements. The
@@ -1632,11 +1632,11 @@ def glViewport(x,y,width,height):
Set the viewport
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html}
@type x,y: int
@param x,y: Specify the lower left corner of the viewport rectangle,
@type x, y: int
@param x, y: Specify the lower left corner of the viewport rectangle,
in pixels. The initial value is (0,0).
@type width,height: int
@param width,height: Specify the width and height of the viewport. When a GL context
@type width, height: int
@param width, height: Specify the width and height of the viewport. When a GL context
is first attached to a window, width and height are set to the dimensions of that window.
"""

View File

@@ -73,7 +73,7 @@ def Set (request, data):
- 'renderdir': default render output dir
- 'soundsdir': sound dir
- 'tempdir': temp file storage dir
- 'mipmap' : Use mipmapping in the 3d view (Use a boolean value True/False).
- 'mipmap' : Use mipmapping in the 3d view (Use a boolean value True/False).
@type data: int or string
@param data: The new value.
"""
@@ -111,7 +111,7 @@ def Get (request):
- 'soundsdir': the path to the user defined dir for sound files. (*)
- 'tempdir': the path to the user defined dir for storage of Blender
temporary files. (*)
- 'mipmap' : Use mipmapping in the 3d view. (*)
- 'mipmap' : Use mipmapping in the 3d view. (*)
- 'version' : the Blender version number.
@note: (*) these can be set in Blender at the User Preferences window -> File
Paths tab.
@@ -255,6 +255,6 @@ def Quit ():
def SaveUndoState (message):
"""
Sets an undo at the current state.
@param message: Message that appiers in the undo menu
@param message: Message that appears in the undo menu
@type message: string
"""

View File

@@ -235,19 +235,21 @@ def EndAlign():
Use after BeginAlign() to stop aligning the buttons (button layout only).
"""
def UIBlock(draw):
def UIBlock(draw, mouse_exit=1):
"""
This function creates a popup area where buttons, labels, sliders etc can be drawn.
@type mouse_exit: int
@param mouse_exit: When zero the popup wont close when the mouse moves away from the popup.
@type draw: function
@param draw: A function to draw to the popup area, taking no arguments: draw().
@note: The size of the popup will expand to fit the bounds of the buttons created in the draw function.
@note: Be sure to use the mouse coordinates to position the buttons under the mouse,
@note: If mouse_exit is nonzero be sure to use the mouse coordinates if to position the buttons under the mouse,
so the popup dosn't exit as soon as it opens.
The coordinates for buttons start 0,0 at the bottom left hand side of the screen.
@note: Within this popup, Redraw events and the registered button callback will not work.
For buttons to run events, use per button callbacks.
For buttons to run events, use per button callbacks instead.
@note: OpenGL drawing functions wont work within this popup, for text use L{Label} rather then L{Text}
@warning: L{Menu} will not work properly within a UIBlock, this is a limitation with blenders user interface internals.
"""

View File

@@ -59,8 +59,16 @@ def PointInTriangle2D(pt, tri_pt1, tri_pt2, tri_pt3):
"""
Takes 4 vectors (one for the test point and 3 for the triangle)
This is a 2d function so only X and Y are used, Z and W will be ignored.
@rtype: bool
@return: True or False depending on the points intersection.
@rtype: int
@return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
"""
def PointInQuad2D(pt, quad_pt1, quad_pt2, quad_pt3):
"""
Takes 5 vectors (one for the test point and 5 for the quad)
This is a 2d function so only X and Y are used, Z and W will be ignored.
@rtype: int
@return: 1 for a clockwise intersection, -1 for counter clockwise intersection, 0 when there is no intersection.
"""
def BoxPack2D(boxlist):

View File

@@ -107,6 +107,8 @@ class Image:
@type fields_odd: boolean
@ivar antialias: enable or disable the antialias option for this image.
@type antialias: boolean
@ivar premul: premultiply alpha toggle.
@type premul: boolean
@ivar bindcode: Texture's bind code (readonly).
@type bindcode: int
@ivar source: Image source type. See L{the Sources dictionary<Sources>} .

View File

@@ -57,8 +57,8 @@ The valid IpoCurve constants are:
TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF,
TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB,
TE_BRIGHT, TE_CONTRAS
9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SIZEX, PO_SIZEY,
PO_SIZEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SCALEX, PO_SCALEY,
PO_SCALEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
10. Sequence Ipo: SQ_FAC
Shape Key Ipos are handled differently from other Ipos. The user can rename

View File

@@ -16,7 +16,7 @@ BezTriples.
Example::
import Blender
ipo = Blender.Ipo.Get('ObIpo') # retrieves an Ipo object
ipo.name = 'ipo1' # change the Ipo's name
ipo.name = 'ipo1' # change the Ipo's name
icu = ipo[Blender.Ipo.OB_LOCX] # request X Location Ipo curve object
if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
val = icu[2.5] # get the curve's value at time 2.5
@@ -78,27 +78,27 @@ class IpoCurve:
get the value of the final curve point, read the final point from the
curve::
ipo = Blender.Object.Get('Cube').ipo
icu = ipo['LocX']
endtime,endvalue = icu.bezierPoints[-1].pt
ipo = Blender.Object.Get('Cube').ipo
icu = ipo['LocX']
endtime,endvalue = icu.bezierPoints[-1].pt
@type extend: int
"""
def __getitem__ (time):
"""
Returns the value of the curve at a particular time.
"""
Returns the value of the curve at a particular time.
@type time: float
@param time: time (Vertex X) on the curve
@rtype: float
@return: value (Vertex Y) corresponding to the given time
"""
"""
def __setitem__ (time):
"""
Sets the value (Vertex Y) of the curve at a particular time.
"""
Sets the value (Vertex Y) of the curve at a particular time.
@type time: float
@param time: time (Vertex X) on the curve
"""
"""
def setExtrapolation(extendmode):
"""
@@ -216,6 +216,17 @@ class IpoCurve:
@return: the points of the Ipo curve.
"""
def clean( thresh=0.0000001 ):
"""
Calls the IPO-curve cleaning function on this IpoCurve.
There is no need to recalculate curve manually.
@type thresh: float
@param thresh: The threshold to used to determine if two values are identical.
By default, the IPO-editor tool's value is used.
@rtype: None
@return: None
"""
def evaluate( time ):
"""
Compute the value of the Ipo curve at a particular time (B{deprecated}).

View File

@@ -212,7 +212,7 @@ class Material:
Value is clamped to the range [0.0,100.0].
@type haloSize: float
@ivar hard: Hardness of the specularity.
Value is clamped to the range [1,255].
Value is clamped to the range [1,511].
@type hard: int
@ivar ipo: Material Ipo data.
Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo.

View File

@@ -85,6 +85,7 @@ done once.
- ADD - add to background (halo).
- ALPHA - draw with transparency.
- SUB - subtract from background.
- CLIP - Clipped alpha.
@var EdgeFlags: The available edge flags.
- SELECT - selected (B{deprecated}). Use edge.sel attribute instead.
- EDGEDRAW - edge is drawn out of edition mode.

View File

@@ -128,11 +128,9 @@ def turbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'],
@return: the generated turbulence value.
"""
def vTurbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'],
ampscale = 0.5, freqscale = 2.0):
def vTurbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'], ampscale = 0.5, freqscale = 2.0):
"""
Returns general turbulence vector using the optional specified noise basis
function.
Returns general turbulence vector using the optional specified noise basis function.
@type xyz: 3-float tuple
@param xyz: (x,y,z) float values.
@type octaves: int

View File

@@ -264,7 +264,7 @@ class Object:
B{Note}:
When dealing with properties and functions such as LocX/RotY/getLocation(), getSize() and getEuler(),
keep in mind that these transformation properties are relative to the object's parent (if any).
keep in mind that these transformation properties are relative to the object itself, ignoring any other transformations.
To get these values in worldspace (taking into account vertex parents, constraints, etc.)
pass the argument 'worldspace' to these functions.
@@ -656,9 +656,13 @@ class Object:
Return a list of particle systems linked to this object (see Blender.Particle).
"""
def newParticleSystem():
def newParticleSystem(name = None):
"""
Link a new particle system (see Blender.Particle).
Link a particle system (see Blender.Particle). If no name is
given, a new particle system is created. If a name is given and a
particle system with that name exists, it is linked to the object.
@type name: string
@param name: The name of the requested Particle system (optional).
"""
def addVertexGroupsFromArmature(object):
@@ -780,9 +784,9 @@ class Object:
"""
@type space: string
@param space: The desired space for the size:
- localspace: (default) relative to the object's parent;
- worldspace: absolute, taking vertex parents, tracking and
Ipo's into account;
- localspace: (default) location without other transformations
- worldspace: location taking vertex parents, tracking and
Ipos into account
Returns the object's localspace rotation as Euler rotation vector (rotX, rotY, rotZ). Angles are in radians.
@rtype: Py_Euler
@return: A python Euler. Data is wrapped when euler is present.
@@ -812,9 +816,9 @@ class Object:
"""
@type space: string
@param space: The desired space for the location:
- localspace: (default) relative to the object's parent;
- worldspace: absolute, taking vertex parents, tracking and
Ipo's into account;
- localspace: (default) location without other transformations
- worldspace: location taking vertex parents, tracking and
Ipos into account
Returns the object's location (x, y, z).
@return: (x, y, z)
@@ -895,9 +899,9 @@ class Object:
"""
@type space: string
@param space: The desired space for the size:
- localspace: (default) relative to the object's parent;
- worldspace: absolute, taking vertex parents, tracking and
Ipo's into account;
- localspace: (default) location without other transformations
- worldspace: location taking vertex parents, tracking and
Ipos into account
Returns the object's size.
@return: (SizeX, SizeY, SizeZ)
@note: the worldspace size will not return negative (flipped) scale values.

View File

@@ -131,8 +131,7 @@ class Particle:
Get the particles locations.
A list of tuple is returned in particle mode.
A list of list of tuple is returned in hair mode.
The tuple is a vector of 3 or 4 floats in world space (x,y,z,
optionally the particle's id).
The tuple is a vector of 3 or 4 floats in world space (x,y,z, optionally the particle's id).
@type all: int
@param all: if not 0 export all particles (uninitialized (unborn or died)particles exported as None).
@type id: int

View File

@@ -1228,3 +1228,17 @@ class RenderData:
@rtype: int (if prototype is empty)
@return: Current new map value for the scene.
"""
def addRenderLayer():
"""
Add a new render layer to the rendering context, see L{RenderLayer}.
@rtype: RenderLayer
@return: The newly created renderlayer.
"""
def removeRenderLayer(renderlayer):
"""
Remove the specified render layer from the rendering context.
@type renderlayer: L{RenderLayer}
@param renderlayer: must be a L{RenderLayer}
"""

View File

@@ -0,0 +1,92 @@
# Blender.Scene.Render.RenderLayer module and the RenderLayer PyType object
"""
The Blender.Scene.Render.RenderLayer submodule.
Scene.Render.RenderLayer
========================
This module provides access to B{Render Layers} in Blender.
Example::
import bpy
sce = bpy.data.scenes.active
render = sce.render
layer = render.addRenderLayer()
render.removeRenderLayer(layer)
"""
class RenderLayer:
"""
The RenderLayer object
======================
@type name: string
@ivar name: Get or set the name for the L{RenderLayer}
@type lightGroup: group
@ivar lightGroup: group of lights
@type enable: bool
@ivar enable: enable this render layer
@type enableZMask: bool
@ivar enableZMask: Only render what's in front of the solid z values
@type enableZMaskAll: bool
@ivar enableZMaskAll: Fill in Z values for solid faces in invisible layers, for masking
@type enableSolid: bool
@ivar enableSolid: Render Solid faces in this Layer
@type enableZTra: bool
@ivar enableZTra: Render Z-Transparent faces in this Layer (On top of Solid and Halos)
@type enableHalo: bool
@ivar enableHalo: Render Halos in this Layer (on top of Solid)
@type enableEdge: bool
@ivar enableEdge: Render Edge-enhance in this Layer (only works for Solid faces)
@type enableSky: bool
@ivar enableSky: Render Sky or backbuffer in this Layer
@type enableStrand: bool
@ivar enableStrand: Render Strands in this Layer
@type layerMask: bool
@ivar layerMask: ...
@type zLayerMask: bool
@ivar zLayerMask: ...
@type passCombined: bool
@ivar passCombined: Deliver full combined RGBA buffer
@type passZ: bool
@ivar passZ: Deliver Z values pass
@type passSpeed: bool
@ivar passSpeed: Deliver Speed Vector pass
@type passNormal: bool
@ivar passNormal: Deliver Normal pass
@type passUV: bool
@ivar passUV: Deliver Texture UV pass
@type passMist: bool
@ivar passMist: Deliver Mist factor pass (0-1)
@type passIndex: bool
@ivar passIndex: Deliver Object Index pass
@type passColor: bool
@ivar passColor: Deliver shade-less Color pass
@type passDiffuse: bool
@ivar passDiffuse: Deliver Diffuse pass
@type passSpecular: bool
@ivar passSpecular: Deliver Specular pass
@type passShadow: bool
@ivar passShadow: Deliver Shadow pass
@type passAO: bool
@ivar passAO: Deliver AO pass
@type passReflect: bool
@ivar passReflect: Deliver Raytraced Reflection pass
@type passRefract: bool
@ivar passRefract: Deliver Raytraced Reflection pass
@type passRadiosity: bool
@ivar passRadiosity: Deliver Radiosity pass
@type passSpecularXOR: bool
@ivar passSpecularXOR: Deliver Specular pass XOR
@type passShadowXOR: bool
@ivar passShadowXOR: Deliver Shadow pass XOR
@type passAOXOR: bool
@ivar passAOXOR: Deliver AO pass XOR
@type passRefractXOR: bool
@ivar passRefractXOR: Deliver Raytraced Reflection pass XOR
@type passRadiosityXOR: bool
@ivar passRadiosityXOR: Deliver Radiosity pass XOR
"""

View File

@@ -0,0 +1,28 @@
#!/usr/bin/python
Import ('env')
from optparse import OptionParser
try:
import epydoc
except ImportError:
print "No epydoc install detected, Python API Docs will not be generated "
if epydoc:
from epydoc.docbuilder import build_doc_index
from epydoc import cli
names = env.Glob("source/blender/python/api2_2x/doc/[A-Z]*.py")
docindex = build_doc_index(names)
optvalues = cli.OPTION_DEFAULTS
optvalues["verbose"] = 1
optvalues["target"] = env["BF_DOCDIR"]+"/BPY_API/"
optvalues["url"] = "http://www.blender.org"
optvalues["top"] = "API_intro"
optvalues["name"] = "Blender"
optvalues["noprivate"] = 1
optvalues["noframes"] = 1
optvalues["names"] = names
optparser = OptionParser()
optparser.set_defaults(**optvalues)
(options, args) = optparser.parse_args([])
cli.write_html(docindex, options)

View File

@@ -143,7 +143,7 @@ class Text:
Retrieve the contents of this Text buffer as a list of strings between
the start and end lines specified. If end < 0 all lines from start will
be included.
@type start int
@type start: int
@param start: Optional index of first line of the span to return
@type end int
@param end: Optional index of the line to which the span is taken or

View File

@@ -432,9 +432,9 @@ class Texture:
def setFlags(f1=None, f2=None, f3=None, f4=None):
"""
Set this object's flags.
@param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of
@param f1, f2, f3, f4: Flags to be set (omitted flags are cleared). Can be any of
'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
@type f1,f2,f3,f4: string
@type f1, f2, f3, f4: string
"""
def setImage(image):

View File

@@ -25,6 +25,17 @@ Example::
elif type(data) == Types.LampType:
print "Let there be light!"
Since Blender 2.48a you can get the size of the underlying DNA structs for a collection of Blender Python types.
Example::
# loop over Types dictionary and print the struct sizes
# -1 where the type is not supported byt the CSizeof function
import Blender.Types as bt
x = dir(bt)
for t in x:
s = 'bt.CSizeof(bt.' + t + ')'
print t,"=", eval(s)
@var ObjectType: Blender Object. The base object, linked to its specific data
at its .data member variable.
@var GroupType: Blender Group. A Group that references a list of objects that are a part of this group.
@@ -45,8 +56,12 @@ Example::
@var ArmatureType: Blender Armature. The "skeleton", for animating and deforming
objects.
@var BoneType: Blender Bone. Bones are, obviously, the "pieces" of an Armature.
@var EditBoneType: Blender Editbone. Bones in editmode.
@var CurveType: Blender Curve.
@var IpoType: Blender Ipo.
@var CurNurbType: Blender CurNurb.
@var SurfNurbType: Blender SurfNurb.
@var IpoCurveType: Blender IpoCurve.
@var MetaballType: Blender Metaball.
@var CameraType: Blender Camera.
@var ImageType: Blender Image.
@@ -57,7 +72,7 @@ objects.
@var SceneType: A Blender Scene. Container of all other objects.
@var ButtonType: Blender Button. One of the Draw widgets.
@var vectorType: Blender vector. Used in NMesh, Mesh and elsewhere.
@var matrix_Type: Blender matrix.
@var matrixType: Blender matrix.
@var quaternionType: Blender quaternion. Used in armatures.
@var eulerType: Blender euler.
@var bufferType: Blender buffer. A contiguous piece of storage, used in BGL.
@@ -68,3 +83,11 @@ objects.
@var IDGroupType: Blender IDProperty Group type.
@var IDArrayType: Blender IDProperty Array type.
"""
def CSizeof (type):
"""
Get the size in bytes of the underlying DNA struct for the given type.
@param type: A Blender Python type.
@type type: type
@return: size in bytes or -1 if not supported type.
"""

View File

@@ -7,5 +7,5 @@
# set posix locale so regex works properly for [A-Z]*.py
LC_ALL=POSIX
epydoc -v -o BPY_API --url "http://www.blender.org" --top API_intro \
epydoc --debug -v -o BPY_API --url "http://www.blender.org" --top API_intro \
--name "Blender" --no-private --no-frames [A-Z]*.py

View File

@@ -774,7 +774,7 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return EXPP_ReturnPyObjError(PyExc_TypeError,
"Matrix multiplication: arguments not acceptable for this operation\n");
}
PyObject* Matrix_inv(MatrixObject *self)
static PyObject* Matrix_inv(MatrixObject *self)
{
return Matrix_Invert(self);
}

View File

@@ -89,7 +89,8 @@ enum rend_constants {
EXPP_RENDER_ATTR_BAKEMODE,
EXPP_RENDER_ATTR_BAKEDIST,
EXPP_RENDER_ATTR_BAKENORMALSPACE,
EXPP_RENDER_ATTR_BAKEBIAS
EXPP_RENDER_ATTR_BAKEBIAS,
EXPP_RENDER_ATTR_OCRES
};
#define EXPP_RENDER_ATTR_CFRA 2
@@ -397,13 +398,13 @@ static PyObject *M_Render_getInt( BPy_RenderData *self, int var )
/* Render Module Function Definitions */
/***************************************************************************/
PyObject *M_Render_CloseRenderWindow( PyObject * self )
static PyObject *M_Render_CloseRenderWindow( PyObject * self )
{
BIF_close_render_display( );
Py_RETURN_NONE;
}
PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
static PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
{
PyObject *list = NULL;
char *loc = NULL;
@@ -446,7 +447,7 @@ PyObject *M_Render_SetRenderWinPos( PyObject * self, PyObject * args )
Py_RETURN_NONE;
}
PyObject *M_Render_EnableDispView( PyObject * self )
static PyObject *M_Render_EnableDispView( PyObject * self )
{
G.displaymode = R_DISPLAYIMAGE;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -454,7 +455,7 @@ PyObject *M_Render_EnableDispView( PyObject * self )
Py_RETURN_NONE;
}
PyObject *M_Render_EnableDispWin( PyObject * self )
static PyObject *M_Render_EnableDispWin( PyObject * self )
{
G.displaymode = R_DISPLAYWIN;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -467,7 +468,7 @@ PyObject *M_Render_EnableDispWin( PyObject * self )
/* BPy_RenderData Function Definitions */
/***************************************************************************/
PyObject *RenderData_Render( BPy_RenderData * self )
static PyObject *RenderData_Render( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
@@ -511,7 +512,7 @@ PyObject *RenderData_Render( BPy_RenderData * self )
/* BPy_Bake Function Definitions */
/***************************************************************************/
PyObject *RenderData_Bake( BPy_RenderData * self )
static PyObject *RenderData_Bake( BPy_RenderData * self )
{
char *error_msg = NULL;
Scene *oldsce;
@@ -532,7 +533,7 @@ PyObject *RenderData_Bake( BPy_RenderData * self )
/*
* This will save the rendered image to an output file path already defined.
*/
PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
static PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
{
char dir[FILE_MAXDIR * 2], str[FILE_MAXFILE * 2];
char *name_str, filepath[FILE_MAXDIR+FILE_MAXFILE];
@@ -571,7 +572,7 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
Py_RETURN_NONE;
}
PyObject *RenderData_RenderAnim( BPy_RenderData * self )
static PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
@@ -609,7 +610,7 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_Play( BPy_RenderData * self )
static PyObject *RenderData_Play( BPy_RenderData * self )
{
char file[FILE_MAXDIR + FILE_MAXFILE];
extern char bprogname[];
@@ -668,46 +669,46 @@ PyObject *RenderData_Play( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableBackbuf( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleShort( args, 1,
&self->renderContext->bufflag );
}
PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableExtensions( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_EXTENSION,
&self->renderContext->scemode );
}
PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableSequencer( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_DOSEQ,
&self->renderContext->scemode );
}
PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
static PyObject *RenderData_EnableRenderDaemon( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_BG_RENDER,
&self->renderContext->scemode );
}
PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
static PyObject *RenderData_EnableToonShading( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_EDGE,
&self->renderContext->mode );
}
PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EdgeIntensity( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->edgeint, 0,
255 );
}
PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
{
float red, green, blue;
@@ -732,7 +733,7 @@ PyObject *RenderData_SetEdgeColor( BPy_RenderData * self, PyObject * args )
Py_RETURN_NONE;
}
PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
static PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
{
char rgb[24];
@@ -741,7 +742,7 @@ PyObject *RenderData_GetEdgeColor( BPy_RenderData * self )
return PyString_FromString( rgb );
}
PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
static PyObject *RenderData_EnableOversampling( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_OSA,
@@ -768,34 +769,34 @@ static int RenderData_setOSALevel( BPy_RenderData * self,
return 0;
}
PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableMotionBlur( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_MBLUR,
&self->renderContext->mode );
}
PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_MotionBlurLevel( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->blurfac,
0.01f, 5.0f );
}
PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_PartsX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->xparts, 1,
512 );
}
PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_PartsY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->yparts, 1,
64 );
}
PyObject *RenderData_EnableSky( BPy_RenderData * self )
static PyObject *RenderData_EnableSky( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ADDSKY;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -803,7 +804,7 @@ PyObject *RenderData_EnableSky( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
static PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ALPHAPREMUL;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -811,7 +812,7 @@ PyObject *RenderData_EnablePremultiply( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnableKey( BPy_RenderData * self )
static PyObject *RenderData_EnableKey( BPy_RenderData * self )
{
self->renderContext->alphamode = R_ALPHAKEY;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -819,59 +820,59 @@ PyObject *RenderData_EnableKey( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableShadow( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_SHADOW,
&self->renderContext->mode );
}
PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
static PyObject *RenderData_EnableEnvironmentMap( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_ENVMAP,
&self->renderContext->mode );
}
PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnablePanorama( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_PANORAMA,
&self->renderContext->mode );
}
PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EnableRayTracing( BPy_RenderData * self, PyObject * args )
{
return M_Render_BitToggleInt( args, R_RAYTRACE,
&self->renderContext->mode );
}
PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
static PyObject *RenderData_EnableRadiosityRender( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_RADIO,
&self->renderContext->mode );
}
PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
static PyObject *RenderData_EnableFieldRendering( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_FIELDS,
&self->renderContext->mode );
}
PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
static PyObject *RenderData_EnableOddFieldFirst( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_ODDFIELD,
&self->renderContext->mode );
}
PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
static PyObject *RenderData_EnableFieldTimeDisable( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_FIELDSTILL,
&self->renderContext->mode );
}
PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
static PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_GAUSS,
@@ -882,7 +883,7 @@ PyObject *RenderData_EnableGaussFilter( BPy_RenderData * self,
/* choices are listed in DNA_scene_types.h (search filtertype) */
}
PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
static PyObject *RenderData_EnableBorderRender( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_BORDER,
@@ -924,57 +925,57 @@ static PyObject *RenderData_getBorder( BPy_RenderData * self )
self->renderContext->border.ymax );
}
PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
static PyObject *RenderData_EnableGammaCorrection( BPy_RenderData * self,
PyObject * args )
{
return M_Render_BitToggleInt( args, R_GAMMA,
&self->renderContext->mode );
}
PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_GaussFilterSize( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->gauss,
0.5f, 1.5f );
}
PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_AspectRatioX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args, &self->renderContext->xasp,
1.0f, 200.0f );
}
PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_AspectRatioY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args, &self->renderContext->yasp,
1.0f, 200.0f );
}
PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_StartFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->sfra,
1, MAXFRAME );
}
PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_CurrentFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->cfra,
1, MAXFRAME );
}
PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_EndFrame( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args, &self->renderContext->efra,
1, MAXFRAME );
}
PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_ImageSizeX( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args, &self->renderContext->xsch,
4, 10000 );
}
PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_ImageSizeY( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args, &self->renderContext->ysch,
4, 10000 );
@@ -1003,7 +1004,7 @@ static int RenderData_setRenderer( BPy_RenderData * self, PyObject * value )
return 0;
}
PyObject *RenderData_EnableCropping( void )
static PyObject *RenderData_EnableCropping( void )
{
/* return M_Render_BitToggleInt( args, R_MOVIECROP,
&self->renderContext->mode );
@@ -1069,21 +1070,21 @@ static int RenderData_setImageType( BPy_RenderData *self, PyObject *value )
return 0;
}
PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_Quality( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->quality,
10, 100 );
}
PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_FramesPerSec( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->frs_sec, 1,
120 );
}
PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
static PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANESBW;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1091,7 +1092,7 @@ PyObject *RenderData_EnableGrayscale( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
static PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANES24;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1099,7 +1100,7 @@ PyObject *RenderData_EnableRGBColor( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
static PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
{
self->renderContext->planes = R_PLANES32;
EXPP_allqueue( REDRAWBUTSSCENE, 0 );
@@ -1107,7 +1108,7 @@ PyObject *RenderData_EnableRGBAColor( BPy_RenderData * self )
Py_RETURN_NONE;
}
PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_SizePreset( BPy_RenderData * self, PyObject * args )
{
int type;
@@ -1491,7 +1492,7 @@ static PyObject *RenderData_getYafrayGITunePhotons( BPy_RenderData * self )
/* (die) end */
PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod > 0 ) {
return M_Render_GetSetAttributeFloat( args,
@@ -1503,7 +1504,7 @@ PyObject *RenderData_YafrayGIPower( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'SKYDOME' or 'FULL'" ) );
}
PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->
@@ -1511,7 +1512,7 @@ PyObject *RenderData_YafrayGIIndirPower( BPy_RenderData * self, PyObject * args
100.00f );
}
PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
return M_Render_GetSetAttributeInt( args,
@@ -1522,7 +1523,7 @@ PyObject *RenderData_YafrayGIDepth( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'FULL'" ) );
}
PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
return M_Render_GetSetAttributeInt( args,
@@ -1533,7 +1534,7 @@ PyObject *RenderData_YafrayGICDepth( BPy_RenderData * self, PyObject * args )
"YafrayGIMethod must be set to 'FULL'" ) );
}
PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
static PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
@@ -1545,7 +1546,7 @@ PyObject *RenderData_EnableYafrayGICache( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL'" ) );
}
PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
static PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2 ) {
@@ -1557,7 +1558,7 @@ PyObject *RenderData_EnableYafrayGIPhotons( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL'" ) );
}
PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1571,7 +1572,7 @@ PyObject *RenderData_YafrayGIPhotonCount( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1585,7 +1586,7 @@ PyObject *RenderData_YafrayGIPhotonRadius( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1598,7 +1599,7 @@ PyObject *RenderData_YafrayGIPhotonMixCount( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
static PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1611,7 +1612,7 @@ PyObject *RenderData_EnableYafrayGITunePhotons( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GIPhotons must be enabled" ) );
}
PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1625,7 +1626,7 @@ PyObject *RenderData_YafrayGIShadowQuality( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1638,7 +1639,7 @@ PyObject *RenderData_YafrayGIPixelsPerSample( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
static PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
PyObject * args )
{
if( self->renderContext->GImethod == 2
@@ -1652,53 +1653,53 @@ PyObject *RenderData_YafrayGIRefinement( BPy_RenderData * self,
"YafrayGIMethod must be set to 'FULL' and GICache must be enabled" ) );
}
PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayRayBias( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->YF_raybias,
0.0f, 10.0f );
}
PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayRayDepth( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeInt( args,
&self->renderContext->YF_raydepth,
1, 80 );
}
PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayGamma( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->YF_gamma,
0.001f, 5.0f );
}
PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_YafrayExposure( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeFloat( args,
&self->renderContext->
YF_exposure, 0.0f, 10.0f );
}
PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
static PyObject *RenderData_EnableGameFrameStretch( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_SCALE;
Py_RETURN_NONE;
}
PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
static PyObject *RenderData_EnableGameFrameExpose( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_EXTEND;
Py_RETURN_NONE;
}
PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
static PyObject *RenderData_EnableGameFrameBars( BPy_RenderData * self )
{
self->scene->framing.type = SCE_GAMEFRAMING_BARS;
Py_RETURN_NONE;
}
PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
static PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
PyObject * args )
{
float red = 0.0f;
@@ -1726,7 +1727,7 @@ PyObject *RenderData_SetGameFrameColor( BPy_RenderData * self,
Py_RETURN_NONE;
}
PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
static PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
{
char rgb[24];
@@ -1736,33 +1737,33 @@ PyObject *RenderData_GetGameFrameColor( BPy_RenderData * self )
}
#ifdef __sgi
PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_SGIMaxsize( BPy_RenderData * self, PyObject * args )
{
return M_Render_GetSetAttributeShort( args,
&self->renderContext->maximsize,
0, 500 );
}
PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
static PyObject *RenderData_EnableSGICosmo( BPy_RenderData *self, PyObject *args )
{
return M_Render_BitToggleInt( args, R_COSMO,
&self->renderContext->mode );
}
#else
PyObject *RenderData_SGIMaxsize( void )
static PyObject *RenderData_SGIMaxsize( void )
{
return EXPP_ReturnPyObjError( PyExc_StandardError,
"SGI is not defined on this machine" );
}
PyObject *RenderData_EnableSGICosmo( void )
static PyObject *RenderData_EnableSGICosmo( void )
{
return EXPP_ReturnPyObjError( PyExc_StandardError,
"SGI is not defined on this machine" );
}
#endif
PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
{
PyObject *tmp = M_Render_GetSetAttributeInt(args,
&self->renderContext->framapto, 1, 900);
@@ -1771,7 +1772,7 @@ PyObject *RenderData_OldMapValue( BPy_RenderData * self, PyObject * args )
return tmp;
}
PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
static PyObject *RenderData_NewMapValue( BPy_RenderData * self, PyObject * args )
{
PyObject *tmp = M_Render_GetSetAttributeInt(args,
&self->renderContext->images, 1, 900);
@@ -1803,7 +1804,7 @@ static PyObject *RenderData_getTimeCode( BPy_RenderData * self) {
/***************************************************************************/
/* Render layer functions */
/***************************************************************************/
PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
static PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
{
PyObject *list, *layer;
SceneRenderLayer *srl;
@@ -1818,7 +1819,7 @@ PyObject *RenderData_getRenderLayers(BPy_RenderData * self)
return list;
}
PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *value)
static PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *value)
{
int index;
if (!BPy_RenderLayer_Check(value))
@@ -1855,7 +1856,7 @@ PyObject *RenderData_removeRenderLayer(BPy_RenderData * self, BPy_RenderLayer *v
Py_RETURN_NONE;
}
PyObject *RenderData_addRenderLayer(BPy_RenderData * self ) {
static PyObject *RenderData_addRenderLayer(BPy_RenderData * self ) {
scene_add_render_layer(self->scene);
return RenderLayer_CreatePyObject( self->scene, self->renderContext->layers.last );
@@ -1997,6 +1998,9 @@ static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type )
case EXPP_RENDER_ATTR_BAKENORMALSPACE:
param = self->renderContext->bake_normal_space;
break;
case EXPP_RENDER_ATTR_OCRES:
param = self->renderContext->ocres;
break;
default:
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"undefined type constant in RenderData_setIValueAttrClamp" );
@@ -2798,6 +2802,10 @@ static PyGetSetDef BPy_RenderData_getseters[] = {
(getter)RenderData_getMapNew, (setter)RenderData_setMapNew,
"New mapping value (in frames)",
NULL},
{"octreeResolution",
(getter)RenderData_getIValueAttr, (setter)NULL,
"Resolution for octree",
(void *)EXPP_RENDER_ATTR_OCRES},
{"set",
(getter)RenderData_getSet, (setter)RenderData_setSet,
"Scene link 'set' value",
@@ -3587,7 +3595,7 @@ static PyGetSetDef BPy_RenderLayer_getseters[] = {
(getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits,
"Deliver Raytraced Reflection pass",
(void *)SCE_PASS_REFRACT},
{"passRadiosiy",
{"passRadiosity",
(getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits,
"Deliver Radiosity pass",
(void *)SCE_PASS_RADIO},
@@ -3609,7 +3617,7 @@ static PyGetSetDef BPy_RenderLayer_getseters[] = {
(getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits,
"Deliver Raytraced Reflection pass XOR",
(void *)SCE_PASS_REFRACT},
{"passRadiosiyXOR",
{"passRadiosityXOR",
(getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits,
"Deliver Radiosity pass XOR",
(void *)SCE_PASS_RADIO},

View File

@@ -305,16 +305,16 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
} else if (BPy_Scene_Check(py_data)) {
/* scene */
Scene *sce = ((BPy_Scene *)py_data)->scene;
Scene *sceseq = ((BPy_Scene *)py_data)->scene;
seq->type= SEQ_SCENE;
seq->scene= sce;
seq->scene= sceseq;
/*seq->sfra= sce->r.sfra;*/
seq->len= sce->r.efra - sce->r.sfra + 1;
seq->len= sceseq->r.efra - sceseq->r.sfra + 1;
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
strncpy(seq->name + 2, sce->id.name + 2,
strncpy(seq->name + 2, sceseq->id.name + 2,
sizeof(seq->name) - 2);
strip->len= seq->len;
strip->us= 1;