Blender Git Loki

Git Commits -> Revision 9a7ea96

Revision 9a7ea96 by Campbell Barton (master)
June 29, 2009, 12:06 (GMT)
BGE PyAPI support for subclassing any BGE game type from python, scripters define extra functions on gameObjects.
Adding a UI to set the type on startup can be added easily.

# ----
class myPlayer(GameTypes.KX_GameObject):
def die(self):
# ... do stuff ...
self.endObject()

# make an instance
player = myPlayer(gameOb) # gameOb is made invalid now.
player.die()

# ----

One limitation (which could also be an advantage), is making the subclass instance will return that subclass everywhere, you cant have 2 different subclasses of the same BGE data at once.

Commit Details:

Full Hash: 9a7ea9664e27679935adaea3093630d7a6a30b5d
SVN Revision: 21234
Parent Commit: 7ca31bb
Lines Changed: +358, -434

71 Modified Paths:

/source/blender/python/intern/bpy_rna.c (+1, -1) (Diff)
/source/blender/windowmanager/intern/wm_keymap.c (+1, -1) (Diff)
/source/blender/windowmanager/WM_api.h (+1, -1) (Diff)
/source/gameengine/Converter/BL_ActionActuator.cpp (+4, -6) (Diff)
/source/gameengine/Converter/BL_ShapeActionActuator.cpp (+4, -5) (Diff)
/source/gameengine/Expressions/BoolValue.cpp (+0, -1) (Diff)
/source/gameengine/Expressions/ListValue.cpp (+6, -4) (Diff)
/source/gameengine/Expressions/PyObjectPlus.cpp (+92, -19) (Diff)
/source/gameengine/Expressions/PyObjectPlus.h (+3, -1) (Diff)
/source/gameengine/Expressions/Value.cpp (+7, -14) (Diff)
/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_ActuatorSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_AlwaysSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_ANDController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_DelaySensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_IController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_ILogicBrick.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_IObject.cpp (+4, -50) (Diff)
/source/gameengine/GameLogic/SCA_ISensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_JoystickSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_LogicManager.cpp (+1, -0) (Diff)
/source/gameengine/GameLogic/SCA_MouseSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_NANDController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_NORController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_ORController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_PropertyActuator.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_PropertySensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_PythonController.cpp (+5, -6) (Diff)
/source/gameengine/GameLogic/SCA_RandomActuator.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_RandomSensor.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_XNORController.cpp (+4, -5) (Diff)
/source/gameengine/GameLogic/SCA_XORController.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/BL_Shader.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_BlenderMaterial.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_Camera.cpp (+5, -3) (Diff)
/source/gameengine/Ketsji/KX_CameraActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_CDActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_ConstraintActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_GameActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_GameObject.cpp (+6, -4) (Diff)
/source/gameengine/Ketsji/KX_IpoActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_Light.cpp (+5, -3) (Diff)
/source/gameengine/Ketsji/KX_MeshProxy.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_NearSensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_ObjectActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_ParentActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_PolygonMaterial.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_PolyProxy.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_PyMath.h (+1, -1) (Diff)
/source/gameengine/Ketsji/KX_PythonInitTypes.cpp (+0, -49) (Diff)
/source/gameengine/Ketsji/KX_RadarSensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_RaySensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_Scene.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SceneActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_SoundActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_StateActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_TouchSensor.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_TrackToActuator.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_VehicleWrapper.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_VertexProxy.cpp (+4, -5) (Diff)
/source/gameengine/Ketsji/KX_VisibilityActuator.cpp (+4, -5) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021