diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-02-25 10:36:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-02-25 10:36:50 +0300 |
commit | 436e1697fdf07f5a17bcfbdde8b18e89e44e9cf1 (patch) | |
tree | 6e7695edfd05e95a01d4772f24afb84303a8ee0e /source/blender/python/api2_2x/Mesh.c | |
parent | e64b887fad611917916b2ce30bbcf2aa55593ea5 (diff) |
made attributes (name, property, users, fakeUser, lib) into functions all python types can use.
removed a lot of code duplication when moving to this.
Also removed unused functions GetMaterialByName(), same for Mesh, Object, World etc.
Diffstat (limited to 'source/blender/python/api2_2x/Mesh.c')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 98396a743ca..f971310711d 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -7159,60 +7159,6 @@ static int Mesh_setSubDivLevels( BPy_Mesh *self, PyObject *value ) return 0; } -static PyObject *Mesh_getName( BPy_Mesh * self ) -{ - PyObject *attr = PyString_FromString( self->mesh->id.name + 2 ); - - if( attr ) - return attr; - - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "couldn't get Mesh.name attribute" ); -} - -static int Mesh_setName( BPy_Mesh * self, PyObject * value ) -{ - char *name; - - name = PyString_AsString ( value ); - if( !name ) - return EXPP_ReturnIntError( PyExc_TypeError, - "expected string argument" ); - - rename_id( &self->mesh->id, name ); - - return 0; -} - -static PyObject *Mesh_getUsers( BPy_Mesh * self ) -{ - PyObject *attr = PyInt_FromLong( self->mesh->id.us ); - - if( attr ) - return attr; - - return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "couldn't get Mesh.users attribute" ); -} - -static PyObject *Mesh_getLib(BPy_Mesh *self) -{ - return EXPP_GetIdLib((ID *)self->mesh); -} - -static PyObject *Mesh_getFakeUser( BPy_Mesh * self ) -{ - if (self->mesh->id.flag & LIB_FAKEUSER) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -static int Mesh_setFakeUser( BPy_Mesh * self, PyObject * value ) -{ - return SetIdFakeUser(&self->mesh->id, value); -} - static PyObject *Mesh_getFlag( BPy_Mesh * self, void *type ) { PyObject *attr; @@ -7589,19 +7535,11 @@ static PyObject *Mesh_repr( BPy_Mesh * self ) self->mesh->id.name + 2 ); } -static PyObject *Mesh_getProperties( BPy_Mesh * self ) -{ - /*sanity check, we set parent property type to Group here*/ - return BPy_Wrap_IDProperty( (ID*)self->mesh, IDP_GetProperties((ID*)self->mesh, 1), NULL ); -} - /*****************************************************************************/ /* Python Mesh_Type attributes get/set structure: */ /*****************************************************************************/ static PyGetSetDef BPy_Mesh_getseters[] = { - {"properties", - (getter)Mesh_getProperties, NULL, - "get the ID properties associated with this mesh"}, + GENERIC_LIB_GETSETATTR, {"verts", (getter)Mesh_getVerts, (setter)Mesh_setVerts, "The mesh's vertices (MVert)", @@ -7630,10 +7568,6 @@ static PyGetSetDef BPy_Mesh_getseters[] = { (getter)Mesh_getSubDivLevels, (setter)Mesh_setSubDivLevels, "The display and rendering subdivision levels", NULL}, - {"name", - (getter)Mesh_getName, (setter)Mesh_setName, - "The mesh's data name", - NULL}, {"mode", (getter)Mesh_getMode, (setter)Mesh_setMode, "The mesh's mode bitfield", @@ -7662,18 +7596,6 @@ static PyGetSetDef BPy_Mesh_getseters[] = { (getter)Mesh_getActiveFace, (setter)Mesh_setActiveFace, "Index of the mesh's active texture face (in UV editor)", NULL}, - {"users", - (getter)Mesh_getUsers, (setter)NULL, - "Number of users of the mesh", - NULL}, - {"lib", - (getter)Mesh_getLib, (setter)NULL, - "Meshes external library", - NULL}, - {"fakeUser", - (getter)Mesh_getFakeUser, (setter)Mesh_setFakeUser, - "The fake user status of this mesh", - NULL}, {"activeGroup", (getter)Mesh_getActiveGroup, (setter)Mesh_setActiveGroup, "Active group for the mesh", |