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
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-09-14 06:02:58 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-09-14 06:02:58 +0400
commit63656781098e1443cd3f89fa435688727076eb33 (patch)
treedf5ba9da8daf43a3c149c9af5eb460c24f6d2974 /source/gameengine/Ketsji/KX_GameObject.h
parent9f87d9963eb8c5320c07429c1590beff54658440 (diff)
BGE: Adding a Python collision API. The initial patch was provided by agoose77, with some edits by me.
KX_GameObject now has a collisionCallbacks list which is a list of callables that are called when a collision occurs. The callables will be called with an argument that contains a reference to the other object involved in the collision (i.e., not self).
Diffstat (limited to 'source/gameengine/Ketsji/KX_GameObject.h')
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index 5a3b9df74ee..dde3ff53299 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -137,21 +137,22 @@ public:
#ifdef WITH_PYTHON
// Python attributes that wont convert into CValue
- //
+ //
// there are 2 places attributes can be stored, in the CValue,
// where attributes are converted into BGE's CValue types
// these can be used with property actuators
//
// For the python API, For types that cannot be converted into CValues (lists, dicts, GameObjects)
// these will be put into "m_attr_dict", logic bricks cannot access them.
- //
+ //
// rules for setting attributes.
- //
+ //
// * there should NEVER be a CValue and a m_attr_dict attribute with matching names. get/sets make sure of this.
// * if CValue conversion fails, use a PyObject in "m_attr_dict"
// * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue
- //
- PyObject* m_attr_dict;
+ //
+ PyObject* m_attr_dict;
+ PyObject* m_collisionCallbacks;
#endif
virtual void /* This function should be virtual - derived classed override it */
@@ -872,6 +873,9 @@ public:
* \section Logic bubbling methods.
*/
+ void RegisterCollisionCallbacks();
+ void UnregisterCollisionCallbacks();
+ void RunCollisionCallbacks(KX_GameObject *collider);
/**
* Stop making progress
*/
@@ -1040,6 +1044,8 @@ public:
static PyObject* pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+ static PyObject* pyattr_get_collisionCallbacks(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static int pyattr_set_collisionCallbacks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
/* Experimental! */
static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);