2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
2011-02-25 13:35:59 +00:00
|
|
|
/** \file gameengine/Ketsji/KX_VertexProxy.cpp
|
|
|
|
* \ingroup ketsji
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2009-09-29 21:42:40 +00:00
|
|
|
|
2004-07-17 05:28:23 +00:00
|
|
|
#include "KX_VertexProxy.h"
|
|
|
|
#include "KX_MeshProxy.h"
|
|
|
|
#include "RAS_TexVert.h"
|
|
|
|
|
2004-05-30 11:09:46 +00:00
|
|
|
#include "KX_PyMath.h"
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
PyTypeObject KX_VertexProxy::Type = {
|
2009-06-08 20:08:19 +00:00
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
2002-10-12 11:37:38 +00:00
|
|
|
"KX_VertexProxy",
|
2009-04-20 15:06:46 +00:00
|
|
|
sizeof(PyObjectPlus_Proxy),
|
2002-10-12 11:37:38 +00:00
|
|
|
0,
|
2009-04-20 15:06:46 +00:00
|
|
|
py_base_dealloc,
|
2002-10-12 11:37:38 +00:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2009-04-20 15:06:46 +00:00
|
|
|
py_base_repr,
|
2009-06-29 12:06:46 +00:00
|
|
|
0,0,0,0,0,0,0,0,0,
|
2009-06-28 11:22:26 +00:00
|
|
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|
|
|
0,0,0,0,0,0,0,
|
|
|
|
Methods,
|
|
|
|
0,
|
|
|
|
0,
|
2009-06-29 12:06:46 +00:00
|
|
|
&CValue::Type,
|
|
|
|
0,0,0,0,0,0,
|
|
|
|
py_base_new
|
2002-10-12 11:37:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
PyMethodDef KX_VertexProxy::Methods[] = {
|
2012-11-10 05:42:50 +00:00
|
|
|
{"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
|
|
|
|
{"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
|
2012-11-10 10:26:39 +00:00
|
|
|
{"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV1, METH_NOARGS},
|
|
|
|
{"setUV", (PyCFunction)KX_VertexProxy::sPySetUV1, METH_O},
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2012-11-10 05:42:50 +00:00
|
|
|
{"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
|
|
|
|
{"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2012-11-10 05:42:50 +00:00
|
|
|
{"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
|
|
|
|
{"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
|
|
|
|
{"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
|
|
|
|
{"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
|
|
|
|
{NULL,NULL} //Sentinel
|
2002-10-12 11:37:38 +00:00
|
|
|
};
|
|
|
|
|
2009-02-26 09:04:06 +00:00
|
|
|
PyAttributeDef KX_VertexProxy::Attributes[] = {
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("x", KX_VertexProxy, pyattr_get_x, pyattr_set_x),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("y", KX_VertexProxy, pyattr_get_y, pyattr_set_y),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("z", KX_VertexProxy, pyattr_get_z, pyattr_set_z),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("r", KX_VertexProxy, pyattr_get_r, pyattr_set_r),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("g", KX_VertexProxy, pyattr_get_g, pyattr_set_g),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("b", KX_VertexProxy, pyattr_get_b, pyattr_set_b),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("a", KX_VertexProxy, pyattr_get_a, pyattr_set_a),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("u", KX_VertexProxy, pyattr_get_u, pyattr_set_u),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("v", KX_VertexProxy, pyattr_get_v, pyattr_set_v),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("u2", KX_VertexProxy, pyattr_get_u2, pyattr_set_u2),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("v2", KX_VertexProxy, pyattr_get_v2, pyattr_set_v2),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("XYZ", KX_VertexProxy, pyattr_get_XYZ, pyattr_set_XYZ),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("UV", KX_VertexProxy, pyattr_get_UV, pyattr_set_UV),
|
2012-12-18 20:56:25 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("uvs", KX_VertexProxy, pyattr_get_uvs, pyattr_set_uvs),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("color", KX_VertexProxy, pyattr_get_color, pyattr_set_color),
|
|
|
|
KX_PYATTRIBUTE_RW_FUNCTION("normal", KX_VertexProxy, pyattr_get_normal, pyattr_set_normal),
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2009-02-26 09:04:06 +00:00
|
|
|
{ NULL } //Sentinel
|
|
|
|
};
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]);
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]);
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]);
|
2009-06-08 20:08:19 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0);
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0);
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0);
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getUV(0)[0]);
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getUV(0)[1]);
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getUV(1)[0]);
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyFloat_FromDouble(self->m_vertex->getUV(1)[1]);
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ()));
|
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyObjectFrom(MT_Point2(self->m_vertex->getUV(0)));
|
|
|
|
}
|
|
|
|
|
|
|
|
PyObject *KX_VertexProxy::pyattr_get_uvs(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
|
|
|
{
|
|
|
|
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
|
|
|
|
|
|
|
|
PyObject* uvlist = PyList_New(RAS_TexVert::MAX_UNIT);
|
|
|
|
for (int i=0; i<RAS_TexVert::MAX_UNIT; ++i)
|
|
|
|
{
|
|
|
|
PyList_SET_ITEM(uvlist, i, PyObjectFrom(MT_Point2(self->m_vertex->getUV(i))));
|
|
|
|
}
|
|
|
|
|
|
|
|
return uvlist;
|
2010-08-16 12:14:09 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
const unsigned char *colp = self->m_vertex->getRGBA();
|
|
|
|
MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
|
|
|
|
color /= 255.0;
|
|
|
|
return PyObjectFrom(color);
|
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
2010-08-16 12:14:09 +00:00
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal()));
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
MT_Point3 pos(self->m_vertex->getXYZ());
|
2004-05-30 11:09:46 +00:00
|
|
|
pos.x() = val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetXYZ(pos);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
MT_Point3 pos(self->m_vertex->getXYZ());
|
2004-05-30 11:09:46 +00:00
|
|
|
pos.y() = val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetXYZ(pos);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
MT_Point3 pos(self->m_vertex->getXYZ());
|
2004-05-30 11:09:46 +00:00
|
|
|
pos.z() = val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetXYZ(pos);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
2012-12-18 20:56:25 +00:00
|
|
|
MT_Point2 uv = self->m_vertex->getUV(0);
|
2004-05-30 11:09:46 +00:00
|
|
|
uv[0] = val;
|
2012-12-18 20:56:25 +00:00
|
|
|
self->m_vertex->SetUV(0, uv);
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
2012-12-18 20:56:25 +00:00
|
|
|
MT_Point2 uv = self->m_vertex->getUV(0);
|
2004-05-30 11:09:46 +00:00
|
|
|
uv[1] = val;
|
2012-12-18 20:56:25 +00:00
|
|
|
self->m_vertex->SetUV(0, uv);
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2006-01-06 03:46:54 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
2012-12-18 20:56:25 +00:00
|
|
|
MT_Point2 uv = self->m_vertex->getUV(1);
|
2006-01-06 03:46:54 +00:00
|
|
|
uv[0] = val;
|
2012-12-18 20:56:25 +00:00
|
|
|
self->m_vertex->SetUV(1, uv);
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2006-01-06 03:46:54 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2006-01-06 03:46:54 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
2012-12-18 20:56:25 +00:00
|
|
|
MT_Point2 uv = self->m_vertex->getUV(1);
|
2006-01-06 03:46:54 +00:00
|
|
|
uv[1] = val;
|
2012-12-18 20:56:25 +00:00
|
|
|
self->m_vertex->SetUV(1, uv);
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2006-01-06 03:46:54 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
|
|
|
|
unsigned char *cp = (unsigned char*) &icol;
|
|
|
|
val *= 255.0;
|
2004-05-30 11:09:46 +00:00
|
|
|
cp[0] = (unsigned char) val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetRGBA(icol);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
|
|
|
|
unsigned char *cp = (unsigned char*) &icol;
|
|
|
|
val *= 255.0;
|
2004-05-30 11:09:46 +00:00
|
|
|
cp[1] = (unsigned char) val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetRGBA(icol);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
|
|
|
|
unsigned char *cp = (unsigned char*) &icol;
|
|
|
|
val *= 255.0;
|
2004-05-30 11:09:46 +00:00
|
|
|
cp[2] = (unsigned char) val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetRGBA(icol);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PyFloat_Check(value))
|
2004-05-30 11:09:46 +00:00
|
|
|
{
|
2010-08-16 12:14:09 +00:00
|
|
|
float val = PyFloat_AsDouble(value);
|
|
|
|
unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
|
|
|
|
unsigned char *cp = (unsigned char*) &icol;
|
|
|
|
val *= 255.0;
|
2004-05-30 11:09:46 +00:00
|
|
|
cp[3] = (unsigned char) val;
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_vertex->SetRGBA(icol);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
2009-04-20 15:06:46 +00:00
|
|
|
return PY_SET_ATTR_SUCCESS;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2010-08-16 12:14:09 +00:00
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PySequence_Check(value))
|
|
|
|
{
|
|
|
|
MT_Point3 vec;
|
|
|
|
if (PyVecTo(value, vec))
|
|
|
|
{
|
|
|
|
self->m_vertex->SetXYZ(vec);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PySequence_Check(value))
|
|
|
|
{
|
|
|
|
MT_Point2 vec;
|
2012-11-10 10:26:39 +00:00
|
|
|
if (PyVecTo(value, vec)) {
|
2012-12-18 20:56:25 +00:00
|
|
|
self->m_vertex->SetUV(0, vec);
|
2010-08-16 12:14:09 +00:00
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
2012-12-18 20:56:25 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_uvs(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
|
|
|
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
|
|
|
|
if (PySequence_Check(value))
|
|
|
|
{
|
|
|
|
MT_Point2 vec;
|
|
|
|
for (int i=0; i<PySequence_Size(value) && i<RAS_TexVert::MAX_UNIT; ++i)
|
|
|
|
{
|
|
|
|
if (PyVecTo(PySequence_GetItem(value, i), vec))
|
|
|
|
{
|
|
|
|
self->m_vertex->SetUV(i, vec);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PyErr_SetString(PyExc_AttributeError, STR_String().Format("list[%d] was not a vector", i).ReadPtr());
|
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
|
|
|
}
|
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
2010-08-16 12:14:09 +00:00
|
|
|
int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PySequence_Check(value))
|
|
|
|
{
|
|
|
|
MT_Vector4 vec;
|
|
|
|
if (PyVecTo(value, vec))
|
|
|
|
{
|
|
|
|
self->m_vertex->SetRGBA(vec);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PY_SET_ATTR_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
KX_VertexProxy* self = static_cast<KX_VertexProxy*>(self_v);
|
2010-08-16 12:14:09 +00:00
|
|
|
if (PySequence_Check(value))
|
|
|
|
{
|
|
|
|
MT_Vector3 vec;
|
|
|
|
if (PyVecTo(value, vec))
|
|
|
|
{
|
|
|
|
self->m_vertex->SetNormal(vec);
|
|
|
|
self->m_mesh->SetMeshModified(true);
|
|
|
|
return PY_SET_ATTR_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PY_SET_ATTR_FAIL;
|
2004-05-30 11:09:46 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-04-02 21:04:20 +00:00
|
|
|
KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
|
|
|
|
: m_vertex(vertex),
|
|
|
|
m_mesh(mesh)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2011-10-06 16:07:05 +00:00
|
|
|
/* see bug [#27071] */
|
|
|
|
Py_INCREF(m_mesh->GetProxy());
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KX_VertexProxy::~KX_VertexProxy()
|
|
|
|
{
|
2011-10-06 16:07:05 +00:00
|
|
|
/* see bug [#27071] */
|
|
|
|
Py_DECREF(m_mesh->GetProxy());
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// stuff for cvalue related things
|
2004-07-17 05:28:23 +00:00
|
|
|
CValue* KX_VertexProxy::Calc(VALUE_OPERATOR, CValue *) { return NULL;}
|
2009-06-28 11:22:26 +00:00
|
|
|
CValue* KX_VertexProxy::CalcFinal(VALUE_DATA_TYPE, VALUE_OPERATOR, CValue *) { return NULL;}
|
2013-04-10 22:49:50 +00:00
|
|
|
static STR_String sVertexName = "vertex";
|
2002-10-12 11:37:38 +00:00
|
|
|
const STR_String & KX_VertexProxy::GetText() {return sVertexName;};
|
2009-04-20 15:06:46 +00:00
|
|
|
double KX_VertexProxy::GetNumber() { return -1;}
|
2009-06-08 20:08:19 +00:00
|
|
|
STR_String& KX_VertexProxy::GetName() { return sVertexName;}
|
|
|
|
void KX_VertexProxy::SetName(const char *) { };
|
2002-10-12 11:37:38 +00:00
|
|
|
CValue* KX_VertexProxy::GetReplica() { return NULL;}
|
|
|
|
|
|
|
|
// stuff for python integration
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PyGetXYZ()
|
2004-07-17 05:28:23 +00:00
|
|
|
{
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
return PyObjectFrom(MT_Point3(m_vertex->getXYZ()));
|
2004-07-17 05:28:23 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PySetXYZ(PyObject *value)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-07-17 05:28:23 +00:00
|
|
|
MT_Point3 vec;
|
2009-02-23 06:41:10 +00:00
|
|
|
if (!PyVecTo(value, vec))
|
|
|
|
return NULL;
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2009-02-23 06:41:10 +00:00
|
|
|
m_vertex->SetXYZ(vec);
|
|
|
|
m_mesh->SetMeshModified(true);
|
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PyGetNormal()
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-07-17 05:28:23 +00:00
|
|
|
return PyObjectFrom(MT_Vector3(m_vertex->getNormal()));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PySetNormal(PyObject *value)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-07-17 05:28:23 +00:00
|
|
|
MT_Vector3 vec;
|
2009-02-23 06:41:10 +00:00
|
|
|
if (!PyVecTo(value, vec))
|
|
|
|
return NULL;
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2009-02-23 06:41:10 +00:00
|
|
|
m_vertex->SetNormal(vec);
|
|
|
|
m_mesh->SetMeshModified(true);
|
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PyGetRGBA()
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-07-17 05:28:23 +00:00
|
|
|
int *rgba = (int *) m_vertex->getRGBA();
|
2012-11-21 02:28:36 +00:00
|
|
|
return PyLong_FromLong(*rgba);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2012-05-01 20:08:23 +00:00
|
|
|
if (PyLong_Check(value)) {
|
2012-11-21 02:28:36 +00:00
|
|
|
int rgba = PyLong_AsLong(value);
|
2002-10-12 11:37:38 +00:00
|
|
|
m_vertex->SetRGBA(rgba);
|
2006-04-02 21:04:20 +00:00
|
|
|
m_mesh->SetMeshModified(true);
|
2009-02-21 12:43:24 +00:00
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
else {
|
2009-02-23 06:41:10 +00:00
|
|
|
MT_Vector4 vec;
|
|
|
|
if (PyVecTo(value, vec))
|
|
|
|
{
|
|
|
|
m_vertex->SetRGBA(vec);
|
|
|
|
m_mesh->SetMeshModified(true);
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
}
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError, "vert.setRGBA(value): KX_VertexProxy, expected a 4D vector or an int");
|
2005-01-16 06:02:06 +00:00
|
|
|
return NULL;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-10 10:26:39 +00:00
|
|
|
PyObject *KX_VertexProxy::PyGetUV1()
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyObjectFrom(MT_Vector2(m_vertex->getUV(0)));
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2012-11-10 10:26:39 +00:00
|
|
|
PyObject *KX_VertexProxy::PySetUV1(PyObject *value)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2004-07-17 05:28:23 +00:00
|
|
|
MT_Point2 vec;
|
2009-02-23 06:41:10 +00:00
|
|
|
if (!PyVecTo(value, vec))
|
|
|
|
return NULL;
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-12-18 20:56:25 +00:00
|
|
|
m_vertex->SetUV(0, vec);
|
2009-02-23 06:41:10 +00:00
|
|
|
m_mesh->SetMeshModified(true);
|
|
|
|
Py_RETURN_NONE;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PyGetUV2()
|
2006-01-06 03:46:54 +00:00
|
|
|
{
|
2012-12-18 20:56:25 +00:00
|
|
|
return PyObjectFrom(MT_Vector2(m_vertex->getUV(1)));
|
2006-01-06 03:46:54 +00:00
|
|
|
}
|
|
|
|
|
2012-09-16 04:58:18 +00:00
|
|
|
PyObject *KX_VertexProxy::PySetUV2(PyObject *args)
|
2006-01-06 03:46:54 +00:00
|
|
|
{
|
|
|
|
MT_Point2 vec;
|
2012-12-18 20:56:25 +00:00
|
|
|
if (!PyVecTo(args, vec))
|
2009-02-23 06:41:10 +00:00
|
|
|
return NULL;
|
2009-06-28 11:22:26 +00:00
|
|
|
|
2012-12-18 20:56:25 +00:00
|
|
|
m_vertex->SetUV(1, vec);
|
2009-02-23 06:41:10 +00:00
|
|
|
m_mesh->SetMeshModified(true);
|
|
|
|
Py_RETURN_NONE;
|
2006-01-06 03:46:54 +00:00
|
|
|
}
|
2009-09-29 21:42:40 +00:00
|
|
|
|
2010-10-31 04:11:39 +00:00
|
|
|
#endif // WITH_PYTHON
|