Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-04-23 16:25:21 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2005-04-23 16:25:21 +0400
commit0dcba86c6b631a31eadb5e8805c5c94222559e25 (patch)
tree06ab18aaeed6567bd4af7696d83f847adf5249bb /source
parent10acf20645729d7c06eec1b091a0bf21417d613f (diff)
Added the docs & use Python booleans for physics reinstance.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h12
-rw-r--r--source/gameengine/Ketsji/KX_MeshProxy.cpp2
-rw-r--r--source/gameengine/PyDoc/KX_MeshProxy.py12
3 files changed, 24 insertions, 2 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 8784d28d502..c261012a3bc 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -49,12 +49,22 @@
// 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);
};
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index b8176c05ec3..37d85816314 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -213,5 +213,5 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* self,
KX_PYMETHODDEF_DOC(KX_MeshProxy, reinstancePhysicsMesh,
"Reinstance the physics mesh.")
{
- return PyInt_FromLong(KX_ReInstanceShapeFromMesh(m_meshobj));
+ return Py_Success(KX_ReInstanceShapeFromMesh(m_meshobj));
}
diff --git a/source/gameengine/PyDoc/KX_MeshProxy.py b/source/gameengine/PyDoc/KX_MeshProxy.py
index f93cd5c1f7b..e43fa3598f0 100644
--- a/source/gameengine/PyDoc/KX_MeshProxy.py
+++ b/source/gameengine/PyDoc/KX_MeshProxy.py
@@ -95,4 +95,16 @@ class KX_MeshProxy:
@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.
+ """