From 00a6a798999f1367dc7c6cde19b9af690c032e97 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 31 Jul 2006 12:57:46 +0000 Subject: [PATCH] added the texmesh to Mesh property to mesh. --- source/blender/python/api2_2x/Mesh.c | 39 +++++++++++++++++++++++ source/blender/python/api2_2x/doc/Mesh.py | 3 ++ 2 files changed, 42 insertions(+) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 83e9e214c27..264f561f304 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -6947,6 +6947,41 @@ static int Mesh_setActiveGroup( BPy_Mesh * self, PyObject * arg ) return 0; } + +static PyObject *Mesh_getTexMesh( BPy_Mesh * self ) +{ + Mesh *texme= self->mesh->texcomesh; + + if (texme) + return Mesh_CreatePyObject( texme, NULL ); + else + 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" ); + + /*remove existing texmesh*/ + if (self->mesh->texcomesh) { + self->mesh->texcomesh->id.us--; + self->mesh->texcomesh= NULL; + } + + 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; +} + static int Mesh_setSel( BPy_Mesh * self, PyObject * arg ) { int i; @@ -7088,6 +7123,10 @@ static PyGetSetDef BPy_Mesh_getseters[] = { (getter)Mesh_getActiveGroup, (setter)Mesh_setActiveGroup, "Active group for the mesh", NULL}, + {"texMesh", + (getter)Mesh_getTexMesh, (setter)Mesh_setTexMesh, + "The meshes tex mesh proxy texture coord mesh", + NULL}, {"sel", (getter)NULL, (setter)Mesh_setSel, "Select/deselect all verts, edges, faces in the mesh", diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 950aebd114d..4121a0ceb48 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -730,6 +730,9 @@ class Mesh: @ivar activeGroup: The mesh's active vertex group. The mesh must be linked to an object (read the comment in L{addVertGroup} for more info). @type activeGroup: string or None + @ivar texMesh: The mesh's texMesh setting, used so coordinates from another + mesh can be used for rendering textures. + @type texMesh: Mesh or None """ def getFromObject(name,cage=0):