diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2011-07-31 03:16:22 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2011-07-31 03:16:22 +0400 |
commit | dfc661565a4c4d1d4caa3872fb5d7936fb1f0fd8 (patch) | |
tree | 984b6fc3b1da05f0cf6b7eaaea57a1799977d038 /source/gameengine | |
parent | 6e788c37df2d5209d66bcf7e3d19bd08cd583667 (diff) |
patch [#27909] Added constants in bge.constraints by Solano Felicio (solano) + some changes in rst
I named all the BGE modules with their actual names (e.g. Rasterizer, Video Texture, ...). so in the API index.html page they look more like the other Blender modules.
I did the same for the bgl module.
For bge.constraints this patch exposes the constants values for debug mode and createConstraints (they were hardcoded innts before).
+ making all the "todo" and #comments into rst comments (.. comments)
Thanks Solano, it's great to get help to those tasks :)
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/KX_PyConstraintBinding.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index 12024657149..843dbe21995 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -38,12 +38,18 @@ #include "KX_PhysicsObjectWrapper.h" #include "PHY_IPhysicsController.h" #include "PHY_IVehicle.h" +#include "PHY_DynamicTypes.h" #include "MT_Matrix3x3.h" #include "PyObjectPlus.h" +#include "LinearMath/btIDebugDraw.h" + #ifdef WITH_PYTHON +// macro copied from KX_PythonInit.cpp +#define KX_MACRO_addTypesToDict(dict, name, name2) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name2)); Py_DECREF(item) + // nasty glob variable to connect scripting language // if there is a better way (without global), please do so! static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL; @@ -662,6 +668,7 @@ PyObject* initPythonConstraintBinding() PyObject* ErrorObject; PyObject* m; PyObject* d; + PyObject* item; /* Use existing module where possible * be careful not to init any runtime vars after this */ @@ -683,7 +690,28 @@ PyObject* initPythonConstraintBinding() PyDict_SetItemString(d, "error", ErrorObject); Py_DECREF(ErrorObject); - // XXXX Add constants here + //Debug Modes constants to be used with setDebugMode() python function + KX_MACRO_addTypesToDict(d, DBG_NODEBUG, btIDebugDraw::DBG_NoDebug); + KX_MACRO_addTypesToDict(d, DBG_DRAWWIREFRAME, btIDebugDraw::DBG_DrawWireframe); + KX_MACRO_addTypesToDict(d, DBG_DRAWAABB, btIDebugDraw::DBG_DrawAabb); + KX_MACRO_addTypesToDict(d, DBG_DRAWFREATURESTEXT, btIDebugDraw::DBG_DrawFeaturesText); + KX_MACRO_addTypesToDict(d, DBG_DRAWCONTACTPOINTS, btIDebugDraw::DBG_DrawContactPoints); + KX_MACRO_addTypesToDict(d, DBG_NOHELPTEXT, btIDebugDraw::DBG_NoHelpText); + KX_MACRO_addTypesToDict(d, DBG_DRAWTEXT, btIDebugDraw::DBG_DrawText); + KX_MACRO_addTypesToDict(d, DBG_PROFILETIMINGS, btIDebugDraw::DBG_ProfileTimings); + KX_MACRO_addTypesToDict(d, DBG_ENABLESATCOMPARISION, btIDebugDraw::DBG_EnableSatComparison); + KX_MACRO_addTypesToDict(d, DBG_DISABLEBULLETLCP, btIDebugDraw::DBG_DisableBulletLCP); + KX_MACRO_addTypesToDict(d, DBG_ENABLECDD, btIDebugDraw::DBG_EnableCCD); + KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTS, btIDebugDraw::DBG_DrawConstraints); + KX_MACRO_addTypesToDict(d, DBG_DRAWCONSTRAINTLIMITS, btIDebugDraw::DBG_DrawConstraintLimits); + KX_MACRO_addTypesToDict(d, DBG_FASTWIREFRAME, btIDebugDraw::DBG_FastWireframe); + + //Constraint types to be used with createConstraint() python function + KX_MACRO_addTypesToDict(d, POINTTOPOINT_CONSTRAINT, PHY_POINT2POINT_CONSTRAINT); + KX_MACRO_addTypesToDict(d, LINEHINGE_CONSTRAINT, PHY_LINEHINGE_CONSTRAINT); + KX_MACRO_addTypesToDict(d, ANGULAR_CONSTRAINT, PHY_ANGULAR_CONSTRAINT); + KX_MACRO_addTypesToDict(d, CONETWIST_CONSTRAINT, PHY_CONE_TWIST_CONSTRAINT); + KX_MACRO_addTypesToDict(d, VEHICLE_CONSTRAINT, PHY_VEHICLE_CONSTRAINT); // Check for errors if (PyErr_Occurred()) |