Merged changes in the trunk up to revision 28911.

This commit is contained in:
Tamito Kajiyama
2010-05-21 22:01:47 +00:00
178 changed files with 7473 additions and 8152 deletions

View File

@@ -331,6 +331,11 @@ def rna2sphinx(BASEPATH):
fw(" * user interface functions for defining buttons, creation of menus, headers, panels\n")
fw(" * modules: bgl, mathutils and geometry\n")
fw("\n")
fw("===================\n")
fw("Application Modules\n")
fw("===================\n")
fw("\n")
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
fw(" bpy.ops.rst\n\n")
@@ -342,10 +347,31 @@ def rna2sphinx(BASEPATH):
# C modules
fw(" bpy.props.rst\n\n")
fw("==================\n")
fw("Standalone Modules\n")
fw("==================\n")
fw("\n")
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
fw(" mathutils.rst\n\n")
fw(" Freestyle.rst\n\n")
fw(" blf.rst\n\n")
# game engine
fw("===================\n")
fw("Game Engine Modules\n")
fw("===================\n")
fw("\n")
fw(".. toctree::\n")
fw(" :maxdepth: 1\n\n")
fw(" bge.types.rst\n\n")
fw(" bge.logic.rst\n\n")
fw(" bge.render.rst\n\n")
fw(" bge.events.rst\n\n")
file.close()
@@ -371,7 +397,6 @@ def rna2sphinx(BASEPATH):
file.close()
# python modules
from bpy import utils as module
pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)")
@@ -395,6 +420,15 @@ def rna2sphinx(BASEPATH):
pymodule2sphinx(BASEPATH, "blf", module, "Blender Font Drawing (blf)")
del module
# game engine
import shutil
# copy2 keeps time/date stamps
shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
if 0:
filepath = os.path.join(BASEPATH, "bpy.rst")
file = open(filepath, "w")

View File

