add missing files after merging
[blender.git] / source / gameengine / Ketsji / KX_VertexProxy.cpp
1 /*
2  * $Id$
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20  * All rights reserved.
21  *
22  * The Original Code is: all of this file.
23  *
24  * Contributor(s): none yet.
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 /** \file gameengine/Ketsji/KX_VertexProxy.cpp
30  *  \ingroup ketsji
31  */
32
33
34 #ifdef WITH_PYTHON
35
36 #include "KX_VertexProxy.h"
37 #include "KX_MeshProxy.h"
38 #include "RAS_TexVert.h"
39
40 #include "KX_PyMath.h"
41
42 PyTypeObject KX_VertexProxy::Type = {
43         PyVarObject_HEAD_INIT(NULL, 0)
44         "KX_VertexProxy",
45         sizeof(PyObjectPlus_Proxy),
46         0,
47         py_base_dealloc,
48         0,
49         0,
50         0,
51         0,
52         py_base_repr,
53         0,0,0,0,0,0,0,0,0,
54         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
55         0,0,0,0,0,0,0,
56         Methods,
57         0,
58         0,
59         &CValue::Type,
60         0,0,0,0,0,0,
61         py_base_new
62 };
63
64 PyMethodDef KX_VertexProxy::Methods[] = {
65 {"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
66 {"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
67 {"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV,METH_NOARGS},
68 {"setUV", (PyCFunction)KX_VertexProxy::sPySetUV,METH_O},
69
70 {"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
71 {"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
72
73 {"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
74 {"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
75 {"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
76 {"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
77   {NULL,NULL} //Sentinel
78 };
79
80 PyAttributeDef KX_VertexProxy::Attributes[] = {
81         KX_PYATTRIBUTE_RW_FUNCTION("x", KX_VertexProxy, pyattr_get_x, pyattr_set_x),
82         KX_PYATTRIBUTE_RW_FUNCTION("y", KX_VertexProxy, pyattr_get_y, pyattr_set_y),
83         KX_PYATTRIBUTE_RW_FUNCTION("z", KX_VertexProxy, pyattr_get_z, pyattr_set_z),
84
85         KX_PYATTRIBUTE_RW_FUNCTION("r", KX_VertexProxy, pyattr_get_r, pyattr_set_r),
86         KX_PYATTRIBUTE_RW_FUNCTION("g", KX_VertexProxy, pyattr_get_g, pyattr_set_g),
87         KX_PYATTRIBUTE_RW_FUNCTION("b", KX_VertexProxy, pyattr_get_b, pyattr_set_b),
88         KX_PYATTRIBUTE_RW_FUNCTION("a", KX_VertexProxy, pyattr_get_a, pyattr_set_a),
89
90         KX_PYATTRIBUTE_RW_FUNCTION("u", KX_VertexProxy, pyattr_get_u, pyattr_set_u),
91         KX_PYATTRIBUTE_RW_FUNCTION("v", KX_VertexProxy, pyattr_get_v, pyattr_set_v),
92
93         KX_PYATTRIBUTE_RW_FUNCTION("u2", KX_VertexProxy, pyattr_get_u2, pyattr_set_u2),
94         KX_PYATTRIBUTE_RW_FUNCTION("v2", KX_VertexProxy, pyattr_get_v2, pyattr_set_v2),
95
96         KX_PYATTRIBUTE_RW_FUNCTION("XYZ", KX_VertexProxy, pyattr_get_XYZ, pyattr_set_XYZ),
97         KX_PYATTRIBUTE_RW_FUNCTION("UV", KX_VertexProxy, pyattr_get_UV, pyattr_set_UV),
98
99         KX_PYATTRIBUTE_RW_FUNCTION("color", KX_VertexProxy, pyattr_get_color, pyattr_set_color),
100         KX_PYATTRIBUTE_RW_FUNCTION("normal", KX_VertexProxy, pyattr_get_normal, pyattr_set_normal),
101
102         { NULL }        //Sentinel
103 };
104
105 PyObject* KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
106 {
107         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
108         return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]);
109 }
110
111 PyObject* KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
112 {
113         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
114         return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]);
115 }
116
117 PyObject* KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
118 {
119         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
120         return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]);
121 }
122
123 PyObject* KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
124 {
125         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
126         return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0);
127 }
128
129 PyObject* KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
130 {
131         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
132         return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
133 }
134
135 PyObject* KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
136 {
137         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
138         return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0);
139 }
140
141 PyObject* KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
142 {
143         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
144         return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0);
145 }
146
147 PyObject* KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
148 {
149         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
150         return PyFloat_FromDouble(self->m_vertex->getUV1()[0]);
151 }
152
153 PyObject* KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
154 {
155         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
156         return PyFloat_FromDouble(self->m_vertex->getUV1()[1]);
157 }
158
159 PyObject* KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
160 {
161         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
162         return PyFloat_FromDouble(self->m_vertex->getUV2()[0]);
163 }
164
165 PyObject* KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
166 {
167         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
168         return PyFloat_FromDouble(self->m_vertex->getUV2()[1]);
169 }
170
171 PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
172 {
173         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
174         return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ()));
175 }
176
177 PyObject* KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
178 {
179         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
180         return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
181 }
182
183 PyObject* KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
184 {
185         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
186         const unsigned char *colp = self->m_vertex->getRGBA();
187         MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
188         color /= 255.0;
189         return PyObjectFrom(color);
190 }
191
192 PyObject* KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
193 {
194         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
195         return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal()));
196 }
197
198 int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
199 {
200         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
201         if (PyFloat_Check(value))
202         {
203                 float val = PyFloat_AsDouble(value);
204                 MT_Point3 pos(self->m_vertex->getXYZ());
205                 pos.x() = val;
206                 self->m_vertex->SetXYZ(pos);
207                 self->m_mesh->SetMeshModified(true);
208                 return PY_SET_ATTR_SUCCESS;
209         }
210         return PY_SET_ATTR_FAIL;
211 }
212
213 int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
214 {
215         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
216         if (PyFloat_Check(value))
217         {
218                 float val = PyFloat_AsDouble(value);
219                 MT_Point3 pos(self->m_vertex->getXYZ());
220                 pos.y() = val;
221                 self->m_vertex->SetXYZ(pos);
222                 self->m_mesh->SetMeshModified(true);
223                 return PY_SET_ATTR_SUCCESS;
224         }
225         return PY_SET_ATTR_FAIL;
226 }
227
228 int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
229 {
230         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
231         if (PyFloat_Check(value))
232         {
233                 float val = PyFloat_AsDouble(value);
234                 MT_Point3 pos(self->m_vertex->getXYZ());
235                 pos.z() = val;
236                 self->m_vertex->SetXYZ(pos);
237                 self->m_mesh->SetMeshModified(true);
238                 return PY_SET_ATTR_SUCCESS;
239         }
240         return PY_SET_ATTR_FAIL;
241 }
242
243 int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
244 {
245         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
246         if (PyFloat_Check(value))
247         {
248                 float val = PyFloat_AsDouble(value);
249                 MT_Point2 uv = self->m_vertex->getUV1();
250                 uv[0] = val;
251                 self->m_vertex->SetUV(uv);
252                 self->m_mesh->SetMeshModified(true);
253                 return PY_SET_ATTR_SUCCESS;
254         }
255         return PY_SET_ATTR_FAIL;
256 }
257
258 int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
259 {
260         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
261         if (PyFloat_Check(value))
262         {
263                 float val = PyFloat_AsDouble(value);
264                 MT_Point2 uv = self->m_vertex->getUV1();
265                 uv[1] = val;
266                 self->m_vertex->SetUV(uv);
267                 self->m_mesh->SetMeshModified(true);
268                 return PY_SET_ATTR_SUCCESS;
269         }
270         return PY_SET_ATTR_FAIL;
271 }
272
273 int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
274 {
275         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
276         if (PyFloat_Check(value))
277         {
278                 float val = PyFloat_AsDouble(value);
279                 MT_Point2 uv = self->m_vertex->getUV2();
280                 uv[0] = val;
281                 self->m_vertex->SetUV2(uv);
282                 self->m_mesh->SetMeshModified(true);
283                 return PY_SET_ATTR_SUCCESS;
284         }
285         return PY_SET_ATTR_FAIL;
286 }
287
288 int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
289 {
290         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
291         if (PyFloat_Check(value))
292         {
293                 float val = PyFloat_AsDouble(value);
294                 MT_Point2 uv = self->m_vertex->getUV2();
295                 uv[1] = val;
296                 self->m_vertex->SetUV2(uv);
297                 self->m_mesh->SetMeshModified(true);
298                 return PY_SET_ATTR_SUCCESS;
299         }
300         return PY_SET_ATTR_FAIL;
301 }
302
303 int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
304 {
305         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
306         if (PyFloat_Check(value))
307         {
308                 float val = PyFloat_AsDouble(value);
309                 unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
310                 unsigned char *cp = (unsigned char*) &icol;
311                 val *= 255.0;
312                 cp[0] = (unsigned char) val;
313                 self->m_vertex->SetRGBA(icol);
314                 self->m_mesh->SetMeshModified(true);
315                 return PY_SET_ATTR_SUCCESS;
316         }
317         return PY_SET_ATTR_FAIL;
318 }
319
320 int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
321 {
322         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
323         if (PyFloat_Check(value))
324         {
325                 float val = PyFloat_AsDouble(value);
326                 unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
327                 unsigned char *cp = (unsigned char*) &icol;
328                 val *= 255.0;
329                 cp[1] = (unsigned char) val;
330                 self->m_vertex->SetRGBA(icol);
331                 self->m_mesh->SetMeshModified(true);
332                 return PY_SET_ATTR_SUCCESS;
333         }
334         return PY_SET_ATTR_FAIL;
335 }
336
337 int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
338 {
339         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
340         if (PyFloat_Check(value))
341         {
342                 float val = PyFloat_AsDouble(value);
343                 unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
344                 unsigned char *cp = (unsigned char*) &icol;
345                 val *= 255.0;
346                 cp[2] = (unsigned char) val;
347                 self->m_vertex->SetRGBA(icol);
348                 self->m_mesh->SetMeshModified(true);
349                 return PY_SET_ATTR_SUCCESS;
350         }
351         return PY_SET_ATTR_FAIL;
352 }
353
354 int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
355 {
356         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
357         if (PyFloat_Check(value))
358         {
359                 float val = PyFloat_AsDouble(value);
360                 unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
361                 unsigned char *cp = (unsigned char*) &icol;
362                 val *= 255.0;
363                 cp[3] = (unsigned char) val;
364                 self->m_vertex->SetRGBA(icol);
365                 self->m_mesh->SetMeshModified(true);
366                 return PY_SET_ATTR_SUCCESS;
367         }
368         return PY_SET_ATTR_FAIL;
369 }
370
371 int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
372 {
373         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
374         if (PySequence_Check(value))
375         {
376                 MT_Point3 vec;
377                 if (PyVecTo(value, vec))
378                 {
379                         self->m_vertex->SetXYZ(vec);
380                         self->m_mesh->SetMeshModified(true);
381                         return PY_SET_ATTR_SUCCESS;
382                 }
383         }
384         return PY_SET_ATTR_FAIL;
385 }
386
387 int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
388 {
389         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
390         if (PySequence_Check(value))
391         {
392                 MT_Point2 vec;
393                 if (PyVecTo(value, vec))
394                 {
395                         self->m_vertex->SetUV(vec);
396                         self->m_mesh->SetMeshModified(true);
397                         return PY_SET_ATTR_SUCCESS;
398                 }
399         }
400         return PY_SET_ATTR_FAIL;
401 }
402
403 int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
404 {
405         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
406         if (PySequence_Check(value))
407         {
408                 MT_Vector4 vec;
409                 if (PyVecTo(value, vec))
410                 {
411                         self->m_vertex->SetRGBA(vec);
412                         self->m_mesh->SetMeshModified(true);
413                         return PY_SET_ATTR_SUCCESS;
414                 }
415         }
416         return PY_SET_ATTR_FAIL;
417 }
418
419 int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
420 {
421         KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
422         if (PySequence_Check(value))
423         {
424                 MT_Vector3 vec;
425                 if (PyVecTo(value, vec))
426                 {
427                         self->m_vertex->SetNormal(vec);
428                         self->m_mesh->SetMeshModified(true);
429                         return PY_SET_ATTR_SUCCESS;
430                 }
431         }
432         return PY_SET_ATTR_FAIL;
433 }
434
435 KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
436 :       m_vertex(vertex),
437         m_mesh(mesh)
438 {
439 }
440
441 KX_VertexProxy::~KX_VertexProxy()
442 {
443 }
444
445
446
447 // stuff for cvalue related things
448 CValue*         KX_VertexProxy::Calc(VALUE_OPERATOR, CValue *) { return NULL;}
449 CValue*         KX_VertexProxy::CalcFinal(VALUE_DATA_TYPE, VALUE_OPERATOR, CValue *) { return NULL;}
450 STR_String      sVertexName="vertex";
451 const STR_String &      KX_VertexProxy::GetText() {return sVertexName;};
452 double          KX_VertexProxy::GetNumber() { return -1;}
453 STR_String&     KX_VertexProxy::GetName() { return sVertexName;}
454 void            KX_VertexProxy::SetName(const char *) { };
455 CValue*         KX_VertexProxy::GetReplica() { return NULL;}
456
457 // stuff for python integration
458
459 PyObject* KX_VertexProxy::PyGetXYZ()
460 {
461         return PyObjectFrom(MT_Point3(m_vertex->getXYZ()));
462 }
463
464 PyObject* KX_VertexProxy::PySetXYZ(PyObject* value)
465 {
466         MT_Point3 vec;
467         if (!PyVecTo(value, vec))
468                 return NULL;
469
470         m_vertex->SetXYZ(vec);
471         m_mesh->SetMeshModified(true);
472         Py_RETURN_NONE;
473 }
474
475 PyObject* KX_VertexProxy::PyGetNormal()
476 {
477         return PyObjectFrom(MT_Vector3(m_vertex->getNormal()));
478 }
479
480 PyObject* KX_VertexProxy::PySetNormal(PyObject* value)
481 {
482         MT_Vector3 vec;
483         if (!PyVecTo(value, vec))
484                 return NULL;
485
486         m_vertex->SetNormal(vec);
487         m_mesh->SetMeshModified(true);
488         Py_RETURN_NONE;
489 }
490
491
492 PyObject* KX_VertexProxy::PyGetRGBA()
493 {
494         int *rgba = (int *) m_vertex->getRGBA();
495         return PyLong_FromSsize_t(*rgba);
496 }
497
498 PyObject* KX_VertexProxy::PySetRGBA(PyObject* value)
499 {
500         if PyLong_Check(value) {
501                 int rgba = PyLong_AsSsize_t(value);
502                 m_vertex->SetRGBA(rgba);
503                 m_mesh->SetMeshModified(true);
504                 Py_RETURN_NONE;
505         }
506         else {
507                 MT_Vector4 vec;
508                 if (PyVecTo(value, vec))
509                 {
510                         m_vertex->SetRGBA(vec);
511                         m_mesh->SetMeshModified(true);
512                         Py_RETURN_NONE;
513                 }
514         }
515
516         PyErr_SetString(PyExc_TypeError, "vert.setRGBA(value): KX_VertexProxy, expected a 4D vector or an int");
517         return NULL;
518 }
519
520
521 PyObject* KX_VertexProxy::PyGetUV()
522 {
523         return PyObjectFrom(MT_Vector2(m_vertex->getUV1()));
524 }
525
526 PyObject* KX_VertexProxy::PySetUV(PyObject* value)
527 {
528         MT_Point2 vec;
529         if (!PyVecTo(value, vec))
530                 return NULL;
531
532         m_vertex->SetUV(vec);
533         m_mesh->SetMeshModified(true);
534         Py_RETURN_NONE;
535 }
536
537 PyObject* KX_VertexProxy::PyGetUV2()
538 {
539         return PyObjectFrom(MT_Vector2(m_vertex->getUV2()));
540 }
541
542 PyObject* KX_VertexProxy::PySetUV2(PyObject* args)
543 {
544         MT_Point2 vec;
545         unsigned int unit= RAS_TexVert::SECOND_UV;
546
547         PyObject* list= NULL;
548         if(!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit))
549                 return NULL;
550
551         if (!PyVecTo(list, vec))
552                 return NULL;
553
554         m_vertex->SetFlag((m_vertex->getFlag()|RAS_TexVert::SECOND_UV));
555         m_vertex->SetUnit(unit);
556         m_vertex->SetUV2(vec);
557         m_mesh->SetMeshModified(true);
558         Py_RETURN_NONE;
559 }
560
561 #endif // WITH_PYTHON