Merged changes in the trunk up to revision 27752.

This commit is contained in:
2010-03-25 21:40:08 +00:00
557 changed files with 8005 additions and 8010 deletions

View File

@@ -67,11 +67,11 @@ extern "C" {
some_drawspace_pylist = PyList_New(0);
BPy_Set_DrawButtonsList(some_drawspace_pylist);
Also, BPy_Free_DrawButtonsList() must be called as necassary when a drawspace
with python callbacks is destroyed.
Also, BPy_Free_DrawButtonsList() must be called as necassary when a drawspace
with python callbacks is destroyed.
This is necassary to avoid blender buttons storing invalid pointers to freed
python data.*/
This is necassary to avoid blender buttons storing invalid pointers to freed
python data.*/
// void BPy_Set_DrawButtonsList(void *list);
// void BPy_Free_DrawButtonsList(void);
//

View File

@@ -295,7 +295,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args )
float v1[3], v2[3], v3[3];
if( !PyArg_ParseTuple
( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
( args, "O!O!O!", &vector_Type, &vec1, &vector_Type, &vec2
, &vector_Type, &vec3 ) ) {
PyErr_SetString( PyExc_TypeError, "expected 3 vector types\n");
return NULL;

View File

@@ -509,7 +509,7 @@ static PyObject *M_Mathutils_ShearMatrix(PyObject * self, PyObject * args)
}
if((strcmp(plane, "X") == 0)
&& matSize == 2) {
&& matSize == 2) {
mat[0] = 1.0f;
mat[2] = factor;
mat[3] = 1.0f;

View File

@@ -61,7 +61,7 @@ static PyObject *Buffer_item( PyObject * self, int i );
static PyObject *Buffer_slice( PyObject * self, int begin, int end );
static int Buffer_ass_item( PyObject * self, int i, PyObject * v );
static int Buffer_ass_slice( PyObject * self, int begin, int end,
PyObject * seq );
PyObject * seq );
static PySequenceMethods Buffer_SeqMethods = {
( lenfunc ) Buffer_len, /*sq_length */
@@ -430,7 +430,7 @@ BGL_Wrap(3, AreTexturesResident, GLboolean, (GLsizei, GLuintP, GLbooleanP))
BGL_Wrap(1, Begin, void, (GLenum))
BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
GLfloat, GLfloat, GLfloat, GLubyteP))
GLfloat, GLfloat, GLfloat, GLubyteP))
BGL_Wrap(2, BlendFunc, void, (GLenum, GLenum))
BGL_Wrap(1, CallList, void, (GLuint))
BGL_Wrap(3, CallLists, void, (GLsizei, GLenum, GLvoidP))
@@ -511,7 +511,7 @@ BGL_Wrap(2, Fogi, void, (GLenum, GLint))
BGL_Wrap(2, Fogiv, void, (GLenum, GLintP))
BGL_Wrap(1, FrontFace, void, (GLenum))
BGL_Wrap(6, Frustum, void, (GLdouble, GLdouble,
GLdouble, GLdouble, GLdouble, GLdouble))
GLdouble, GLdouble, GLdouble, GLdouble))
BGL_Wrap(1, GenLists, GLuint, (GLsizei))
BGL_Wrap(2, GenTextures, void, (GLsizei, GLuintP))
BGL_Wrap(2, GetBooleanv, void, (GLenum, GLbooleanP))
@@ -573,19 +573,19 @@ BGL_Wrap(1, LoadMatrixf, void, (GLfloatP))
BGL_Wrap(1, LoadName, void, (GLuint))
BGL_Wrap(1, LogicOp, void, (GLenum))
BGL_Wrap(6, Map1d, void, (GLenum, GLdouble, GLdouble,
GLint, GLint, GLdoubleP))
GLint, GLint, GLdoubleP))
BGL_Wrap(6, Map1f, void, (GLenum, GLfloat, GLfloat,
GLint, GLint, GLfloatP))
GLint, GLint, GLfloatP))
BGL_Wrap(10, Map2d, void, (GLenum, GLdouble, GLdouble,
GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
BGL_Wrap(10, Map2f, void, (GLenum, GLfloat, GLfloat,
GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
BGL_Wrap(3, MapGrid1d, void, (GLint, GLdouble, GLdouble))
BGL_Wrap(3, MapGrid1f, void, (GLint, GLfloat, GLfloat))
BGL_Wrap(6, MapGrid2d, void, (GLint, GLdouble, GLdouble,
GLint, GLdouble, GLdouble))
GLint, GLdouble, GLdouble))
BGL_Wrap(6, MapGrid2f, void, (GLint, GLfloat, GLfloat,
GLint, GLfloat, GLfloat))
GLint, GLfloat, GLfloat))
BGL_Wrap(3, Materialf, void, (GLenum, GLenum, GLfloat))
BGL_Wrap(3, Materialfv, void, (GLenum, GLenum, GLfloatP))
BGL_Wrap(3, Materiali, void, (GLenum, GLenum, GLint))
@@ -605,7 +605,7 @@ BGL_Wrap(1, Normal3iv, void, (GLintP))
BGL_Wrap(3, Normal3s, void, (GLshort, GLshort, GLshort))
BGL_Wrap(1, Normal3sv, void, (GLshortP))
BGL_Wrap(6, Ortho, void, (GLdouble, GLdouble,
GLdouble, GLdouble, GLdouble, GLdouble))
GLdouble, GLdouble, GLdouble, GLdouble))
BGL_Wrap(1, PassThrough, void, (GLfloat))
BGL_Wrap(3, PixelMapfv, void, (GLenum, GLint, GLfloatP))
BGL_Wrap(3, PixelMapuiv, void, (GLenum, GLint, GLuintP))
@@ -654,7 +654,7 @@ BGL_Wrap(4, RasterPos4s, void, (GLshort, GLshort, GLshort, GLshort))
BGL_Wrap(1, RasterPos4sv, void, (GLshortP))
BGL_Wrap(1, ReadBuffer, void, (GLenum))
BGL_Wrap(7, ReadPixels, void, (GLint, GLint, GLsizei,
GLsizei, GLenum, GLenum, GLvoidP))
GLsizei, GLenum, GLenum, GLvoidP))
BGL_Wrap(4, Rectd, void, (GLdouble, GLdouble, GLdouble, GLdouble))
BGL_Wrap(2, Rectdv, void, (GLdoubleP, GLdoubleP))
BGL_Wrap(4, Rectf, void, (GLfloat, GLfloat, GLfloat, GLfloat))
@@ -717,9 +717,9 @@ BGL_Wrap(3, TexGenfv, void, (GLenum, GLenum, GLfloatP))
BGL_Wrap(3, TexGeni, void, (GLenum, GLenum, GLint))
BGL_Wrap(3, TexGeniv, void, (GLenum, GLenum, GLintP))
BGL_Wrap(8, TexImage1D, void, (GLenum, GLint, GLint,
GLsizei, GLint, GLenum, GLenum, GLvoidP))
GLsizei, GLint, GLenum, GLenum, GLvoidP))
BGL_Wrap(9, TexImage2D, void, (GLenum, GLint, GLint,
GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
BGL_Wrap(3, TexParameterf, void, (GLenum, GLenum, GLfloat))
BGL_Wrap(3, TexParameterfv, void, (GLenum, GLenum, GLfloatP))
BGL_Wrap(3, TexParameteri, void, (GLenum, GLenum, GLint))

View File

@@ -186,7 +186,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k
static char *kwlist[] = {"name", "globals", "locals", "fromlist", "level", 0};
if( !PyArg_ParseTupleAndKeywords( args, kw, "s|OOOi:bpy_import_meth", kwlist,
&name, &globals, &locals, &fromlist, &dummy_val) )
&name, &globals, &locals, &fromlist, &dummy_val) )
return NULL;
/* import existing builtin modules or modules that have been imported alredy */

