Commit: 5aade17bdf0f9d230c2e0bb7a97ead21a48895af
Author: Mitchell Stokes
Date:   Sat Jun 6 13:11:22 2015 -0700
Branches: master
https://developer.blender.org/rB5aade17bdf0f9d230c2e0bb7a97ead21a48895af

Revert "BGE : KX_VertexProxy support for more than 2 UV channel."

This reverts commit fb0dd596e9a58f095730359a11759c40ea46be44.

This commit reintroduced a deprecated API that we'd rather not see in a
release. A better solution is being worked on.

===================================================================

M       doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
M       source/gameengine/Ketsji/KX_VertexProxy.cpp
M       source/gameengine/Ketsji/KX_VertexProxy.h

===================================================================

diff --git a/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst 
b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
index d1bd675..73d6927 100644
--- a/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
+++ b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
@@ -25,12 +25,6 @@ base class --- :class:`SCA_IObject`
 
       :type: Vector((u, v))
 
-   .. attribute:: uvs
-
-      A list of all the texture coordinates of the vertex.
-
-      :type: list of Vector((u, v))
-
    .. attribute:: normal
 
       The normal of the vertex.
@@ -126,24 +120,18 @@ base class --- :class:`SCA_IObject`
 
       :arg pos: the new position for this vertex in local coordinates.
 
-   .. method:: getUV(index=0)
+   .. method:: getUV()
 
       Gets the UV (texture) coordinates of this vertex.
 
-      :arg index: the UV (texture) channel (optional).
-      :type index: integer
-
       :return: this vertexes UV (texture) coordinates.
       :rtype: Vector((u, v))
 
-   .. method:: setUV(uv, index=0)
+   .. method:: setUV(uv)
 
       Sets the UV (texture) coordinates of this vertex.
 
-      :arg uv: the UV (texture) coordinate of this vertex.
-      :type uv: Vector((u, v))
-      :arg index: the UV (texture) channel (optional).
-      :type index: integer
+      :type:  Vector((u, v))
 
    .. method:: getUV2()
 
@@ -152,16 +140,14 @@ base class --- :class:`SCA_IObject`
       :return: this vertexes UV (texture) coordinates.
       :rtype: Vector((u, v))
 
-      .. deprecated:: use :meth:`getUV`
-
-   .. method:: setUV2(uv)
+   .. method:: setUV2(uv, unit)
 
       Sets the 2nd UV (texture) coordinates of this vertex.
 
-      :arg uv: the 2nd (texture) UV coordinate of this vertex.
-      :type uv: Vector((u, v))
+      :type:  Vector((u, v))
 
-      .. deprecated:: use :meth:`setUV`
+      :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to 
SECOND_UV
+      :arg unit:  integer
 
    .. method:: getRGBA()
 
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp 
b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 1634165..cd1c9ee 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -63,11 +63,11 @@ PyTypeObject KX_VertexProxy::Type = {
 PyMethodDef KX_VertexProxy::Methods[] = {
        {"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
        {"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
-       {"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV, METH_VARARGS},
-       {"setUV", (PyCFunction)KX_VertexProxy::sPySetUV, METH_VARARGS},
+       {"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV1, METH_NOARGS},
+       {"setUV", (PyCFunction)KX_VertexProxy::sPySetUV1, METH_O},
 
        {"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
-       {"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2, METH_O},
+       {"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
 
        {"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
        {"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
@@ -423,6 +423,7 @@ int KX_VertexProxy::pyattr_set_uvs(void *self_v, const 
struct KX_PYATTRIBUTE_DEF
                        if (PyVecTo(PySequence_GetItem(value, i), vec))
                        {
                                self->m_vertex->SetUV(i, vec);
+                               self->m_mesh->SetMeshModified(true);
                        }
                        else
                        {
@@ -558,45 +559,25 @@ PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
        return NULL;
 }
 
-PyObject *KX_VertexProxy::PyGetUV(PyObject *args)
-{
-       int index = 0;
-       if (!PyArg_ParseTuple(args, "|i:getUV", &index))
-               return NULL;
 
-       if (index < 0 || index > (RAS_TexVert::MAX_UNIT - 1)) {
-               PyErr_Format(PyExc_TypeError, "vert.getUV(index): 
KX_VertexProxy, expected an int between 0 and %i", (RAS_TexVert::MAX_UNIT - 1));
-               return NULL;
-       }
-
-       return PyObjectFrom(MT_Vector2(m_vertex->getUV(index)));
+PyObject *KX_VertexProxy::PyGetUV1()
+{
+       return PyObjectFrom(MT_Vector2(m_vertex->getUV(0)));
 }
 
-PyObject *KX_VertexProxy::PySetUV(PyObject *args)
+PyObject *KX_VertexProxy::PySetUV1(PyObject *value)
 {
-       PyObject *pyvect;
-       int index = 0;
-       if (!PyArg_ParseTuple(args, "O|i:setUV", &pyvect, &index))
-               return NULL;
-
-       if (index < 0 || index > (RAS_TexVert::MAX_UNIT - 1)) {
-               PyErr_Format(PyExc_TypeError, "vert.setUV(uv, index): 
KX_VertexProxy, expected an int between 0 and %i", (RAS_TexVert::MAX_UNIT - 1));
-               return NULL;
-       }
-
        MT_Point2 vec;
-       if (!PyVecTo(pyvect, vec))
+       if (!PyVecTo(value, vec))
                return NULL;
 
-       m_vertex->SetUV(index, vec);
+       m_vertex->SetUV(0, vec);
        m_mesh->SetMeshModified(true);
        Py_RETURN_NONE;
 }
 
 PyObject *KX_VertexProxy::PyGetUV2()
 {
-       ShowDeprecationWarning("getUV2()", "getUV(1)");
-
        return PyObjectFrom(MT_Vector2(m_vertex->getUV(1)));
 }
 
@@ -606,8 +587,6 @@ PyObject *KX_VertexProxy::PySetUV2(PyObject *args)
        if (!PyVecTo(args, vec))
                return NULL;
 
-       ShowDeprecationWarning("setUV2(uv)", "setUV(uv, 1)");
-
        m_vertex->SetUV(1, vec);
        m_mesh->SetMeshModified(true);
        Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h 
b/source/gameengine/Ketsji/KX_VertexProxy.h
index 91cf29d..8070825 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -94,11 +94,11 @@ public:
 
        KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ);
        KX_PYMETHOD_O(KX_VertexProxy,SetXYZ);
-       KX_PYMETHOD_VARARGS(KX_VertexProxy, GetUV);
-       KX_PYMETHOD_VARARGS(KX_VertexProxy, SetUV);
+       KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV1);
+       KX_PYMETHOD_O(KX_VertexProxy,SetUV1);
        
        KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV2);
-       KX_PYMETHOD_O(KX_VertexProxy, SetUV2);
+       KX_PYMETHOD_VARARGS(KX_VertexProxy,SetUV2);
 
        KX_PYMETHOD_NOARGS(KX_VertexProxy,GetRGBA);
        KX_PYMETHOD_O(KX_VertexProxy,SetRGBA);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to