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