View File

@@ -443,7 +443,7 @@ static PyObject *Euler_slice(EulerObject * self, int begin, int end)
//----------------------------object[z:y]------------------------
//sequence slice (set)
static int Euler_ass_slice(EulerObject * self, int begin, int end,
PyObject * seq)
PyObject * seq)
{
int i, y, size = 0;
float eul[3];

View File

@@ -221,7 +221,7 @@ static PyObject *Matrix_toQuat(MatrixObject * self)
return NULL;
}
if(self->colSize == 3){
mat3_to_quat( quat,(float (*)[3])self->contigPtr);
mat3_to_quat( quat,(float (*)[3])self->contigPtr);
}else{
mat4_to_quat( quat,(float (*)[4])self->contigPtr);
}
@@ -1172,8 +1172,8 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item)
}
else {
PyErr_Format(PyExc_TypeError,
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
return NULL;
}
}
@@ -1203,8 +1203,8 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va
}
else {
PyErr_Format(PyExc_TypeError,
"matrix indices must be integers, not %.200s",
item->ob_type->tp_name);
"matrix indices must be integers, not %.200s",
item->ob_type->tp_name);
return -1;
}
}
@@ -1389,13 +1389,13 @@ PyTypeObject matrix_Type = {
/*------------------------newMatrixObject (internal)-------------
creates a new matrix object
self->matrix self->contiguous_ptr (reference to data.xxx)
[0]------------->[0]
[1]
[2]
[1]------------->[3]
[4]
[5]
....
[0]------------->[0]
[1]
[2]
[1]------------->[3]
[4]
[5]
....
self->matrix[1][1] = self->contigPtr[4] */
/*pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER

View File

@@ -183,7 +183,7 @@ static PyObject *Quaternion_Difference(QuaternionObject * self, QuaternionObject
tempQuat[3] = - self->quat[3];
dot = sqrt(tempQuat[0] * tempQuat[0] + tempQuat[1] * tempQuat[1] +
tempQuat[2] * tempQuat[2] + tempQuat[3] * tempQuat[3]);
tempQuat[2] * tempQuat[2] + tempQuat[3] * tempQuat[3]);
for(x = 0; x < 4; x++) {
tempQuat[x] /= (float)(dot * dot);
@@ -731,7 +731,7 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
PyErr_SetString(PyExc_AttributeError, "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");
return NULL;
}
if(size == 3){ //get angle in axis/angle
if(size == 3){ //get angle in axis/angle
n = PySequence_GetItem(args, 1);
if(n == NULL) { // parsed item not a number or getItem fail
PyErr_SetString(PyExc_TypeError, "Mathutils.Quaternion(): 4d numeric sequence expected or 3d vector and number\n");

View File

@@ -522,7 +522,7 @@ static char Vector_Angle_doc[] =
" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n";
static PyObject *Vector_Angle(VectorObject * self, VectorObject * value)
{
double dot = 0.0f, angleRads, test_v1 = 0.0f, test_v2 = 0.0f;
double dot = 0.0f, angleRads, test_v1 = 0.0f, test_v2 = 0.0f;
int x, size;
if (!VectorObject_Check(value)) {
@@ -797,7 +797,7 @@ static PyObject *Vector_slice(VectorObject * self, int begin, int end)
/*----------------------------object[z:y]------------------------
sequence slice (set) */
static int Vector_ass_slice(VectorObject * self, int begin, int end,
PyObject * seq)
PyObject * seq)
{
int i, y, size = 0;
float vec[4], scalar;
@@ -1321,8 +1321,8 @@ static PyObject *Vector_subscript(VectorObject* self, PyObject* item)
}
else {
PyErr_Format(PyExc_TypeError,
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
return NULL;
}
}
@@ -1352,8 +1352,8 @@ static int Vector_ass_subscript(VectorObject* self, PyObject* item, PyObject* va
}
else {
PyErr_Format(PyExc_TypeError,
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
"vector indices must be integers, not %.200s",
item->ob_type->tp_name);
return -1;
}
}
@@ -1515,11 +1515,11 @@ static PyObject *Vector_getSwizzle(VectorObject * self, void *closure)
/* Set the items of this vector using a swizzle.
- If value is a vector or list this operates like an array copy, except that
the destination is effectively re-ordered as defined by the swizzle. At
most min(len(source), len(dest)) values will be copied.
the destination is effectively re-ordered as defined by the swizzle. At
most min(len(source), len(dest)) values will be copied.
- If the value is scalar, it is copied to all axes listed in the swizzle.
- If an axis appears more than once in the swizzle, the final occurrence is
the one that determines its value.
the one that determines its value.
Returns 0 on success and -1 on failure. On failure, the vector will be
unchanged. */

