fix [#34609] mesh.getVertex doesn't work as spected with poly.getMaterialIndex()...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 May 2013 22:41:55 +0000 (22:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 May 2013 22:41:55 +0000 (22:41 +0000)
revert r22906 (own old commit, was incorrectly trying to make vertex indices absolute)

source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Rasterizer/RAS_Polygon.cpp
source/gameengine/Rasterizer/RAS_Polygon.h

index eaedc752201767e6fee1e39e733707277bb16b8a..83092c7d89cd11be7376ead6802c5e0dbc9a4f36 100644 (file)
@@ -140,21 +140,21 @@ PyObject *KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *at
 {
        KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-       return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+       return PyLong_FromLong(self->m_polygon->GetVertexOffset(0));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-       return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+       return PyLong_FromLong(self->m_polygon->GetVertexOffset(1));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
 
-       return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+       return PyLong_FromLong(self->m_polygon->GetVertexOffset(2));
 }
 
 PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -163,7 +163,7 @@ PyObject *KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *at
 
        if (3 < self->m_polygon->VertexCount())
        {
-               return PyLong_FromLong(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+               return PyLong_FromLong(self->m_polygon->GetVertexOffset(3));
        }
        return PyLong_FromLong(0);
 }
@@ -243,7 +243,7 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
        }
        if (index < m_polygon->VertexCount())
        {
-               return PyLong_FromLong(m_polygon->GetVertexOffsetAbs(m_mesh, index));
+               return PyLong_FromLong(m_polygon->GetVertexOffset(index));
        }
        return PyLong_FromLong(0);
 }
index 74544a80efa490797dd9adea10f6f4d95296da50..72e09c9667d1563fd8d78b2df9086ff5ab9ba354 100644 (file)
@@ -34,7 +34,6 @@
 #endif
 
 #include "RAS_Polygon.h"
-#include "RAS_MeshObject.h" /* only for GetVertexOffsetAbs */
 
 RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert)
 {
@@ -67,20 +66,6 @@ int RAS_Polygon::GetVertexOffset(int i)
        return m_offset[i];
 }
 
-int RAS_Polygon::GetVertexOffsetAbs(RAS_MeshObject *mesh, int i)
-{
-       /* hack that only works because there can only ever be 2 different
-        * GetDisplayArray's per mesh. if this uses a different display array to the first
-        * then its indices are offset.
-        * if support for edges is added back this would need to be changed. */
-       RAS_DisplayArray* darray= mesh->GetPolygon(0)->GetDisplayArray();
-       
-       if (m_darray != darray)
-               return m_offset[i] + darray->m_vertex.size();
-       
-       return m_offset[i];
-}
-
 /*
 int RAS_Polygon::GetEdgeCode()
 {
index bc70b43286c273e0dcc4622ba13c8c27faf8af4e..088bdbd684431919e5a6cd3e5abb19310068cbc6 100644 (file)
@@ -75,7 +75,6 @@ public:
 
        void                            SetVertexOffset(int i, unsigned short offset);
        int                                     GetVertexOffset(int i);
-       int                                     GetVertexOffsetAbs(RAS_MeshObject *mesh, int i); /* accounts for quad and tri arrays, slower, for python */
        
        // each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc.
        // - Not used yet!