// some basic python macros
#define Py_NEWARGS 1
#define Py_Return { Py_INCREF(Py_None); return Py_None;}
+static inline PyObject* Py_Success(bool truth)
+{
+ if (truth)
+ {
+ Py_INCREF(Py_True);
+ return Py_True;
+ }
+ Py_INCREF(Py_False);
+ return Py_False;
+}
#define Py_Error(E, M) {PyErr_SetString(E, M); return NULL;}
#define Py_Try(F) {if (!(F)) return NULL;}
#define Py_Assert(A,E,M) {if (!(A)) {PyErr_SetString(E, M); return NULL;}}
-inline void Py_Fatal(char *M) {
+static inline void Py_Fatal(char *M) {
//cout << M << endl;
exit(-1);
};
KX_PYMETHODDEF_DOC(KX_MeshProxy, reinstancePhysicsMesh,
"Reinstance the physics mesh.")
{
- return PyInt_FromLong(KX_ReInstanceShapeFromMesh(m_meshobj));
+ return Py_Success(KX_ReInstanceShapeFromMesh(m_meshobj));
}
@rtype: L{KX_VertexProxy}
@return: a vertex object.
"""
+ def reinstancePhysicsMesh():
+ """
+ Updates the physics system with the changed mesh.
+
+ A mesh must have only one material with collision flags,
+ and have all collision primitives in one vertex array (ie. < 65535 verts) and
+ be either a polytope or polyheder mesh. If you don't get a warning in the
+ console when the collision type is polytope, the mesh is suitable for reinstance.
+
+ @rtype: boolean
+ @return: True if reinstance succeeded, False if it failed.
+ """