View File

@@ -54,23 +54,23 @@ static char bpy_home_paths_doc[] =
PyObject *bpy_home_paths(PyObject *self, PyObject *args)
{
PyObject *ret= PyTuple_New(3);
char *path;
char *subfolder= "";
PyObject *ret= PyTuple_New(3);
char *path;
char *subfolder= "";
if (!PyArg_ParseTuple(args, "|s:blender_homes", &subfolder))
return NULL;
path= BLI_gethome_folder(subfolder, BLI_GETHOME_SYSTEM);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_SYSTEM);
PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_LOCAL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_LOCAL);
PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_USER);
PyTuple_SET_ITEM(ret, 2, PyUnicode_FromString(path?path:""));
path= BLI_gethome_folder(subfolder, BLI_GETHOME_USER);
PyTuple_SET_ITEM(ret, 2, PyUnicode_FromString(path?path:""));
return ret;
return ret;
}
static PyMethodDef meth_bpy_home_paths[] = {{ "home_paths", (PyCFunction)bpy_home_paths, METH_VARARGS, bpy_home_paths_doc}};

View File

@@ -34,15 +34,15 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *)
/*
arr[3][4][5]
0 1 2 <- dimension index
0 1 2 <- dimension index
*/
/*
arr[2] = x
py_to_array_index(arraydim=0, arrayoffset=0, index=2)
validate_array(lvalue_dim=0)
... make real index ...
validate_array(lvalue_dim=0)
... make real index ...
*/
/* arr[3]=x, self->arraydim is 0, lvalue_dim is 1 */

