fix [#34609] mesh.getVertex doesn't work as spected with poly.getMaterialIndex() and poly vertex indexes
revert r22906 (own old commit, was incorrectly trying to make vertex indices absolute)
This commit is contained in:
@@ -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);
|
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)
|
PyObject *KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
{
|
{
|
||||||
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
|
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)
|
PyObject *KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
|
||||||
{
|
{
|
||||||
KX_PolyProxy* self = static_cast<KX_PolyProxy*>(self_v);
|
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)
|
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())
|
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);
|
return PyLong_FromLong(0);
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ KX_PYMETHODDEF_DOC(KX_PolyProxy, getVertexIndex,
|
|||||||
}
|
}
|
||||||
if (index < m_polygon->VertexCount())
|
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);
|
return PyLong_FromLong(0);
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "RAS_Polygon.h"
|
#include "RAS_Polygon.h"
|
||||||
#include "RAS_MeshObject.h" /* only for GetVertexOffsetAbs */
|
|
||||||
|
|
||||||
RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert)
|
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];
|
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()
|
int RAS_Polygon::GetEdgeCode()
|
||||||
{
|
{
|
||||||
|
@@ -75,7 +75,6 @@ public:
|
|||||||
|
|
||||||
void SetVertexOffset(int i, unsigned short offset);
|
void SetVertexOffset(int i, unsigned short offset);
|
||||||
int GetVertexOffset(int i);
|
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.
|
// each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc.
|
||||||
// - Not used yet!
|
// - Not used yet!
|
||||||
|
Reference in New Issue
Block a user