2011-10-23 17:52:20 +00:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2010-05-19 01:42:17 +00:00
|
|
|
|
2011-09-20 16:24:50 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2011-05-16 20:30:59 +00:00
|
|
|
#include "BLI_math_vector.h"
|
2010-05-31 22:35:22 +00:00
|
|
|
#include "KX_NavMeshObject.h"
|
2010-05-19 01:42:17 +00:00
|
|
|
#include "RAS_MeshObject.h"
|
|
|
|
|
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
2010-07-30 13:02:32 +00:00
|
|
|
|
2010-05-19 01:42:17 +00:00
|
|
|
extern "C" {
|
|
|
|
#include "BKE_scene.h"
|
|
|
|
#include "BKE_customdata.h"
|
|
|
|
#include "BKE_cdderivedmesh.h"
|
|
|
|
#include "BKE_DerivedMesh.h"
|
2011-09-11 14:13:04 +00:00
|
|
|
#include "BKE_navmesh_conversion.h"
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
2010-07-30 13:02:32 +00:00
|
|
|
|
2010-05-19 01:42:17 +00:00
|
|
|
#include "KX_PythonInit.h"
|
2010-05-27 20:18:56 +00:00
|
|
|
#include "KX_PyMath.h"
|
|
|
|
#include "Value.h"
|
2010-05-19 01:42:17 +00:00
|
|
|
#include "Recast.h"
|
|
|
|
#include "DetourStatNavMeshBuilder.h"
|
2010-06-16 00:23:24 +00:00
|
|
|
#include "KX_ObstacleSimulation.h"
|
2010-05-19 01:42:17 +00:00
|
|
|
|
2013-08-04 03:45:30 +00:00
|
|
|
#define MAX_PATH_LEN 256
|
2010-05-27 20:18:56 +00:00
|
|
|
static const float polyPickExt[3] = {2, 4, 2};
|
|
|
|
|
2010-05-19 01:42:17 +00:00
|
|
|
static void calcMeshBounds(const float* vert, int nverts, float* bmin, float* bmax)
|
|
|
|
{
|
|
|
|
bmin[0] = bmax[0] = vert[0];
|
|
|
|
bmin[1] = bmax[1] = vert[1];
|
|
|
|
bmin[2] = bmax[2] = vert[2];
|
|
|
|
for (int i=1; i<nverts; i++)
|
|
|
|
{
|
2010-05-27 20:18:56 +00:00
|
|
|
if (bmin[0]>vert[3*i+0]) bmin[0] = vert[3*i+0];
|
|
|
|
if (bmin[1]>vert[3*i+1]) bmin[1] = vert[3*i+1];
|
|
|
|
if (bmin[2]>vert[3*i+2]) bmin[2] = vert[3*i+2];
|
2010-05-19 01:42:17 +00:00
|
|
|
|
2010-05-27 20:18:56 +00:00
|
|
|
if (bmax[0]<vert[3*i+0]) bmax[0] = vert[3*i+0];
|
|
|
|
if (bmax[1]<vert[3*i+1]) bmax[1] = vert[3*i+1];
|
|
|
|
if (bmax[2]<vert[3*i+2]) bmax[2] = vert[3*i+2];
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-27 20:18:56 +00:00
|
|
|
inline void flipAxes(float* vec)
|
|
|
|
{
|
|
|
|
std::swap(vec[1],vec[2]);
|
|
|
|
}
|
2010-05-31 22:35:22 +00:00
|
|
|
KX_NavMeshObject::KX_NavMeshObject(void* sgReplicationInfo, SG_Callbacks callbacks)
|
2010-05-27 20:18:56 +00:00
|
|
|
: KX_GameObject(sgReplicationInfo, callbacks)
|
|
|
|
, m_navMesh(NULL)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
KX_NavMeshObject::~KX_NavMeshObject()
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
|
|
|
if (m_navMesh)
|
|
|
|
delete m_navMesh;
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
CValue* KX_NavMeshObject::GetReplica()
|
|
|
|
{
|
|
|
|
KX_NavMeshObject* replica = new KX_NavMeshObject(*this);
|
|
|
|
replica->ProcessReplica();
|
|
|
|
return replica;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KX_NavMeshObject::ProcessReplica()
|
|
|
|
{
|
|
|
|
KX_GameObject::ProcessReplica();
|
2013-03-22 20:19:55 +00:00
|
|
|
m_navMesh = NULL; /* without this, building frees the navmesh we copied from */
|
2010-05-31 22:35:22 +00:00
|
|
|
BuildNavMesh();
|
2010-06-16 00:23:24 +00:00
|
|
|
KX_Scene* scene = KX_GetActiveScene();
|
|
|
|
KX_ObstacleSimulation* obssimulation = scene->GetObstacleSimulation();
|
|
|
|
if (obssimulation)
|
|
|
|
obssimulation->AddObstaclesForNavMesh(this);
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
}
|
|
|
|
|
2010-07-27 21:01:00 +00:00
|
|
|
bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
|
2010-07-09 22:22:51 +00:00
|
|
|
unsigned short* &polys, int& npolys, unsigned short *&dmeshes,
|
|
|
|
float *&dvertices, int &ndvertsuniq, unsigned short *&dtris,
|
|
|
|
int& ndtris, int &vertsPerPoly)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
DerivedMesh* dm = mesh_create_derived_no_virtual(KX_GetActiveScene()->GetBlenderScene(), GetBlenderObject(),
|
|
|
|
NULL, CD_MASK_MESH);
|
2012-04-16 13:53:30 +00:00
|
|
|
CustomData *pdata = dm->getPolyDataLayout(dm);
|
|
|
|
int* recastData = (int*) CustomData_get_layer(pdata, CD_RECAST);
|
2010-07-09 22:22:51 +00:00
|
|
|
if (recastData)
|
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL;
|
|
|
|
int nAllVerts = 0;
|
|
|
|
float *allVerts = NULL;
|
2011-09-20 16:24:50 +00:00
|
|
|
buildNavMeshDataByDerivedMesh(dm, &vertsPerPoly, &nAllVerts, &allVerts, &ndtris, &dtris,
|
2013-08-04 03:02:35 +00:00
|
|
|
&npolys, &dmeshes, &polys, &dtrisToPolysMap, &dtrisToTrisMap, &trisToFacesMap);
|
2011-09-20 16:24:50 +00:00
|
|
|
|
2013-08-04 03:02:35 +00:00
|
|
|
MEM_SAFE_FREE(dtrisToPolysMap);
|
|
|
|
MEM_SAFE_FREE(dtrisToTrisMap);
|
|
|
|
MEM_SAFE_FREE(trisToFacesMap);
|
2010-07-28 19:43:05 +00:00
|
|
|
|
|
|
|
unsigned short *verticesMap = new unsigned short[nAllVerts];
|
2013-08-04 03:02:35 +00:00
|
|
|
memset(verticesMap, 0xff, sizeof(*verticesMap) * nAllVerts);
|
2010-07-28 19:43:05 +00:00
|
|
|
int curIdx = 0;
|
|
|
|
//vertices - mesh verts
|
|
|
|
//iterate over all polys and create map for their vertices first...
|
|
|
|
for (int polyidx=0; polyidx<npolys; polyidx++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
unsigned short* poly = &polys[polyidx*vertsPerPoly*2];
|
|
|
|
for (int i=0; i<vertsPerPoly; i++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
unsigned short idx = poly[i];
|
|
|
|
if (idx==0xffff)
|
|
|
|
break;
|
|
|
|
if (verticesMap[idx]==0xffff)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
verticesMap[idx] = curIdx++;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
poly[i] = verticesMap[idx];
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
nverts = curIdx;
|
|
|
|
//...then iterate over detailed meshes
|
|
|
|
//transform indices to local ones (for each navigation polygon)
|
2010-07-09 22:22:51 +00:00
|
|
|
for (int polyidx=0; polyidx<npolys; polyidx++)
|
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
unsigned short *poly = &polys[polyidx*vertsPerPoly*2];
|
|
|
|
int nv = polyNumVerts(poly, vertsPerPoly);
|
|
|
|
unsigned short *dmesh = &dmeshes[4*polyidx];
|
|
|
|
unsigned short tribase = dmesh[2];
|
|
|
|
unsigned short trinum = dmesh[3];
|
|
|
|
unsigned short vbase = curIdx;
|
|
|
|
for (int j=0; j<trinum; j++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
unsigned short* dtri = &dtris[(tribase+j)*3*2];
|
2010-07-09 22:22:51 +00:00
|
|
|
for (int k=0; k<3; k++)
|
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
int newVertexIdx = verticesMap[dtri[k]];
|
|
|
|
if (newVertexIdx==0xffff)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
newVertexIdx = curIdx++;
|
|
|
|
verticesMap[dtri[k]] = newVertexIdx;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
|
2010-07-28 19:43:05 +00:00
|
|
|
if (newVertexIdx<nverts)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
//it's polygon vertex ("shared")
|
|
|
|
int idxInPoly = polyFindVertex(poly, vertsPerPoly, newVertexIdx);
|
|
|
|
if (idxInPoly==-1)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
printf("Building NavMeshObject: Error! Can't find vertex in polygon\n");
|
|
|
|
return false;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
dtri[k] = idxInPoly;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
else
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
dtri[k] = newVertexIdx - vbase + nv;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
dmesh[0] = vbase-nverts; //verts base
|
|
|
|
dmesh[1] = curIdx-vbase; //verts num
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vertices = new float[nverts*3];
|
2010-07-28 19:43:05 +00:00
|
|
|
ndvertsuniq = curIdx - nverts;
|
2010-07-09 22:22:51 +00:00
|
|
|
if (ndvertsuniq>0)
|
|
|
|
{
|
|
|
|
dvertices = new float[ndvertsuniq*3];
|
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
for (int vi=0; vi<nAllVerts; vi++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
int newIdx = verticesMap[vi];
|
|
|
|
if (newIdx!=0xffff)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
if (newIdx<nverts)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
//navigation mesh vertex
|
|
|
|
memcpy(vertices+3*newIdx, allVerts+3*vi, 3*sizeof(float));
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
2010-07-28 19:43:05 +00:00
|
|
|
else
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
//detailed mesh vertex
|
|
|
|
memcpy(dvertices+3*(newIdx-nverts), allVerts+3*vi, 3*sizeof(float));
|
2012-09-16 04:58:18 +00:00
|
|
|
}
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
2011-09-20 16:24:50 +00:00
|
|
|
|
2013-08-04 03:45:30 +00:00
|
|
|
MEM_SAFE_FREE(allVerts);
|
2010-05-27 20:18:56 +00:00
|
|
|
}
|
2010-07-09 22:22:51 +00:00
|
|
|
else
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
//create from RAS_MeshObject (detailed mesh is fake)
|
2010-07-27 21:01:00 +00:00
|
|
|
RAS_MeshObject* meshobj = GetMesh(0);
|
2010-07-09 22:22:51 +00:00
|
|
|
vertsPerPoly = 3;
|
|
|
|
nverts = meshobj->m_sharedvertex_map.size();
|
|
|
|
if (nverts >= 0xffff)
|
|
|
|
return false;
|
|
|
|
//calculate count of tris
|
|
|
|
int nmeshpolys = meshobj->NumPolygons();
|
|
|
|
npolys = nmeshpolys;
|
|
|
|
for (int p=0; p<nmeshpolys; p++)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
int vertcount = meshobj->GetPolygon(p)->VertexCount();
|
|
|
|
npolys+=vertcount-3;
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
//create verts
|
|
|
|
vertices = new float[nverts*3];
|
|
|
|
float* vert = vertices;
|
|
|
|
for (int vi=0; vi<nverts; vi++)
|
|
|
|
{
|
|
|
|
const float* pos = !meshobj->m_sharedvertex_map[vi].empty() ? meshobj->GetVertexLocation(vi) : NULL;
|
|
|
|
if (pos)
|
|
|
|
copy_v3_v3(vert, pos);
|
|
|
|
else
|
|
|
|
{
|
2011-09-10 09:38:38 +00:00
|
|
|
memset(vert, 0, 3*sizeof(float)); //vertex isn't in any poly, set dummy zero coordinates
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
2012-09-16 04:58:18 +00:00
|
|
|
vert+=3;
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//create tris
|
2012-10-20 18:46:57 +00:00
|
|
|
polys = (unsigned short *)MEM_callocN(sizeof(unsigned short)*3*2*npolys, "BuildVertIndArrays polys");
|
2010-07-09 22:22:51 +00:00
|
|
|
memset(polys, 0xff, sizeof(unsigned short)*3*2*npolys);
|
|
|
|
unsigned short *poly = polys;
|
|
|
|
RAS_Polygon* raspoly;
|
|
|
|
for (int p=0; p<nmeshpolys; p++)
|
|
|
|
{
|
|
|
|
raspoly = meshobj->GetPolygon(p);
|
|
|
|
for (int v=0; v<raspoly->VertexCount()-2; v++)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
poly[0] = raspoly->GetVertex(0)->getOrigIndex();
|
2010-07-09 22:22:51 +00:00
|
|
|
for (size_t i=1; i<3; i++)
|
|
|
|
{
|
2012-10-22 08:15:51 +00:00
|
|
|
poly[i] = raspoly->GetVertex(v+i)->getOrigIndex();
|
2010-07-09 22:22:51 +00:00
|
|
|
}
|
|
|
|
poly += 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dmeshes = NULL;
|
|
|
|
dvertices = NULL;
|
|
|
|
ndvertsuniq = 0;
|
|
|
|
dtris = NULL;
|
|
|
|
ndtris = npolys;
|
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
dm->release(dm);
|
2010-05-27 20:18:56 +00:00
|
|
|
|
2010-05-19 01:42:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
bool KX_NavMeshObject::BuildNavMesh()
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-15 18:41:29 +00:00
|
|
|
if (m_navMesh)
|
|
|
|
{
|
|
|
|
delete m_navMesh;
|
|
|
|
m_navMesh = NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-27 20:18:56 +00:00
|
|
|
if (GetMeshCount()==0)
|
2010-07-27 21:01:00 +00:00
|
|
|
{
|
2012-03-31 00:59:17 +00:00
|
|
|
printf("Can't find mesh for navmesh object: %s\n", m_name.ReadPtr());
|
2010-05-27 20:18:56 +00:00
|
|
|
return false;
|
2010-07-27 21:01:00 +00:00
|
|
|
}
|
2010-05-27 20:18:56 +00:00
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
float *vertices = NULL, *dvertices = NULL;
|
|
|
|
unsigned short *polys = NULL, *dtris = NULL, *dmeshes = NULL;
|
2012-09-16 04:58:18 +00:00
|
|
|
int nverts = 0, npolys = 0, ndvertsuniq = 0, ndtris = 0;
|
2010-07-09 22:22:51 +00:00
|
|
|
int vertsPerPoly = 0;
|
2010-07-27 21:01:00 +00:00
|
|
|
if (!BuildVertIndArrays(vertices, nverts, polys, npolys,
|
2010-07-09 22:22:51 +00:00
|
|
|
dmeshes, dvertices, ndvertsuniq, dtris, ndtris, vertsPerPoly )
|
|
|
|
|| vertsPerPoly<3)
|
2010-07-27 21:01:00 +00:00
|
|
|
{
|
2012-03-31 00:59:17 +00:00
|
|
|
printf("Can't build navigation mesh data for object:%s\n", m_name.ReadPtr());
|
2010-05-19 01:42:17 +00:00
|
|
|
return false;
|
2010-07-27 21:01:00 +00:00
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
|
2010-05-27 20:18:56 +00:00
|
|
|
MT_Point3 pos;
|
2010-07-28 19:43:05 +00:00
|
|
|
if (dmeshes==NULL)
|
2010-07-14 13:20:13 +00:00
|
|
|
{
|
2010-07-28 19:43:05 +00:00
|
|
|
for (int i=0; i<nverts; i++)
|
|
|
|
{
|
|
|
|
flipAxes(&vertices[i*3]);
|
|
|
|
}
|
|
|
|
for (int i=0; i<ndvertsuniq; i++)
|
|
|
|
{
|
|
|
|
flipAxes(&dvertices[i*3]);
|
|
|
|
}
|
2010-07-14 13:20:13 +00:00
|
|
|
}
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
buildMeshAdjacency(polys, npolys, nverts, vertsPerPoly);
|
2010-05-19 01:42:17 +00:00
|
|
|
|
|
|
|
float cs = 0.2f;
|
|
|
|
|
|
|
|
if (!nverts || !npolys)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
float bmin[3], bmax[3];
|
|
|
|
calcMeshBounds(vertices, nverts, bmin, bmax);
|
2010-05-27 20:18:56 +00:00
|
|
|
//quantize vertex pos
|
|
|
|
unsigned short* vertsi = new unsigned short[3*nverts];
|
|
|
|
float ics = 1.f/cs;
|
|
|
|
for (int i=0; i<nverts; i++)
|
|
|
|
{
|
|
|
|
vertsi[3*i+0] = static_cast<unsigned short>((vertices[3*i+0]-bmin[0])*ics);
|
|
|
|
vertsi[3*i+1] = static_cast<unsigned short>((vertices[3*i+1]-bmin[1])*ics);
|
|
|
|
vertsi[3*i+2] = static_cast<unsigned short>((vertices[3*i+2]-bmin[2])*ics);
|
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
|
|
|
|
// Calculate data size
|
|
|
|
const int headerSize = sizeof(dtStatNavMeshHeader);
|
|
|
|
const int vertsSize = sizeof(float)*3*nverts;
|
|
|
|
const int polysSize = sizeof(dtStatPoly)*npolys;
|
|
|
|
const int nodesSize = sizeof(dtStatBVNode)*npolys*2;
|
|
|
|
const int detailMeshesSize = sizeof(dtStatPolyDetail)*npolys;
|
2010-07-09 22:22:51 +00:00
|
|
|
const int detailVertsSize = sizeof(float)*3*ndvertsuniq;
|
2010-05-19 01:42:17 +00:00
|
|
|
const int detailTrisSize = sizeof(unsigned char)*4*ndtris;
|
|
|
|
|
|
|
|
const int dataSize = headerSize + vertsSize + polysSize + nodesSize +
|
|
|
|
detailMeshesSize + detailVertsSize + detailTrisSize;
|
|
|
|
unsigned char* data = new unsigned char[dataSize];
|
|
|
|
if (!data)
|
|
|
|
return false;
|
|
|
|
memset(data, 0, dataSize);
|
|
|
|
|
|
|
|
unsigned char* d = data;
|
|
|
|
dtStatNavMeshHeader* header = (dtStatNavMeshHeader*)d; d += headerSize;
|
|
|
|
float* navVerts = (float*)d; d += vertsSize;
|
|
|
|
dtStatPoly* navPolys = (dtStatPoly*)d; d += polysSize;
|
|
|
|
dtStatBVNode* navNodes = (dtStatBVNode*)d; d += nodesSize;
|
|
|
|
dtStatPolyDetail* navDMeshes = (dtStatPolyDetail*)d; d += detailMeshesSize;
|
|
|
|
float* navDVerts = (float*)d; d += detailVertsSize;
|
|
|
|
unsigned char* navDTris = (unsigned char*)d; d += detailTrisSize;
|
|
|
|
|
|
|
|
// Store header
|
|
|
|
header->magic = DT_STAT_NAVMESH_MAGIC;
|
|
|
|
header->version = DT_STAT_NAVMESH_VERSION;
|
|
|
|
header->npolys = npolys;
|
|
|
|
header->nverts = nverts;
|
|
|
|
header->cs = cs;
|
|
|
|
header->bmin[0] = bmin[0];
|
|
|
|
header->bmin[1] = bmin[1];
|
|
|
|
header->bmin[2] = bmin[2];
|
|
|
|
header->bmax[0] = bmax[0];
|
|
|
|
header->bmax[1] = bmax[1];
|
|
|
|
header->bmax[2] = bmax[2];
|
|
|
|
header->ndmeshes = npolys;
|
2010-07-09 22:22:51 +00:00
|
|
|
header->ndverts = ndvertsuniq;
|
2010-05-19 01:42:17 +00:00
|
|
|
header->ndtris = ndtris;
|
|
|
|
|
2010-05-27 20:18:56 +00:00
|
|
|
// Store vertices
|
|
|
|
for (int i = 0; i < nverts; ++i)
|
|
|
|
{
|
|
|
|
const unsigned short* iv = &vertsi[i*3];
|
|
|
|
float* v = &navVerts[i*3];
|
|
|
|
v[0] = bmin[0] + iv[0] * cs;
|
|
|
|
v[1] = bmin[1] + iv[1] * cs;
|
|
|
|
v[2] = bmin[2] + iv[2] * cs;
|
|
|
|
}
|
|
|
|
//memcpy(navVerts, vertices, nverts*3*sizeof(float));
|
2010-05-19 01:42:17 +00:00
|
|
|
|
|
|
|
// Store polygons
|
2010-07-09 22:22:51 +00:00
|
|
|
const unsigned short* src = polys;
|
2010-05-19 01:42:17 +00:00
|
|
|
for (int i = 0; i < npolys; ++i)
|
|
|
|
{
|
|
|
|
dtStatPoly* p = &navPolys[i];
|
|
|
|
p->nv = 0;
|
2010-07-09 22:22:51 +00:00
|
|
|
for (int j = 0; j < vertsPerPoly; ++j)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
if (src[j] == 0xffff) break;
|
2010-05-19 01:42:17 +00:00
|
|
|
p->v[j] = src[j];
|
2010-07-09 22:22:51 +00:00
|
|
|
p->n[j] = src[vertsPerPoly+j]+1;
|
2010-05-19 01:42:17 +00:00
|
|
|
p->nv++;
|
|
|
|
}
|
2010-07-09 22:22:51 +00:00
|
|
|
src += vertsPerPoly*2;
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
header->nnodes = createBVTree(vertsi, nverts, polys, npolys, vertsPerPoly,
|
2010-05-19 01:42:17 +00:00
|
|
|
cs, cs, npolys*2, navNodes);
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
|
|
|
|
if (dmeshes==NULL)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
//create fake detail meshes
|
|
|
|
for (int i = 0; i < npolys; ++i)
|
|
|
|
{
|
|
|
|
dtStatPolyDetail& dtl = navDMeshes[i];
|
|
|
|
dtl.vbase = 0;
|
|
|
|
dtl.nverts = 0;
|
|
|
|
dtl.tbase = i;
|
|
|
|
dtl.ntris = 1;
|
|
|
|
}
|
|
|
|
// setup triangles.
|
|
|
|
unsigned char* tri = navDTris;
|
2012-03-24 07:52:14 +00:00
|
|
|
for (size_t i=0; i<ndtris; i++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
|
|
|
for (size_t j=0; j<3; j++)
|
|
|
|
tri[4*i+j] = j;
|
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
2010-07-09 22:22:51 +00:00
|
|
|
else
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-09 22:22:51 +00:00
|
|
|
//verts
|
|
|
|
memcpy(navDVerts, dvertices, ndvertsuniq*3*sizeof(float));
|
|
|
|
//tris
|
|
|
|
unsigned char* tri = navDTris;
|
2012-03-24 07:52:14 +00:00
|
|
|
for (size_t i=0; i<ndtris; i++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
|
|
|
for (size_t j=0; j<3; j++)
|
|
|
|
tri[4*i+j] = dtris[6*i+j];
|
|
|
|
}
|
|
|
|
//detailed meshes
|
|
|
|
for (int i = 0; i < npolys; ++i)
|
|
|
|
{
|
|
|
|
dtStatPolyDetail& dtl = navDMeshes[i];
|
|
|
|
dtl.vbase = dmeshes[i*4+0];
|
|
|
|
dtl.nverts = dmeshes[i*4+1];
|
|
|
|
dtl.tbase = dmeshes[i*4+2];
|
|
|
|
dtl.ntris = dmeshes[i*4+3];
|
2012-09-16 04:58:18 +00:00
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_navMesh = new dtStatNavMesh;
|
2012-09-16 04:58:18 +00:00
|
|
|
m_navMesh->init(data, dataSize, true);
|
2010-05-19 01:42:17 +00:00
|
|
|
|
|
|
|
delete [] vertices;
|
2011-09-20 16:24:50 +00:00
|
|
|
|
|
|
|
/* navmesh conversion is using C guarded alloc for memory allocaitons */
|
|
|
|
MEM_freeN(polys);
|
|
|
|
if (dmeshes) MEM_freeN(dmeshes);
|
|
|
|
if (dtris) MEM_freeN(dtris);
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
if (dvertices)
|
|
|
|
{
|
|
|
|
delete [] dvertices;
|
|
|
|
}
|
|
|
|
|
2010-05-19 01:42:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-06-07 23:09:50 +00:00
|
|
|
dtStatNavMesh* KX_NavMeshObject::GetNavMesh()
|
|
|
|
{
|
|
|
|
return m_navMesh;
|
|
|
|
}
|
|
|
|
|
2010-07-15 18:41:29 +00:00
|
|
|
void KX_NavMeshObject::DrawNavMesh(NavMeshRenderMode renderMode)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
|
|
|
if (!m_navMesh)
|
|
|
|
return;
|
|
|
|
MT_Vector3 color(0.f, 0.f, 0.f);
|
2010-06-18 23:48:52 +00:00
|
|
|
|
|
|
|
switch (renderMode)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-07-15 18:41:29 +00:00
|
|
|
case RM_POLYS :
|
|
|
|
case RM_WALLS :
|
2010-06-18 23:48:52 +00:00
|
|
|
for (int pi=0; pi<m_navMesh->getPolyCount(); pi++)
|
2010-05-19 01:42:17 +00:00
|
|
|
{
|
2010-06-18 23:48:52 +00:00
|
|
|
const dtStatPoly* poly = m_navMesh->getPoly(pi);
|
|
|
|
|
|
|
|
for (int i = 0, j = (int)poly->nv-1; i < (int)poly->nv; j = i++)
|
2012-09-16 04:58:18 +00:00
|
|
|
{
|
2010-07-15 18:41:29 +00:00
|
|
|
if (poly->n[j] && renderMode==RM_WALLS)
|
2010-07-09 22:22:51 +00:00
|
|
|
continue;
|
|
|
|
const float* vif = m_navMesh->getVertex(poly->v[i]);
|
|
|
|
const float* vjf = m_navMesh->getVertex(poly->v[j]);
|
|
|
|
MT_Point3 vi(vif[0], vif[2], vif[1]);
|
|
|
|
MT_Point3 vj(vjf[0], vjf[2], vjf[1]);
|
|
|
|
vi = TransformToWorldCoords(vi);
|
|
|
|
vj = TransformToWorldCoords(vj);
|
|
|
|
KX_RasterizerDrawDebugLine(vi, vj, color);
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
2010-06-18 23:48:52 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-07-15 18:41:29 +00:00
|
|
|
case RM_TRIS :
|
2010-06-18 23:48:52 +00:00
|
|
|
for (int i = 0; i < m_navMesh->getPolyDetailCount(); ++i)
|
|
|
|
{
|
|
|
|
const dtStatPoly* p = m_navMesh->getPoly(i);
|
|
|
|
const dtStatPolyDetail* pd = m_navMesh->getPolyDetail(i);
|
2010-05-19 01:42:17 +00:00
|
|
|
|
2010-06-18 23:48:52 +00:00
|
|
|
for (int j = 0; j < pd->ntris; ++j)
|
|
|
|
{
|
|
|
|
const unsigned char* t = m_navMesh->getDetailTri(pd->tbase+j);
|
2010-07-09 22:22:51 +00:00
|
|
|
MT_Point3 tri[3];
|
2010-06-18 23:48:52 +00:00
|
|
|
for (int k = 0; k < 3; ++k)
|
|
|
|
{
|
|
|
|
const float* v;
|
|
|
|
if (t[k] < p->nv)
|
|
|
|
v = m_navMesh->getVertex(p->v[t[k]]);
|
|
|
|
else
|
|
|
|
v = m_navMesh->getDetailVertex(pd->vbase+(t[k]-p->nv));
|
|
|
|
float pos[3];
|
2011-09-29 21:38:57 +00:00
|
|
|
rcVcopy(pos, v);
|
2010-06-18 23:48:52 +00:00
|
|
|
flipAxes(pos);
|
|
|
|
tri[k].setValue(pos);
|
|
|
|
}
|
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
for (int k=0; k<3; k++)
|
|
|
|
tri[k] = TransformToWorldCoords(tri[k]);
|
|
|
|
|
2010-06-18 23:48:52 +00:00
|
|
|
for (int k=0; k<3; k++)
|
|
|
|
KX_RasterizerDrawDebugLine(tri[k], tri[(k+1)%3], color);
|
|
|
|
}
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
2010-06-18 23:48:52 +00:00
|
|
|
break;
|
2011-09-10 14:12:15 +00:00
|
|
|
default:
|
|
|
|
/* pass */
|
|
|
|
break;
|
2010-05-19 01:42:17 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-27 20:18:56 +00:00
|
|
|
|
2010-07-09 22:22:51 +00:00
|
|
|
MT_Point3 KX_NavMeshObject::TransformToLocalCoords(const MT_Point3& wpos)
|
|
|
|
{
|
|
|
|
MT_Matrix3x3 orientation = NodeGetWorldOrientation();
|
|
|
|
const MT_Vector3& scaling = NodeGetWorldScaling();
|
|
|
|
orientation.scale(scaling[0], scaling[1], scaling[2]);
|
|
|
|
MT_Transform worldtr(NodeGetWorldPosition(), orientation);
|
|
|
|
MT_Transform invworldtr;
|
|
|
|
invworldtr.invert(worldtr);
|
|
|
|
MT_Point3 lpos = invworldtr(wpos);
|
|
|
|
return lpos;
|
|
|
|
}
|
|
|
|
|
|
|
|
MT_Point3 KX_NavMeshObject::TransformToWorldCoords(const MT_Point3& lpos)
|
|
|
|
{
|
|
|
|
MT_Matrix3x3 orientation = NodeGetWorldOrientation();
|
|
|
|
const MT_Vector3& scaling = NodeGetWorldScaling();
|
|
|
|
orientation.scale(scaling[0], scaling[1], scaling[2]);
|
|
|
|
MT_Transform worldtr(NodeGetWorldPosition(), orientation);
|
|
|
|
MT_Point3 wpos = worldtr(lpos);
|
|
|
|
return wpos;
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
int KX_NavMeshObject::FindPath(const MT_Point3& from, const MT_Point3& to, float* path, int maxPathLen)
|
2010-05-27 20:18:56 +00:00
|
|
|
{
|
|
|
|
if (!m_navMesh)
|
|
|
|
return 0;
|
2010-07-09 22:22:51 +00:00
|
|
|
MT_Point3 localfrom = TransformToLocalCoords(from);
|
2012-09-16 04:58:18 +00:00
|
|
|
MT_Point3 localto = TransformToLocalCoords(to);
|
2010-05-27 20:18:56 +00:00
|
|
|
float spos[3], epos[3];
|
2010-07-09 22:22:51 +00:00
|
|
|
localfrom.getValue(spos); flipAxes(spos);
|
|
|
|
localto.getValue(epos); flipAxes(epos);
|
2010-05-27 20:18:56 +00:00
|
|
|
dtStatPolyRef sPolyRef = m_navMesh->findNearestPoly(spos, polyPickExt);
|
|
|
|
dtStatPolyRef ePolyRef = m_navMesh->findNearestPoly(epos, polyPickExt);
|
|
|
|
|
|
|
|
int pathLen = 0;
|
|
|
|
if (sPolyRef && ePolyRef)
|
|
|
|
{
|
|
|
|
dtStatPolyRef* polys = new dtStatPolyRef[maxPathLen];
|
|
|
|
int npolys;
|
|
|
|
npolys = m_navMesh->findPath(sPolyRef, ePolyRef, spos, epos, polys, maxPathLen);
|
|
|
|
if (npolys)
|
|
|
|
{
|
|
|
|
pathLen = m_navMesh->findStraightPath(spos, epos, polys, npolys, path, maxPathLen);
|
|
|
|
for (int i=0; i<pathLen; i++)
|
2010-07-09 22:22:51 +00:00
|
|
|
{
|
2010-05-27 20:18:56 +00:00
|
|
|
flipAxes(&path[i*3]);
|
2010-07-09 22:22:51 +00:00
|
|
|
MT_Point3 waypoint(&path[i*3]);
|
|
|
|
waypoint = TransformToWorldCoords(waypoint);
|
|
|
|
waypoint.getValue(&path[i*3]);
|
|
|
|
}
|
2010-05-27 20:18:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pathLen;
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
float KX_NavMeshObject::Raycast(const MT_Point3& from, const MT_Point3& to)
|
2010-05-27 20:18:56 +00:00
|
|
|
{
|
|
|
|
if (!m_navMesh)
|
|
|
|
return 0.f;
|
2010-07-09 22:22:51 +00:00
|
|
|
MT_Point3 localfrom = TransformToLocalCoords(from);
|
2012-09-16 04:58:18 +00:00
|
|
|
MT_Point3 localto = TransformToLocalCoords(to);
|
2010-05-27 20:18:56 +00:00
|
|
|
float spos[3], epos[3];
|
2010-07-09 22:22:51 +00:00
|
|
|
localfrom.getValue(spos); flipAxes(spos);
|
|
|
|
localto.getValue(epos); flipAxes(epos);
|
2010-05-27 20:18:56 +00:00
|
|
|
dtStatPolyRef sPolyRef = m_navMesh->findNearestPoly(spos, polyPickExt);
|
|
|
|
float t=0;
|
|
|
|
static dtStatPolyRef polys[MAX_PATH_LEN];
|
|
|
|
m_navMesh->raycast(sPolyRef, spos, epos, t, polys, MAX_PATH_LEN);
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
void KX_NavMeshObject::DrawPath(const float *path, int pathLen, const MT_Vector3& color)
|
|
|
|
{
|
|
|
|
MT_Vector3 a,b;
|
|
|
|
for (int i=0; i<pathLen-1; i++)
|
|
|
|
{
|
|
|
|
a.setValue(&path[3*i]);
|
|
|
|
b.setValue(&path[3*(i+1)]);
|
|
|
|
KX_RasterizerDrawDebugLine(a, b, color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-03-08 03:05:57 +00:00
|
|
|
#ifdef WITH_PYTHON
|
2010-05-27 20:18:56 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//Python
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
PyTypeObject KX_NavMeshObject::Type = {
|
2010-05-27 20:18:56 +00:00
|
|
|
PyVarObject_HEAD_INIT(NULL, 0)
|
2010-05-31 22:35:22 +00:00
|
|
|
"KX_NavMeshObject",
|
2010-05-27 20:18:56 +00:00
|
|
|
sizeof(PyObjectPlus_Proxy),
|
|
|
|
0,
|
|
|
|
py_base_dealloc,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
py_base_repr,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,0,0,0,0,0,
|
|
|
|
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
|
|
|
0,0,0,0,0,0,0,
|
|
|
|
Methods,
|
|
|
|
0,
|
|
|
|
0,
|
2010-07-15 18:41:29 +00:00
|
|
|
&KX_GameObject::Type,
|
2010-05-27 20:18:56 +00:00
|
|
|
0,0,0,0,0,0,
|
|
|
|
py_base_new
|
|
|
|
};
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
PyAttributeDef KX_NavMeshObject::Attributes[] = {
|
2010-05-27 20:18:56 +00:00
|
|
|
{ NULL } //Sentinel
|
|
|
|
};
|
|
|
|
|
|
|
|
//KX_PYMETHODTABLE_NOARGS(KX_GameObject, getD),
|
2010-05-31 22:35:22 +00:00
|
|
|
PyMethodDef KX_NavMeshObject::Methods[] = {
|
|
|
|
KX_PYMETHODTABLE(KX_NavMeshObject, findPath),
|
|
|
|
KX_PYMETHODTABLE(KX_NavMeshObject, raycast),
|
|
|
|
KX_PYMETHODTABLE(KX_NavMeshObject, draw),
|
2010-07-15 18:41:29 +00:00
|
|
|
KX_PYMETHODTABLE(KX_NavMeshObject, rebuild),
|
2010-05-27 20:18:56 +00:00
|
|
|
{NULL,NULL} //Sentinel
|
|
|
|
};
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
KX_PYMETHODDEF_DOC(KX_NavMeshObject, findPath,
|
2010-05-27 20:18:56 +00:00
|
|
|
"findPath(start, goal): find path from start to goal points\n"
|
|
|
|
"Returns a path as list of points)\n")
|
|
|
|
{
|
|
|
|
PyObject *ob_from, *ob_to;
|
|
|
|
if (!PyArg_ParseTuple(args,"OO:getPath",&ob_from,&ob_to))
|
|
|
|
return NULL;
|
2010-05-31 22:35:22 +00:00
|
|
|
MT_Point3 from, to;
|
2010-05-27 20:18:56 +00:00
|
|
|
if (!PyVecTo(ob_from, from) || !PyVecTo(ob_to, to))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
float path[MAX_PATH_LEN*3];
|
|
|
|
int pathLen = FindPath(from, to, path, MAX_PATH_LEN);
|
|
|
|
PyObject *pathList = PyList_New( pathLen );
|
|
|
|
for (int i=0; i<pathLen; i++)
|
|
|
|
{
|
2010-05-31 22:35:22 +00:00
|
|
|
MT_Point3 point(&path[3*i]);
|
2010-05-27 20:18:56 +00:00
|
|
|
PyList_SET_ITEM(pathList, i, PyObjectFrom(point));
|
|
|
|
}
|
|
|
|
|
|
|
|
return pathList;
|
|
|
|
}
|
|
|
|
|
2010-05-31 22:35:22 +00:00
|
|
|
KX_PYMETHODDEF_DOC(KX_NavMeshObject, raycast,
|
2010-05-27 20:18:56 +00:00
|
|
|
"raycast(start, goal): raycast from start to goal points\n"
|
|
|
|
"Returns hit factor)\n")
|
|
|
|
{
|
|
|
|
PyObject *ob_from, *ob_to;
|
|
|
|
if (!PyArg_ParseTuple(args,"OO:getPath",&ob_from,&ob_to))
|
|
|
|
return NULL;
|
2010-05-31 22:35:22 +00:00
|
|
|
MT_Point3 from, to;
|
2010-05-27 20:18:56 +00:00
|
|
|
if (!PyVecTo(ob_from, from) || !PyVecTo(ob_to, to))
|
|
|
|
return NULL;
|
|
|
|
float hit = Raycast(from, to);
|
|
|
|
return PyFloat_FromDouble(hit);
|
|
|
|
}
|
|
|
|
|
2010-07-15 18:41:29 +00:00
|
|
|
KX_PYMETHODDEF_DOC(KX_NavMeshObject, draw,
|
|
|
|
"draw(mode): navigation mesh debug drawing\n"
|
|
|
|
"mode: WALLS, POLYS, TRIS\n")
|
2010-05-27 20:18:56 +00:00
|
|
|
{
|
2010-07-21 09:16:27 +00:00
|
|
|
int arg;
|
2010-07-15 18:41:29 +00:00
|
|
|
NavMeshRenderMode renderMode = RM_TRIS;
|
2010-07-21 09:16:27 +00:00
|
|
|
if (PyArg_ParseTuple(args,"i:rebuild",&arg) && arg>=0 && arg<RM_MAX)
|
|
|
|
renderMode = (NavMeshRenderMode)arg;
|
2010-07-15 18:41:29 +00:00
|
|
|
DrawNavMesh(renderMode);
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
KX_PYMETHODDEF_DOC_NOARGS(KX_NavMeshObject, rebuild,
|
|
|
|
"rebuild(): rebuild navigation mesh\n")
|
|
|
|
{
|
|
|
|
BuildNavMesh();
|
2010-05-27 20:18:56 +00:00
|
|
|
Py_RETURN_NONE;
|
|
|
|
}
|
|
|
|
|
2012-03-08 03:05:57 +00:00
|
|
|
#endif // WITH_PYTHON
|