style cleanup: python api
This commit is contained in:
@@ -56,16 +56,16 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
|
||||
static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
|
||||
|
||||
static PySequenceMethods Buffer_SeqMethods = {
|
||||
(lenfunc) Buffer_len, /*sq_length */
|
||||
(binaryfunc) NULL, /*sq_concat */
|
||||
(ssizeargfunc) NULL, /*sq_repeat */
|
||||
(ssizeargfunc) Buffer_item, /*sq_item */
|
||||
(ssizessizeargfunc) NULL, /*sq_slice, deprecated, handled in Buffer_item */
|
||||
(ssizeobjargproc) Buffer_ass_item, /*sq_ass_item */
|
||||
(ssizessizeobjargproc) NULL, /*sq_ass_slice, deprecated handled in Buffer_ass_item */
|
||||
(objobjproc) NULL, /* sq_contains */
|
||||
(binaryfunc) NULL, /* sq_inplace_concat */
|
||||
(ssizeargfunc) NULL, /* sq_inplace_repeat */
|
||||
(lenfunc) Buffer_len, /*sq_length */
|
||||
(binaryfunc) NULL, /*sq_concat */
|
||||
(ssizeargfunc) NULL, /*sq_repeat */
|
||||
(ssizeargfunc) Buffer_item, /*sq_item */
|
||||
(ssizessizeargfunc) NULL, /*sq_slice, deprecated, handled in Buffer_item */
|
||||
(ssizeobjargproc) Buffer_ass_item, /*sq_ass_item */
|
||||
(ssizessizeobjargproc) NULL, /*sq_ass_slice, deprecated handled in Buffer_ass_item */
|
||||
(objobjproc) NULL, /* sq_contains */
|
||||
(binaryfunc) NULL, /* sq_inplace_concat */
|
||||
(ssizeargfunc) NULL, /* sq_inplace_repeat */
|
||||
};
|
||||
|
||||
|
||||
@@ -125,13 +125,13 @@ static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
|
||||
|
||||
static PyMethodDef Buffer_methods[] = {
|
||||
{"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS,
|
||||
"return the buffer as a list"},
|
||||
"return the buffer as a list"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static PyGetSetDef Buffer_getseters[] = {
|
||||
{(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -144,11 +144,11 @@ PyTypeObject BGL_bufferType = {
|
||||
(printfunc)NULL, /*tp_print */
|
||||
NULL, /*tp_getattr */
|
||||
NULL, /*tp_setattr */
|
||||
NULL, /*tp_compare */
|
||||
(reprfunc) Buffer_repr, /*tp_repr */
|
||||
NULL, /*tp_as_number */
|
||||
&Buffer_SeqMethods, /*tp_as_sequence */
|
||||
&Buffer_AsMapping, /* PyMappingMethods *tp_as_mapping; */
|
||||
NULL, /*tp_compare */
|
||||
(reprfunc) Buffer_repr, /*tp_repr */
|
||||
NULL, /*tp_as_number */
|
||||
&Buffer_SeqMethods, /*tp_as_sequence */
|
||||
&Buffer_AsMapping, /* PyMappingMethods *tp_as_mapping; */
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
@@ -187,22 +187,22 @@ PyTypeObject BGL_bufferType = {
|
||||
Buffer_methods, /* struct PyMethodDef *tp_methods; */
|
||||
NULL, /* struct PyMemberDef *tp_members; */
|
||||
Buffer_getseters, /* struct PyGetSetDef *tp_getset; */
|
||||
NULL, /*tp_base*/
|
||||
NULL, /*tp_dict*/
|
||||
NULL, /*tp_descr_get*/
|
||||
NULL, /*tp_descr_set*/
|
||||
0, /*tp_dictoffset*/
|
||||
NULL, /*tp_init*/
|
||||
NULL, /*tp_alloc*/
|
||||
Buffer_new, /*tp_new*/
|
||||
NULL, /*tp_free*/
|
||||
NULL, /*tp_is_gc*/
|
||||
NULL, /*tp_bases*/
|
||||
NULL, /*tp_mro*/
|
||||
NULL, /*tp_cache*/
|
||||
NULL, /*tp_subclasses*/
|
||||
NULL, /*tp_weaklist*/
|
||||
NULL /*tp_del*/
|
||||
NULL, /*tp_base*/
|
||||
NULL, /*tp_dict*/
|
||||
NULL, /*tp_descr_get*/
|
||||
NULL, /*tp_descr_set*/
|
||||
0, /*tp_dictoffset*/
|
||||
NULL, /*tp_init*/
|
||||
NULL, /*tp_alloc*/
|
||||
Buffer_new, /*tp_new*/
|
||||
NULL, /*tp_free*/
|
||||
NULL, /*tp_is_gc*/
|
||||
NULL, /*tp_bases*/
|
||||
NULL, /*tp_mro*/
|
||||
NULL, /*tp_cache*/
|
||||
NULL, /*tp_subclasses*/
|
||||
NULL, /*tp_weaklist*/
|
||||
NULL /*tp_del*/
|
||||
};
|
||||
|
||||
#define BGL_Wrap(nargs, funcname, ret, arg_list) \
|
||||
@@ -286,7 +286,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf
|
||||
}
|
||||
|
||||
|
||||
#define MAX_DIMENSIONS 256
|
||||
#define MAX_DIMENSIONS 256
|
||||
static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject *length_ob = NULL, *init = NULL;
|
||||
@@ -428,7 +428,7 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
|
||||
list = PyList_New(end - begin);
|
||||
|
||||
for (count = begin; count < end; count++) {
|
||||
PyList_SET_ITEM(list, count-begin, Buffer_item(self, count));
|
||||
PyList_SET_ITEM(list, count - begin, Buffer_item(self, count));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -618,7 +618,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))
|
||||
@@ -700,7 +700,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))
|
||||
@@ -719,7 +719,7 @@ BGL_Wrap(3, GetMaterialiv, void, (GLenum, GLenum, GLintP))
|
||||
BGL_Wrap(2, GetPixelMapfv, void, (GLenum, GLfloatP))
|
||||
BGL_Wrap(2, GetPixelMapuiv, void, (GLenum, GLuintP))
|
||||
BGL_Wrap(2, GetPixelMapusv, void, (GLenum, GLushortP))
|
||||
BGL_Wrap(1, GetPolygonStipple,void, (GLubyteP))
|
||||
BGL_Wrap(1, GetPolygonStipple, void, (GLubyteP))
|
||||
BGL_Wrap(1, GetString, GLstring, (GLenum))
|
||||
BGL_Wrap(3, GetTexEnvfv, void, (GLenum, GLenum, GLfloatP))
|
||||
BGL_Wrap(3, GetTexEnviv, void, (GLenum, GLenum, GLintP))
|
||||
@@ -762,19 +762,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))
|
||||
@@ -794,7 +794,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))
|
||||
@@ -843,7 +843,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))
|
||||
@@ -906,9 +906,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))
|
||||
@@ -940,12 +940,12 @@ BGL_Wrap(1, Vertex4iv, void, (GLintP))
|
||||
BGL_Wrap(4, Vertex4s, void, (GLshort, GLshort, GLshort, GLshort))
|
||||
BGL_Wrap(1, Vertex4sv, void, (GLshortP))
|
||||
BGL_Wrap(4, Viewport, void, (GLint, GLint, GLsizei, GLsizei))
|
||||
BGLU_Wrap(4, Perspective, void, (GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(9, LookAt, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(4, Ortho2D, void, (GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(5, PickMatrix, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
|
||||
BGLU_Wrap(9, Project, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
|
||||
BGLU_Wrap(9, UnProject, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
|
||||
BGLU_Wrap(4, Perspective, void, (GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(9, LookAt, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(4, Ortho2D, void, (GLdouble, GLdouble, GLdouble, GLdouble))
|
||||
BGLU_Wrap(5, PickMatrix, void, (GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
|
||||
BGLU_Wrap(9, Project, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
|
||||
BGLU_Wrap(9, UnProject, GLint, (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
|
||||
|
||||
#undef MethodDef
|
||||
#define MethodDef(func) {"gl"#func, Method_##func, METH_VARARGS, "no string"}
|
||||
@@ -1302,7 +1302,7 @@ PyObject *BPyInit_bgl(void)
|
||||
dict = PyModule_GetDict(submodule);
|
||||
|
||||
if (PyType_Ready(&BGL_bufferType) < 0)
|
||||
return NULL; /* should never happen */
|
||||
return NULL; /* should never happen */
|
||||
|
||||
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
|
||||
Py_INCREF((PyObject *)&BGL_bufferType);
|
||||
|
@@ -47,7 +47,7 @@
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
/* UNUSED */
|
||||
/* UNUSED */
|
||||
#include "BKE_text.h" /* txt_to_buf */
|
||||
#include "BKE_main.h"
|
||||
|
||||
@@ -244,12 +244,12 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
|
||||
if (newmodule)
|
||||
return newmodule;
|
||||
|
||||
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
|
||||
PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
|
||||
|
||||
/* importing from existing modules failed, see if we have this module as blender text */
|
||||
newmodule = bpy_text_import_name(name, &found);
|
||||
|
||||
if (newmodule) {/* found module as blender text, ignore above exception */
|
||||
if (newmodule) { /* found module as blender text, ignore above exception */
|
||||
PyErr_Clear();
|
||||
Py_XDECREF(exception);
|
||||
Py_XDECREF(err);
|
||||
@@ -287,10 +287,10 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
|
||||
return newmodule;
|
||||
|
||||
/* no file, try importing from memory */
|
||||
PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
|
||||
PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
|
||||
|
||||
newmodule = bpy_text_reimport(module, &found);
|
||||
if (newmodule) {/* found module as blender text, ignore above exception */
|
||||
if (newmodule) { /* found module as blender text, ignore above exception */
|
||||
PyErr_Clear();
|
||||
Py_XDECREF(exception);
|
||||
Py_XDECREF(err);
|
||||
|
@@ -88,7 +88,7 @@ static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *
|
||||
group->id = id;
|
||||
group->prop = prop;
|
||||
group->parent = parent; /* can be NULL */
|
||||
return (PyObject*)group;
|
||||
return (PyObject *)group;
|
||||
}
|
||||
|
||||
static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
|
||||
@@ -96,7 +96,7 @@ static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
|
||||
BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
|
||||
array->id = id;
|
||||
array->prop = prop;
|
||||
return (PyObject*)array;
|
||||
return (PyObject *)array;
|
||||
}
|
||||
|
||||
static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
|
||||
@@ -178,7 +178,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
|
||||
}
|
||||
#else
|
||||
st = _PyUnicode_AsString(value);
|
||||
IDP_ResizeArray(prop, strlen(st)+1);
|
||||
IDP_ResizeArray(prop, strlen(st) + 1);
|
||||
strcpy(IDP_Array(prop), st);
|
||||
#endif
|
||||
|
||||
@@ -258,7 +258,7 @@ static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
|
||||
|
||||
static PyGetSetDef BPy_IDGroup_getseters[] = {
|
||||
{(char *)"name", (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName, (char *)"The name of this Group.", NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
{NULL, NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self)
|
||||
@@ -530,7 +530,7 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
|
||||
iter->mode = IDPROP_ITER_KEYS;
|
||||
iter->cur = self->prop->data.group.first;
|
||||
Py_XINCREF(iter);
|
||||
return (PyObject*)iter;
|
||||
return (PyObject *)iter;
|
||||
}
|
||||
|
||||
/* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
|
||||
@@ -679,7 +679,7 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
|
||||
iter->mode = IDPROP_ITER_ITEMS;
|
||||
iter->cur = self->prop->data.group.first;
|
||||
Py_XINCREF(iter);
|
||||
return (PyObject*)iter;
|
||||
return (PyObject *)iter;
|
||||
}
|
||||
|
||||
/* utility function */
|
||||
@@ -793,7 +793,7 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return IDP_GetPropertyFromGroup(self->prop, name) ? 1:0;
|
||||
return IDP_GetPropertyFromGroup(self->prop, name) ? 1 : 0;
|
||||
}
|
||||
|
||||
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
|
||||
@@ -845,64 +845,64 @@ static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
|
||||
|
||||
static struct PyMethodDef BPy_IDGroup_methods[] = {
|
||||
{"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O,
|
||||
"pop an item from the group; raises KeyError if the item doesn't exist"},
|
||||
"pop an item from the group; raises KeyError if the item doesn't exist"},
|
||||
{"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS,
|
||||
"iterate through the items in the dict; behaves like dictionary method iteritems"},
|
||||
"iterate through the items in the dict; behaves like dictionary method iteritems"},
|
||||
{"keys", (PyCFunction)BPy_IDGroup_GetKeys, METH_NOARGS,
|
||||
"get the keys associated with this group as a list of strings"},
|
||||
"get the keys associated with this group as a list of strings"},
|
||||
{"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS,
|
||||
"get the values associated with this group"},
|
||||
"get the values associated with this group"},
|
||||
{"items", (PyCFunction)BPy_IDGroup_GetItems, METH_NOARGS,
|
||||
"get the items associated with this group"},
|
||||
"get the items associated with this group"},
|
||||
{"update", (PyCFunction)BPy_IDGroup_Update, METH_O,
|
||||
"updates the values in the group with the values of another or a dict"},
|
||||
"updates the values in the group with the values of another or a dict"},
|
||||
{"get", (PyCFunction)BPy_IDGroup_Get, METH_VARARGS,
|
||||
"idprop.get(k[,d]) -> idprop[k] if k in idprop, else d. d defaults to None"},
|
||||
"idprop.get(k[,d]) -> idprop[k] if k in idprop, else d. d defaults to None"},
|
||||
{"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
|
||||
"return a purely python version of the group"},
|
||||
"return a purely python version of the group"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static PySequenceMethods BPy_IDGroup_Seq = {
|
||||
(lenfunc) BPy_IDGroup_Map_Len, /* lenfunc sq_length */
|
||||
NULL, /* binaryfunc sq_concat */
|
||||
NULL, /* ssizeargfunc sq_repeat */
|
||||
NULL, /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
|
||||
NULL, /* intintargfunc ***was_sq_slice*** */
|
||||
NULL, /* intobjargproc sq_ass_item */
|
||||
NULL, /* ssizeobjargproc ***was_sq_ass_slice*** */
|
||||
(objobjproc) BPy_IDGroup_Contains, /* objobjproc sq_contains */
|
||||
NULL, /* binaryfunc sq_inplace_concat */
|
||||
NULL, /* ssizeargfunc sq_inplace_repeat */
|
||||
(lenfunc) BPy_IDGroup_Map_Len, /* lenfunc sq_length */
|
||||
NULL, /* binaryfunc sq_concat */
|
||||
NULL, /* ssizeargfunc sq_repeat */
|
||||
NULL, /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
|
||||
NULL, /* intintargfunc ***was_sq_slice*** */
|
||||
NULL, /* intobjargproc sq_ass_item */
|
||||
NULL, /* ssizeobjargproc ***was_sq_ass_slice*** */
|
||||
(objobjproc) BPy_IDGroup_Contains, /* objobjproc sq_contains */
|
||||
NULL, /* binaryfunc sq_inplace_concat */
|
||||
NULL, /* ssizeargfunc sq_inplace_repeat */
|
||||
};
|
||||
|
||||
static PyMappingMethods BPy_IDGroup_Mapping = {
|
||||
(lenfunc)BPy_IDGroup_Map_Len, /*inquiry mp_length */
|
||||
(binaryfunc)BPy_IDGroup_Map_GetItem,/*binaryfunc mp_subscript */
|
||||
(objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
|
||||
(lenfunc)BPy_IDGroup_Map_Len, /*inquiry mp_length */
|
||||
(binaryfunc)BPy_IDGroup_Map_GetItem, /*binaryfunc mp_subscript */
|
||||
(objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
|
||||
};
|
||||
|
||||
PyTypeObject BPy_IDGroup_Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
/* For printing, in format "<module>.<name>" */
|
||||
"Blender IDProperty", /* char *tp_name; */
|
||||
sizeof(BPy_IDProperty), /* int tp_basicsize; */
|
||||
"Blender IDProperty", /* char *tp_name; */
|
||||
sizeof(BPy_IDProperty), /* int tp_basicsize; */
|
||||
0, /* tp_itemsize; For allocation */
|
||||
|
||||
/* Methods to implement standard operations */
|
||||
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* printfunc tp_print; */
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
NULL, /* cmpfunc tp_compare; */
|
||||
(reprfunc)BPy_IDGroup_repr, /* reprfunc tp_repr; */
|
||||
|
||||
/* Method suites for standard classes */
|
||||
|
||||
NULL, /* PyNumberMethods *tp_as_number; */
|
||||
&BPy_IDGroup_Seq, /* PySequenceMethods *tp_as_sequence; */
|
||||
&BPy_IDGroup_Mapping, /* PyMappingMethods *tp_as_mapping; */
|
||||
&BPy_IDGroup_Seq, /* PySequenceMethods *tp_as_sequence; */
|
||||
&BPy_IDGroup_Mapping, /* PyMappingMethods *tp_as_mapping; */
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
@@ -915,29 +915,29 @@ PyTypeObject BPy_IDGroup_Type = {
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
|
||||
|
||||
NULL, /* char *tp_doc; Documentation string */
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/* call function for all accessible objects */
|
||||
NULL, /* traverseproc tp_traverse; */
|
||||
|
||||
/* delete references to contained objects */
|
||||
NULL, /* inquiry tp_clear; */
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
|
||||
/*** Added in release 2.2 ***/
|
||||
/*** Added in release 2.2 ***/
|
||||
/* Iterators */
|
||||
(getiterfunc)BPy_IDGroup_iter, /* getiterfunc tp_iter; */
|
||||
NULL, /* iternextfunc tp_iternext; */
|
||||
/*** Attribute descriptor and subclassing stuff ***/
|
||||
/*** Attribute descriptor and subclassing stuff ***/
|
||||
BPy_IDGroup_methods, /* struct PyMethodDef *tp_methods; */
|
||||
NULL, /* struct PyMemberDef *tp_members; */
|
||||
BPy_IDGroup_getseters, /* struct PyGetSetDef *tp_getset; */
|
||||
@@ -984,7 +984,7 @@ static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
|
||||
}
|
||||
|
||||
static PyGetSetDef BPy_IDArray_getseters[] = {
|
||||
/* matches pythons array.typecode */
|
||||
/* matches pythons array.typecode */
|
||||
{(char *)"typecode", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an int.", NULL},
|
||||
{NULL, NULL, NULL, NULL, NULL},
|
||||
};
|
||||
@@ -996,7 +996,7 @@ static PyObject *BPy_IDArray_to_list(BPy_IDArray *self)
|
||||
|
||||
static PyMethodDef BPy_IDArray_methods[] = {
|
||||
{"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS,
|
||||
"return the array as a list"},
|
||||
"return the array as a list"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -1070,17 +1070,17 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
|
||||
}
|
||||
|
||||
static PySequenceMethods BPy_IDArray_Seq = {
|
||||
(lenfunc) BPy_IDArray_Len, /* inquiry sq_length */
|
||||
NULL, /* binaryfunc sq_concat */
|
||||
NULL, /* intargfunc sq_repeat */
|
||||
(ssizeargfunc)BPy_IDArray_GetItem, /* intargfunc sq_item */
|
||||
NULL, /* intintargfunc sq_slice */
|
||||
(ssizeobjargproc)BPy_IDArray_SetItem,/* intobjargproc sq_ass_item */
|
||||
NULL, /* intintobjargproc sq_ass_slice */
|
||||
NULL, /* objobjproc sq_contains */
|
||||
/* Added in release 2.0 */
|
||||
NULL, /* binaryfunc sq_inplace_concat */
|
||||
NULL, /* intargfunc sq_inplace_repeat */
|
||||
(lenfunc) BPy_IDArray_Len, /* inquiry sq_length */
|
||||
NULL, /* binaryfunc sq_concat */
|
||||
NULL, /* intargfunc sq_repeat */
|
||||
(ssizeargfunc)BPy_IDArray_GetItem, /* intargfunc sq_item */
|
||||
NULL, /* intintargfunc sq_slice */
|
||||
(ssizeobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */
|
||||
NULL, /* intintobjargproc sq_ass_slice */
|
||||
NULL, /* objobjproc sq_contains */
|
||||
/* Added in release 2.0 */
|
||||
NULL, /* binaryfunc sq_inplace_concat */
|
||||
NULL, /* intargfunc sq_inplace_repeat */
|
||||
};
|
||||
|
||||
|
||||
@@ -1241,7 +1241,7 @@ PyTypeObject BPy_IDArray_Type = {
|
||||
|
||||
/* Methods to implement standard operations */
|
||||
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* printfunc tp_print; */
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
@@ -1251,12 +1251,12 @@ PyTypeObject BPy_IDArray_Type = {
|
||||
/* Method suites for standard classes */
|
||||
|
||||
NULL, /* PyNumberMethods *tp_as_number; */
|
||||
&BPy_IDArray_Seq, /* PySequenceMethods *tp_as_sequence; */
|
||||
&BPy_IDArray_Seq, /* PySequenceMethods *tp_as_sequence; */
|
||||
&BPy_IDArray_AsMapping, /* PyMappingMethods *tp_as_mapping; */
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
@@ -1265,31 +1265,31 @@ PyTypeObject BPy_IDArray_Type = {
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
|
||||
|
||||
NULL, /* char *tp_doc; Documentation string */
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/* call function for all accessible objects */
|
||||
NULL, /* traverseproc tp_traverse; */
|
||||
|
||||
/* delete references to contained objects */
|
||||
NULL, /* inquiry tp_clear; */
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
|
||||
/*** Added in release 2.2 ***/
|
||||
/*** Added in release 2.2 ***/
|
||||
/* Iterators */
|
||||
NULL, /* getiterfunc tp_iter; */
|
||||
NULL, /* iternextfunc tp_iternext; */
|
||||
|
||||
/*** Attribute descriptor and subclassing stuff ***/
|
||||
BPy_IDArray_methods, /* struct PyMethodDef *tp_methods; */
|
||||
/*** Attribute descriptor and subclassing stuff ***/
|
||||
BPy_IDArray_methods, /* struct PyMethodDef *tp_methods; */
|
||||
NULL, /* struct PyMemberDef *tp_members; */
|
||||
BPy_IDArray_getseters, /* struct PyGetSetDef *tp_getset; */
|
||||
NULL, /* struct _typeobject *tp_base; */
|
||||
@@ -1355,7 +1355,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
|
||||
|
||||
/* Methods to implement standard operations */
|
||||
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* destructor tp_dealloc; */
|
||||
NULL, /* printfunc tp_print; */
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
@@ -1365,7 +1365,7 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
|
||||
/* Method suites for standard classes */
|
||||
|
||||
NULL, /* PyNumberMethods *tp_as_number; */
|
||||
NULL, /* PySequenceMethods *tp_as_sequence; */
|
||||
NULL, /* PySequenceMethods *tp_as_sequence; */
|
||||
NULL, /* PyMappingMethods *tp_as_mapping; */
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
@@ -1379,25 +1379,25 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
|
||||
|
||||
NULL, /* char *tp_doc; Documentation string */
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/* call function for all accessible objects */
|
||||
NULL, /* traverseproc tp_traverse; */
|
||||
|
||||
/* delete references to contained objects */
|
||||
NULL, /* inquiry tp_clear; */
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
|
||||
/*** Added in release 2.2 ***/
|
||||
/*** Added in release 2.2 ***/
|
||||
/* Iterators */
|
||||
PyObject_SelfIter, /* getiterfunc tp_iter; */
|
||||
(iternextfunc) BPy_Group_Iter_Next, /* iternextfunc tp_iternext; */
|
||||
|
@@ -156,8 +156,8 @@ void PyC_FileAndNum(const char **filename, int *lineno)
|
||||
{
|
||||
PyFrameObject *frame;
|
||||
|
||||
if (filename) *filename = NULL;
|
||||
if (lineno) *lineno = -1;
|
||||
if (filename) *filename = NULL;
|
||||
if (lineno) *lineno = -1;
|
||||
|
||||
if (!(frame = PyThreadState_GET()->frame)) {
|
||||
return;
|
||||
@@ -538,7 +538,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
|
||||
ret = PyObject_CallFunction(calcsize, (char *)"s", format);
|
||||
|
||||
if (ret) {
|
||||
sizes[i]= PyLong_AsSsize_t(ret);
|
||||
sizes[i] = PyLong_AsSsize_t(ret);
|
||||
Py_DECREF(ret);
|
||||
ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
|
||||
}
|
||||
@@ -551,7 +551,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
|
||||
PyList_SET_ITEM(values, i, Py_None); /* hold user */
|
||||
Py_INCREF(Py_None);
|
||||
|
||||
sizes[i]= 0;
|
||||
sizes[i] = 0;
|
||||
}
|
||||
else {
|
||||
if (PyTuple_GET_SIZE(ret) == 1) {
|
||||
|
Reference in New Issue
Block a user