@@ -64,13 +64,16 @@ static int Buffer_ass_slice( PyObject * self, int begin, int end,
PyObject * seq );
static PySequenceMethods Buffer_SeqMethods = {
( lenfunc ) Buffer_len, /*sq_length */
( binaryfunc ) 0, /*sq_concat */
( ssizeargfunc ) 0, /*sq_repeat */
( ssizeargfunc ) Buffer_item, /*sq_item */
( ssizessizeargfunc ) Buffer_slice, /*sq_slice */
( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */
( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice */
( lenfunc ) Buffer_len, /*sq_length */
( binaryfunc ) NULL, /*sq_concat */
( ssizeargfunc ) NULL, /*sq_repeat */
( ssizeargfunc ) Buffer_item, /*sq_item */
( ssizessizeargfunc ) Buffer_slice, /*sq_slice, deprecated TODO, replace */
( ssizeobjargproc ) Buffer_ass_item, /*sq_ass_item */
( ssizessizeobjargproc ) Buffer_ass_slice, /*sq_ass_slice, deprecated TODO, replace */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static void Buffer_dealloc( PyObject * self );

View File

@@ -290,7 +290,9 @@ static char py_blf_shadow_doc[] =
" :arg g: Shadow color (green channel 0.0 - 1.0).\n"
" :type g: float\n"
" :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
" :type b: float\n";
" :type b: float\n"
" :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
" :type a: float\n";
static PyObject *py_blf_shadow(PyObject *self, PyObject *args)
{
@@ -340,7 +342,7 @@ static char py_blf_load_doc[] =
" Load a new font.\n"
"\n"
" :arg filename: the filename of the font.\n"
" :type text: string\n"
" :type filename: string\n"
" :return: the new font's fontid or -1 if there was an error.\n"
" :rtype: integer\n";

View File

@@ -326,12 +326,15 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
//-----------------PROTCOL DECLARATIONS--------------------------
static PySequenceMethods Color_SeqMethods = {
(lenfunc) Color_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(binaryfunc) NULL, /* sq_concat */
(ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Color_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Color_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Color_AsMapping = {

View File

@@ -557,12 +557,15 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
//-----------------PROTCOL DECLARATIONS--------------------------
static PySequenceMethods Euler_SeqMethods = {
(lenfunc) Euler_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(binaryfunc) NULL, /* sq_concat */
(ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Euler_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Euler_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Euler_AsMapping = {

View File

@@ -1126,13 +1126,16 @@ static PyObject* Matrix_inv(MatrixObject *self)
/*-----------------PROTOCOL DECLARATIONS--------------------------*/
static PySequenceMethods Matrix_SeqMethods = {
(lenfunc) Matrix_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(ssizeargfunc) Matrix_item, /* sq_item */
(ssizessizeargfunc) Matrix_slice, /* sq_slice */
(ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice */
(lenfunc) Matrix_len, /* sq_length */
(binaryfunc) NULL, /* sq_concat */
(ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Matrix_item, /* sq_item */
(ssizessizeargfunc) Matrix_slice, /* sq_slice, deprecated TODO, replace */
(ssizeobjargproc) Matrix_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) Matrix_ass_slice, /* sq_ass_slice, deprecated TODO, replace */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};

View File

@@ -707,13 +707,16 @@ static PyObject *Quaternion_mul(PyObject * q1, PyObject * q2)
//-----------------PROTOCOL DECLARATIONS--------------------------
static PySequenceMethods Quaternion_SeqMethods = {
(lenfunc) Quaternion_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(ssizeargfunc) Quaternion_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
(lenfunc) Quaternion_len, /* sq_length */
(binaryfunc) NULL, /* sq_concat */
(ssizeargfunc) NULL, /* sq_repeat */
(ssizeargfunc) Quaternion_item, /* sq_item */
(ssizessizeargfunc) NULL, /* sq_slice, deprecated */
(ssizeobjargproc) Quaternion_ass_item, /* sq_ass_item */
(ssizessizeobjargproc) NULL, /* sq_ass_slice, deprecated */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Quaternion_AsMapping = {

View File

@@ -279,7 +279,7 @@ static char Vector_ToTrackQuat_doc[] =
" :type track: string\n"
" :arg up: Up axis in ['X', 'Y', 'Z'].\n"
" :type up: string\n"
" :return: rotation from the vector and the track and up axis."
" :return: rotation from the vector and the track and up axis.\n"
" :rtype: :class:`Quaternion`\n";
static PyObject *Vector_ToTrackQuat(VectorObject *self, PyObject *args )
@@ -1258,13 +1258,16 @@ static PyObject* Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
/*-----------------PROTCOL DECLARATIONS--------------------------*/
static PySequenceMethods Vector_SeqMethods = {
(lenfunc) Vector_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(ssizeargfunc) Vector_item, /* sq_item */
NULL, /* py3 deprecated slice func */
(ssizeobjargproc) Vector_ass_item, /* sq_ass_item */
NULL, /* py3 deprecated slice assign func */
(lenfunc) Vector_len, /* sq_length */
(binaryfunc) 0, /* sq_concat */
(ssizeargfunc) 0, /* sq_repeat */
(ssizeargfunc) Vector_item, /* sq_item */
NULL, /* py3 deprecated slice func */
(ssizeobjargproc) Vector_ass_item, /* sq_ass_item */
NULL, /* py3 deprecated slice assign func */
(objobjproc) NULL, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyObject *Vector_subscript(VectorObject* self, PyObject* item)

View File

@@ -46,6 +46,7 @@ static PyStructSequence_Field app_info_fields[] = {
{"home", "The blender home directory, normally matching $HOME"},
{"binary_path", "The location of blenders executable, useful for utilities that spawn new instances"},
{"debug", "Boolean, set when blender is running in debug mode (started with -d)"},
{"background", "Boolean, True when blender is running without a user interface (started with -b)"},
/* buildinfo */
{"build_date", "The date this blender instance was built"},
@@ -60,7 +61,7 @@ static PyStructSequence_Desc app_info_desc = {
"bpy.app", /* name */
"This module contains application values that remain unchanged during runtime.", /* doc */
app_info_fields, /* fields */
10
(sizeof(app_info_fields)/sizeof(PyStructSequence_Field)) - 1
};
static PyObject *make_app_info(void)
@@ -87,6 +88,7 @@ static PyObject *make_app_info(void)
SetStrItem(BLI_gethome());
SetStrItem(bprogname);
SetObjItem(PyBool_FromLong(G.f & G_DEBUG));
SetObjItem(PyBool_FromLong(G.background));
/* build info */
#ifdef BUILD_DATE

View File

@@ -109,7 +109,11 @@ static int bpy_pydriver_create_dict(void)
*/
void BPY_pydriver_update(void)
{
PyGILState_STATE gilstate = PyGILState_Ensure();
PyGILState_STATE gilstate;
int use_gil= 1; // (PyThreadState_Get()==NULL);
if(use_gil)
gilstate = PyGILState_Ensure();
if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */
PyDict_Clear(bpy_pydriver_Dict);
@@ -117,7 +121,8 @@ void BPY_pydriver_update(void)
bpy_pydriver_Dict = NULL;
}
PyGILState_Release(gilstate);
if(use_gil)
PyGILState_Release(gilstate);
return;
}
@@ -143,6 +148,10 @@ static float pydriver_error(ChannelDriver *driver)
/* This evals py driver expressions, 'expr' is a Python expression that
* should evaluate to a float number, which is returned.
*
* note: PyGILState_Ensure() isnt always called because python can call the
* bake operator which intern starts a thread which calls scene update which
* does a driver update. to avoid a deadlock check PyThreadState_Get() if PyGILState_Ensure() is needed.
*/
float BPY_pydriver_eval (ChannelDriver *driver)
{
@@ -151,6 +160,7 @@ float BPY_pydriver_eval (ChannelDriver *driver)
PyObject *expr_vars; /* speed up by pre-hashing string & avoids re-converting unicode strings for every execution */
PyObject *expr_code;
PyGILState_STATE gilstate;
int use_gil;
DriverVar *dvar;
double result = 0.0; /* default return */
@@ -168,13 +178,17 @@ float BPY_pydriver_eval (ChannelDriver *driver)
return 0.0f;
}
gilstate = PyGILState_Ensure();
use_gil= 1; //(PyThreadState_Get()==NULL);
if(use_gil)
gilstate = PyGILState_Ensure();
/* init global dictionary for py-driver evaluation settings */
if (!bpy_pydriver_Dict) {
if (bpy_pydriver_create_dict() != 0) {
fprintf(stderr, "Pydriver error: couldn't create Python dictionary");
PyGILState_Release(gilstate);
if(use_gil)
PyGILState_Release(gilstate);
return 0.0f;
}
}
@@ -269,7 +283,8 @@ float BPY_pydriver_eval (ChannelDriver *driver)
Py_DECREF(retval);
}
PyGILState_Release(gilstate);
if(use_gil)
PyGILState_Release(gilstate);
if(finite(result)) {
return (float)result;

View File

@@ -1194,17 +1194,17 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self )
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
PointerRNA newptr;
int len= RNA_property_collection_length(&self->ptr, self->prop);
int len= RNA_property_collection_length(&self->ptr, self->prop);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len) {
if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
return pyrna_struct_CreatePyObject(&newptr);
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
return NULL;
}
if(keynum >= 0 && keynum < len) {
if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr)) {
return pyrna_struct_CreatePyObject(&newptr);
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d could not be found", keynum);
return NULL;
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum);
return NULL;
}
@@ -1637,6 +1637,8 @@ static PySequenceMethods pyrna_prop_array_as_sequence = {
(ssizeobjargproc)prop_subscript_ass_array_int, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_prop_array_contains, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PySequenceMethods pyrna_prop_collection_as_sequence = {
@@ -1648,6 +1650,8 @@ static PySequenceMethods pyrna_prop_collection_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_prop_collection_contains, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PySequenceMethods pyrna_struct_as_sequence = {
@@ -1659,6 +1663,8 @@ static PySequenceMethods pyrna_struct_as_sequence = {
NULL, /* sq_ass_item */
NULL, /* *was* sq_ass_slice */
(objobjproc)pyrna_struct_contains, /* sq_contains */
(binaryfunc) NULL, /* sq_inplace_concat */
(ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyObject *pyrna_struct_subscript( BPy_StructRNA *self, PyObject *key )
@@ -1886,7 +1892,7 @@ static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *arg
char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
char *group_name= NULL;
char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
@@ -1920,7 +1926,7 @@ static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *arg
char *path_full= NULL;
int index= -1;
float cfra= FLT_MAX;
char *group_name= NULL;
char *group_name= NULL;
if(pyrna_struct_keyframe_parse(&self->ptr, args, kw, "s|ifs:bpy_struct.keyframe_delete()", "bpy_struct.keyframe_insert()", &path_full, &index, &cfra, &group_name) == -1)
return NULL;
@@ -3550,7 +3556,7 @@ PyTypeObject pyrna_prop_Type = {
0, /* tp_itemsize */
/* methods */
NULL, /* tp_dealloc */
NULL, /* printfunc tp_print; */
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */