type initialization updates, and refcount fix for lamp, reverted some changes to NMesh
This commit is contained in:
@@ -1092,7 +1092,8 @@ PyObject *BGL_Init(void)
|
||||
PyObject *mod= Py_InitModule("Blender.BGL", BGL_methods);
|
||||
PyObject *dict= PyModule_GetDict(mod);
|
||||
|
||||
buffer_Type.ob_type = &PyType_Type;
|
||||
if( PyType_Ready( &buffer_Type) < 0)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
#define EXPP_ADDCONST(x) EXPP_dict_set_item_str(dict, #x, PyInt_FromLong(x))
|
||||
|
||||
|
||||
@@ -1813,7 +1813,8 @@ PyObject *Draw_Init( void )
|
||||
{
|
||||
PyObject *submodule, *dict;
|
||||
|
||||
Button_Type.ob_type = &PyType_Type;
|
||||
if( PyType_Ready( &Button_Type) < 0)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
submodule = Py_InitModule3( "Blender.Draw", Draw_methods, Draw_doc );
|
||||
|
||||
|
||||
@@ -833,6 +833,7 @@ PyObject *Lamp_CreatePyObject( Lamp * lamp )
|
||||
rgb[2] = &lamp->b;
|
||||
|
||||
pylamp->color = ( BPy_rgbTuple * ) rgbTuple_New( rgb );
|
||||
Py_INCREF(pylamp->color);
|
||||
|
||||
return ( PyObject * ) pylamp;
|
||||
}
|
||||
|
||||
@@ -242,10 +242,7 @@ PyObject *MTex_Init( void )
|
||||
|
||||
/* call PyType_Ready() to init dictionaries & such */
|
||||
if( PyType_Ready( &MTex_Type) < 0)
|
||||
return NULL;
|
||||
|
||||
/* So do we need this? */
|
||||
/* MTex_Type.ob_type = &PyType_Type;*/
|
||||
Py_RETURN_NONE;
|
||||
|
||||
submodule = Py_InitModule( "Blender.Texture.MTex", M_MTex_methods );
|
||||
|
||||
|
||||
@@ -121,6 +121,12 @@ PyObject *Mathutils_Init(void)
|
||||
/* needed for getseters */
|
||||
if( PyType_Ready( &vector_Type ) < 0 )
|
||||
return NULL;
|
||||
if( PyType_Ready( &matrix_Type ) < 0 )
|
||||
return NULL;
|
||||
if( PyType_Ready( &euler_Type ) < 0 )
|
||||
return NULL;
|
||||
if( PyType_Ready( &quaternion_Type ) < 0 )
|
||||
return NULL;
|
||||
|
||||
submodule = Py_InitModule3("Blender.Mathutils",
|
||||
M_Mathutils_methods, M_Mathutils_doc);
|
||||
|
||||
@@ -398,6 +398,11 @@ static int check_NMeshLists( BPy_NMesh *nmesh )
|
||||
/* Mesh Color Object */
|
||||
/*****************************/
|
||||
|
||||
static void NMCol_dealloc( PyObject * self )
|
||||
{
|
||||
PyObject_DEL( self );
|
||||
}
|
||||
|
||||
static BPy_NMCol *newcol( char r, char g, char b, char a )
|
||||
{
|
||||
BPy_NMCol *mc = ( BPy_NMCol * ) PyObject_NEW( BPy_NMCol, &NMCol_Type );
|
||||
@@ -476,7 +481,7 @@ PyTypeObject NMCol_Type = {
|
||||
sizeof( BPy_NMCol ), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
NULL, /* tp_dealloc */
|
||||
( destructor ) NMCol_dealloc, /* tp_dealloc */
|
||||
( printfunc ) 0, /* tp_print */
|
||||
( getattrfunc ) NMCol_getattr, /* tp_getattr */
|
||||
( setattrfunc ) NMCol_setattr, /* tp_setattr */
|
||||
@@ -832,6 +837,11 @@ static PyObject *M_NMesh_Vert( PyObject * self, PyObject * args )
|
||||
return ( PyObject * ) newvert( co );
|
||||
}
|
||||
|
||||
static void NMVert_dealloc( PyObject * self )
|
||||
{
|
||||
PyObject_DEL( self );
|
||||
}
|
||||
|
||||
static PyObject *NMVert_getattr( PyObject * self, char *name )
|
||||
{
|
||||
BPy_NMVert *mv = ( BPy_NMVert * ) self;
|
||||
@@ -983,7 +993,7 @@ PyTypeObject NMVert_Type = {
|
||||
sizeof( BPy_NMVert ), /*tp_basicsize */
|
||||
0, /*tp_itemsize */
|
||||
/* methods */
|
||||
NULL, /*tp_dealloc */
|
||||
( destructor ) NMVert_dealloc, /*tp_dealloc */
|
||||
( printfunc ) 0, /*tp_print */
|
||||
( getattrfunc ) NMVert_getattr, /*tp_getattr */
|
||||
( setattrfunc ) NMVert_setattr, /*tp_setattr */
|
||||
@@ -3347,6 +3357,11 @@ PyObject *NMesh_CreatePyObject( Mesh * me, Object * ob )
|
||||
return ( PyObject * ) nmesh;
|
||||
}
|
||||
|
||||
int NMesh_CheckPyObject( PyObject * pyobj )
|
||||
{
|
||||
return ( pyobj->ob_type == &NMesh_Type );
|
||||
}
|
||||
|
||||
Mesh *NMesh_FromPyObject( PyObject * pyobj, Object * ob )
|
||||
{
|
||||
if( pyobj->ob_type == &NMesh_Type ) {
|
||||
|
||||
@@ -362,7 +362,10 @@ PyObject *M_Particle_Get( PyObject * self, PyObject * args )
|
||||
PyObject *Particle_Init( void )
|
||||
{
|
||||
PyObject *submodule;
|
||||
Particle_Type.ob_type = &PyType_Type;
|
||||
|
||||
if( PyType_Ready( &Particle_Type) < 0)
|
||||
return NULL;
|
||||
|
||||
submodule =
|
||||
Py_InitModule3( "Blender.Particle", M_Particle_methods, M_Particle_doc );
|
||||
return ( submodule );
|
||||
|
||||
@@ -471,7 +471,6 @@ PyObject *newEulerObject(float *eul, int type)
|
||||
EulerObject *self;
|
||||
int x;
|
||||
|
||||
euler_Type.ob_type = &PyType_Type;
|
||||
self = PyObject_NEW(EulerObject, &euler_Type);
|
||||
self->data.blend_data = NULL;
|
||||
self->data.py_data = NULL;
|
||||
|
||||
@@ -906,7 +906,6 @@ PyObject *newMatrixObject(float *mat, int rowSize, int colSize, int type)
|
||||
"matrix(): row and column sizes must be between 2 and 4\n");
|
||||
}
|
||||
|
||||
matrix_Type.ob_type = &PyType_Type;
|
||||
self = PyObject_NEW(MatrixObject, &matrix_Type);
|
||||
self->data.blend_data = NULL;
|
||||
self->data.py_data = NULL;
|
||||
|
||||
@@ -638,7 +638,6 @@ PyObject *newQuaternionObject(float *quat, int type)
|
||||
QuaternionObject *self;
|
||||
int x;
|
||||
|
||||
quaternion_Type.ob_type = &PyType_Type;
|
||||
self = PyObject_NEW(QuaternionObject, &quaternion_Type);
|
||||
self->data.blend_data = NULL;
|
||||
self->data.py_data = NULL;
|
||||
|
||||
Reference in New Issue
Block a user