diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-03-08 17:37:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-03-08 17:37:34 +0300 |
commit | 5eaf9f90c1acc1b337a3fee38887f5db2a46ac81 (patch) | |
tree | 6c2608c7d77487761dfeefc0caf15be68dd64b0b /source/blender/python/api2_2x/Mesh.c | |
parent | 51c16edabc18a13e91bee1a35cbe39eb1e911ea3 (diff) |
BPython API
added a function - GenericLib_assignData for assigning blender data, to assign an ipo to a camera or world to a scene for instance.
Using this function removed ~300 lines of code.
also fixes user count error in some places that didnt check.
also made it possible to clear the colorband by setting it to []
Diffstat (limited to 'source/blender/python/api2_2x/Mesh.c')
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index eb8f875fc34..963c1051662 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -7508,27 +7508,13 @@ static PyObject *Mesh_getTexMesh( BPy_Mesh * self ) Py_RETURN_NONE; } -static int Mesh_setTexMesh( BPy_Mesh * self, PyObject * arg ) -{ - - /*None or Mesh*/ - if ( arg != Py_None && !Mesh_CheckPyObject(arg) ) - return EXPP_ReturnIntError( PyExc_ValueError, - "texmesh must be a Mesh or None type" ); +static int Mesh_setTexMesh( BPy_Mesh * self, PyObject * value ) +{ + int ret = GenericLib_assignData(value, (void **) &self->mesh->texcomesh, 0, 1, ID_ME, 0); - /*remove existing texmesh*/ - if (self->mesh->texcomesh) { - self->mesh->texcomesh->id.us--; - self->mesh->texcomesh= NULL; - } + if (ret==0 && value!=Py_None) /*This must be a mesh type*/ + (( BPy_Mesh * ) value)->new= 0; - if (arg != Py_None) { /* its a mesh */ - BPy_Mesh *blen_obj = ( BPy_Mesh * ) arg; - /*This is a mesh so it needs to be added */ - self->mesh->texcomesh= blen_obj->mesh; - self->mesh->texcomesh->id.us++; - blen_obj->new= 0; - } return 0; } |