Blender  V2.59
KX_MeshProxy.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_MeshProxy.h 35063 2011-02-22 10:33:14Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00034 #ifndef __KX_MESHPROXY
00035 #define __KX_MESHPROXY
00036 
00037 #ifdef WITH_PYTHON
00038 
00039 #include "SCA_IObject.h"
00040 
00041 /* utility conversion function */
00042 bool ConvertPythonToMesh(PyObject * value, class RAS_MeshObject **object, bool py_none_ok, const char *error_prefix);
00043 
00044 class KX_MeshProxy      : public CValue
00045 {
00046         Py_Header;
00047 
00048         class RAS_MeshObject*   m_meshobj;
00049 public:
00050         KX_MeshProxy(class RAS_MeshObject* mesh);
00051         virtual ~KX_MeshProxy();
00052 
00053         void SetMeshModified(bool v);
00054 
00055         // stuff for cvalue related things
00056         virtual CValue*         Calc(VALUE_OPERATOR op, CValue *val) ;
00057         virtual CValue*         CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
00058         virtual const STR_String &      GetText();
00059         virtual double          GetNumber();
00060         virtual RAS_MeshObject* GetMesh() { return m_meshobj; }
00061         virtual STR_String&     GetName();
00062         virtual void            SetName(const char *name);                                                              // Set the name of the value
00063         virtual CValue*         GetReplica();
00064 
00065 // stuff for python integration
00066 
00067         KX_PYMETHOD(KX_MeshProxy,GetNumMaterials);      // Deprecated
00068         KX_PYMETHOD(KX_MeshProxy,GetMaterialName);
00069         KX_PYMETHOD(KX_MeshProxy,GetTextureName);
00070         KX_PYMETHOD_NOARGS(KX_MeshProxy,GetNumPolygons); // Deprecated
00071         
00072         // both take materialid (int)
00073         KX_PYMETHOD(KX_MeshProxy,GetVertexArrayLength);
00074         KX_PYMETHOD(KX_MeshProxy,GetVertex);
00075         KX_PYMETHOD(KX_MeshProxy,GetPolygon);
00076         
00077         static PyObject*        pyattr_get_materials(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
00078         static PyObject * pyattr_get_numMaterials(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
00079         static PyObject * pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
00080 };
00081 
00082 #endif // WITH_PYTHON
00083 
00084 #endif //__KX_MESHPROXY
00085