=== Blender Python API ===

After some discussion with Campbell, changed the way cstruct sizeof is fetched.

Moved DataSize() to Blender.Types.CSizeof(Blendertype). Supported types return sizeof(data struct), otherwise -1.

To quickly check what types are supported:

import Blender.Types as bt
x = dir(bt)
for t in x:
	if t[0] != '_':
		s = 'bt.CSizeof(bt.' + t + ')'
		print t,"=", eval(s)
This commit is contained in:
Nathan Letwory
2008-10-20 12:33:31 +00:00
parent 25859cf1f7
commit 47345cfd78
5 changed files with 126 additions and 79 deletions

View File

@@ -207,7 +207,6 @@
static PyObject *M_Material_New( PyObject * self, PyObject * args,
PyObject * keywords );
static PyObject *M_Material_Get( PyObject * self, PyObject * args );
static PyObject *M_Material_DataSize(PyObject *unused);
/*****************************************************************************/
/* The following string definitions are used for documentation strings. In */
@@ -232,8 +231,6 @@ struct PyMethodDef M_Material_methods[] = {
M_Material_New_doc},
{"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
{"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
{"DataSize", ( PyCFunction ) M_Material_DataSize, METH_NOARGS,
"Get sizeof() of Material"},
{NULL, NULL, 0, NULL}
};
@@ -338,12 +335,6 @@ static PyObject *M_Material_Get( PyObject * self, PyObject * args )
}
}
static PyObject *M_Material_DataSize(PyObject *unused)
{
return PyInt_FromLong(sizeof(Material));
}
static PyObject *Material_ModesDict( void )
{
PyObject *Modes = PyConstant_New( );