View File

@@ -271,11 +271,11 @@ float BPY_pydriver_eval (ChannelDriver *driver)
PyGILState_Release(gilstate);
if(finite(result)) {
return (float)result;
}
else {
fprintf(stderr, "\tBPY_pydriver_eval() - driver '%s' evaluates to '%f'\n", dvar->name, result);
return 0.0f;
}
if(finite(result)) {
return (float)result;
}
else {
fprintf(stderr, "\tBPY_pydriver_eval() - driver '%s' evaluates to '%f'\n", dvar->name, result);
return 0.0f;
}
}

View File

@@ -111,7 +111,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -177,7 +177,7 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -254,7 +254,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -321,7 +321,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -402,7 +402,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -477,7 +477,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -555,7 +555,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -667,7 +667,7 @@ PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -731,7 +731,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
}
if(!RNA_struct_is_a(srna, &RNA_IDPropertyGroup)) {
PyErr_Format(PyExc_SystemError, "%.200s expected an RNA type derived from IDPropertyGroup", error_prefix);
PyErr_Format(PyExc_SystemError, "%.200s expected an RNA type derived from IDPropertyGroup", error_prefix);
return NULL;
}
@@ -752,7 +752,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}
@@ -813,7 +813,7 @@ PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw)
StructRNA *srna;
if (PyTuple_GET_SIZE(args) > 0) {
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
PyErr_SetString(PyExc_ValueError, "all args must be keywords");
return NULL;
}

View File

@@ -1099,12 +1099,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);
if(keynum < 0) keynum += RNA_property_collection_length(&self->ptr, self->prop);
if(RNA_property_collection_lookup_int(&self->ptr, self->prop, keynum, &newptr))
return pyrna_struct_CreatePyObject(&newptr);
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;
}
PyErr_Format(PyExc_IndexError, "bpy_prop_collection[index]: index %d out of range", keynum);
return NULL;
}
@@ -2030,8 +2035,8 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
}
}
else if ((prop = RNA_struct_find_property(&self->ptr, name))) {
ret = pyrna_prop_to_py(&self->ptr, prop);
}
ret = pyrna_prop_to_py(&self->ptr, prop);
}
/* RNA function only if callback is declared (no optional functions) */
else if ((func = RNA_struct_find_function(&self->ptr, name)) && RNA_function_defined(func)) {
ret = pyrna_func_to_py((BPy_DummyPointerRNA *)self, func);
@@ -2971,7 +2976,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
RNA_parameter_list_create(&parms, self_ptr, self_func);
RNA_parameter_list_begin(&parms, &iter);
parms_len= RNA_parameter_list_size(&parms);
parms_len= RNA_parameter_list_arg_count(&parms);
ret_len= 0;
if(pyargs_len + pykw_len > parms_len) {
@@ -2999,7 +3004,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
parm_id= RNA_property_identifier(parm);
item= NULL;
if ((i < pyargs_len) && (flag & PROP_REQUIRED)) {
if (i < pyargs_len) {
item= PyTuple_GET_ITEM(args, i);
i++;
@@ -3044,7 +3049,6 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw)
RNA_parameter_list_end(&iter);
/* Check if we gave args that dont exist in the function
* printing the error is slow but it should only happen when developing.
* the if below is quick, checking if it passed less keyword args then we gave.
@@ -3903,19 +3907,19 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, int parent, const char *error_pr
}
if(py_srna==NULL) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, self of type '%.200s' had no bl_rna attribute, should never happen", error_prefix, Py_TYPE(self)->tp_name);
PyErr_Format(PyExc_SystemError, "%.200s internal error, self of type '%.200s' had no bl_rna attribute, should never happen", error_prefix, Py_TYPE(self)->tp_name);
return NULL;
}
if(!BPy_StructRNA_Check(py_srna)) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was of type '%.200s', instead of %.200s instance", error_prefix, Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
Py_DECREF(py_srna);
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was of type '%.200s', instead of %.200s instance", error_prefix, Py_TYPE(py_srna)->tp_name, pyrna_struct_Type.tp_name);
Py_DECREF(py_srna);
return NULL;
}
if(py_srna->ptr.type != &RNA_Struct) {
PyErr_Format(PyExc_SystemError, "%.200s internal error, bl_rna was not a RNA_Struct type of rna struct", error_prefix);
Py_DECREF(py_srna);
Py_DECREF(py_srna);
return NULL;
}
@@ -4441,12 +4445,12 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class)
PyObject *item;
const char *identifier= "";
if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")) {
PyErr_SetString(PyExc_AttributeError, "bpy.types.register(...): already registered as a subclass.");
return NULL;
}
}
/* warning: gets parent classes srna, only for the register function */
/* warning: gets parent classes srna, only for the register function */
srna= pyrna_struct_as_srna(py_class, 1, "bpy.types.register(...):");
if(srna==NULL)
return NULL;
@@ -4513,10 +4517,10 @@ PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
StructUnregisterFunc unreg;
StructRNA *srna;
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
return NULL;
}*/
}*/
srna= pyrna_struct_as_srna(py_class, 0, "bpy.types.unregister(...):");
if(srna==NULL)

View File

@@ -50,9 +50,9 @@ PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
/* Class type checking, use for checking classes can be added as operators, panels etc */
typedef struct BPY_class_attr_check {
const char *name; /* name of the class attribute */
char type; /* 's' = string, 'f' = function, 'l' = list, (add as needed) */
int arg_count; /* only for function types, -1 for undefined, includes self arg */
int len; /* only for string types currently */
char type; /* 's' = string, 'f' = function, 'l' = list, (add as needed) */
int arg_count; /* only for function types, -1 for undefined, includes self arg */
int len; /* only for string types currently */
int flag; /* other options */
} BPY_class_attr_check;