Commit: a7b0330c1382cec8a15d3f4067b6293b5c41269b Author: Ines Almeida Date: Fri Jun 6 07:43:23 2014 +0100 Branches: master https://developer.blender.org/rBa7b0330c1382cec8a15d3f4067b6293b5c41269b
BGE: python API cleanup - using PyDoc_STRVAR instead of static char* Cherry-picking d503f8a onto 117edbb Conflicts: source/gameengine/Ketsji/KX_PythonInit.cpp =================================================================== M source/gameengine/Ketsji/KX_PyConstraintBinding.cpp M source/gameengine/Ketsji/KX_PythonInit.cpp M source/gameengine/VideoTexture/blendVideoTex.cpp =================================================================== diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp index ebf1b9e..e970e87 100644 --- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp +++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp @@ -56,38 +56,95 @@ // if there is a better way (without global), please do so! static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL; -static char PhysicsConstraints_module_documentation[] = -"This is the Python API for the Physics Constraints"; - - -static char gPySetGravity__doc__[] = "setGravity(float x,float y,float z)"; -static char gPySetDebugMode__doc__[] = "setDebugMode(int mode)"; - -static char gPySetNumIterations__doc__[] = "setNumIterations(int numiter) This sets the number of iterations for an iterative constraint solver"; -static char gPySetNumTimeSubSteps__doc__[] = "setNumTimeSubSteps(int numsubstep) This sets the number of substeps for each physics proceed. Tradeoff quality for performance."; - - -static char gPySetDeactivationTime__doc__[] = "setDeactivationTime(float time) This sets the time after which a resting rigidbody gets deactived"; -static char gPySetDeactivationLinearTreshold__doc__[] = "setDeactivationLinearTreshold(float linearTreshold)"; -static char gPySetDeactivationAngularTreshold__doc__[] = "setDeactivationAngularTreshold(float angularTreshold)"; -static char gPySetContactBreakingTreshold__doc__[] = "setContactBreakingTreshold(float breakingTreshold) Reasonable default is 0.02 (if units are meters)"; - -static char gPySetCcdMode__doc__[] = "setCcdMode(int ccdMode) Very experimental, not recommended"; -static char gPySetSorConstant__doc__[] = "setSorConstant(float sor) Very experimental, not recommended"; -static char gPySetSolverTau__doc__[] = "setTau(float tau) Very experimental, not recommended"; -static char gPySetSolverDamping__doc__[] = "setDamping(float damping) Very experimental, not recommended"; -static char gPySetLinearAirDamping__doc__[] = "setLinearAirDamping(float damping) Very experimental, not recommended"; -static char gPySetUseEpa__doc__[] = "setUseEpa(int epa) Very experimental, not recommended"; -static char gPySetSolverType__doc__[] = "setSolverType(int solverType) Very experimental, not recommended"; - - -static char gPyCreateConstraint__doc__[] = "createConstraint(ob1,ob2,float restLength,float restitution,float damping)"; -static char gPyGetVehicleConstraint__doc__[] = "getVehicleConstraint(int constraintId)"; -static char gPyGetCharacter__doc__[] = "getCharacter(KX_GameObject obj)"; -static char gPyRemoveConstraint__doc__[] = "removeConstraint(int constraintId)"; -static char gPyGetAppliedImpulse__doc__[] = "getAppliedImpulse(int constraintId)"; - +PyDoc_STRVAR(PhysicsConstraints_module_documentation, +"This is the Python API for the Physics Constraints" +); + +PyDoc_STRVAR(gPySetGravity__doc__, +"setGravity(float x,float y,float z)\n" +"" +); +PyDoc_STRVAR(gPySetDebugMode__doc__, +"setDebugMode(int mode)\n" +"" +); + +PyDoc_STRVAR(gPySetNumIterations__doc__, +"setNumIterations(int numiter)\n" +"This sets the number of iterations for an iterative constraint solver" +); +PyDoc_STRVAR(gPySetNumTimeSubSteps__doc__, +"setNumTimeSubSteps(int numsubstep)\n" +"This sets the number of substeps for each physics proceed. Tradeoff quality for performance." +); + +PyDoc_STRVAR(gPySetDeactivationTime__doc__, +"setDeactivationTime(float time)\n" +"This sets the time after which a resting rigidbody gets deactived" +); +PyDoc_STRVAR(gPySetDeactivationLinearTreshold__doc__, +"setDeactivationLinearTreshold(float linearTreshold)\n" +"" +); +PyDoc_STRVAR(gPySetDeactivationAngularTreshold__doc__, +"setDeactivationAngularTreshold(float angularTreshold)\n" +"" +); +PyDoc_STRVAR(gPySetContactBreakingTreshold__doc__, +"setContactBreakingTreshold(float breakingTreshold)\n" +"Reasonable default is 0.02 (if units are meters)" +); + +PyDoc_STRVAR(gPySetCcdMode__doc__, +"setCcdMode(int ccdMode)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetSorConstant__doc__, +"setSorConstant(float sor)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetSolverTau__doc__, +"setTau(float tau)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetSolverDamping__doc__, +"setDamping(float damping)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetLinearAirDamping__doc__, +"setLinearAirDamping(float damping)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetUseEpa__doc__, +"setUseEpa(int epa)\n" +"Very experimental, not recommended" +); +PyDoc_STRVAR(gPySetSolverType__doc__, +"setSolverType(int solverType)\n" +"Very experimental, not recommended" +); + +PyDoc_STRVAR(gPyCreateConstraint__doc__, +"createConstraint(ob1,ob2,float restLength,float restitution,float damping)\n" +"" +); +PyDoc_STRVAR(gPyGetVehicleConstraint__doc__, +"getVehicleConstraint(int constraintId)\n" +"" +); +PyDoc_STRVAR(gPyGetCharacter__doc__, +"getCharacter(KX_GameObject obj)\n" +"" +); +PyDoc_STRVAR(gPyRemoveConstraint__doc__, +"removeConstraint(int constraintId)\n" +"" +); +PyDoc_STRVAR(gPyGetAppliedImpulse__doc__, +"getAppliedImpulse(int constraintId)\n" +"" +); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 7819eb7..641a038 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -223,8 +223,11 @@ static void KX_MACRO_addTypesToDict_fn(PyObject *dict, const char *name, long va // List of methods defined in the module static PyObject *ErrorObject; -static const char *gPyGetRandomFloat_doc="getRandomFloat returns a random floating point value in the range [0..1]"; +PyDoc_STRVAR(gPyGetRandomFloat_doc, +"getRandomFloat()\n" +"returns a random floating point value in the range [0..1]" +); static PyObject *gPyGetRandomFloat(PyObject *) { return PyFloat_FromDouble(MT_random()); @@ -242,15 +245,15 @@ static PyObject *gPySetGravity(PyObject *, PyObject *value) Py_RETURN_NONE; } -static char gPyExpandPath_doc[] = -"(path) - Converts a blender internal path into a proper file system path.\n\ -path - the string path to convert.\n\n\ -Use / as directory separator in path\n\ -You can use '//' at the start of the string to define a relative path;\n\ -Blender replaces that string by the directory of the current .blend or runtime\n\ -file to make a full path name.\n\ -The function also converts the directory separator to the local file system format."; - +PyDoc_STRVAR(gPyExpandPath_doc, +"expandPath(path)\n" +"Converts a blender internal path into a proper file system path.\n" +" path - the string path to convert.\n" +"Use / as directory separator in path\n" +"You can use '//' at the start of the string to define a relative path." +"Blender replaces that string by the directory of the current .blend or runtime file to make a full path name.\n" +"The function also converts the directory separator to the local file system format." +); static PyObject *gPyExpandPath(PyObject *, PyObject *args) { char expanded[FILE_MAX]; @@ -264,10 +267,10 @@ static PyObject *gPyExpandPath(PyObject *, PyObject *args) return PyC_UnicodeFromByte(expanded); } -static char gPyStartGame_doc[] = -"startGame(blend)\n\ -Loads the blend file"; - +PyDoc_STRVAR(gPyStartGame_doc, +"startGame(blend)\n" +"Loads the blend file" +); static PyObject *gPyStartGame(PyObject *, PyObject *args) { char* blendfile; @@ -281,10 +284,10 @@ static PyObject *gPyStartGame(PyObject *, PyObject *args) Py_RETURN_NONE; } -static char gPyEndGame_doc[] = -"endGame()\n\ -Ends the current game"; - +PyDoc_STRVAR(gPyEndGame_doc, +"endGame()\n" +"Ends the current game" +); static PyObject *gPyEndGame(PyObject *) { gp_KetsjiEngine->RequestExit(KX_EXIT_REQUEST_QUIT_GAME); @@ -294,10 +297,10 @@ static PyObject *gPyEndGame(PyObject *) Py_RETURN_NONE; } -static char gPyRestartGame_doc[] = -"restartGame()\n\ -Restarts the current game by reloading the .blend file"; - +PyDoc_STRVAR(gPyRestartGame_doc, +"restartGame()\n" +"Restarts the current game by reloading the .blend file" +); static PyObject *gPyRestartGame(PyObject *) { gp_KetsjiEngine->RequestExit(KX_EXIT_REQUEST_RESTART_GAME); @@ -306,10 +309,10 @@ static PyObject *gPyRestartGame(PyObject *) Py_RETURN_NONE; } -static char gPySaveGlobalDict_doc[] = - "saveGlobalDict()\n" - "Saves bge.logic.globalDict to a file"; - +PyDoc_STRVAR(gPySaveGlobalDict_doc, +"saveGlobalDict()\n" +"Saves bge.logic.globalDict to a file" +); static PyObject *gPySaveGlobalDict(PyObject *) { char marshal_path[512]; @@ -343,10 +346,10 @@ static PyObject *gPySaveGlobalDict(PyObject *) Py_RETURN_NONE; } -static char gPyLoadGlobalDict_doc[] = - "LoadGlobalDict()\n" - "Loads bge.logic.globalDict from a file"; - +PyDoc_STRVAR(gPyLoadGlobalDict_doc, +"LoadGlobalDict()\n" +"Loads bge.logic.globalDict from a file" +); static PyObject *gPyLoadGlobalDict(PyObject *) { char marshal_path[512]; @@ -384,23 +387,23 @@ static PyObject *gPyLoadGlobalDict(PyObject *) Py_RETURN_NONE; } -static char gPyGetProfileInfo_doc[] = +PyDoc_STRVAR(gPyGetProfileInfo_doc, "getProfileInfo()\n" -"returns a dictionary with profiling information"; - +"returns a dictionary with profiling information" +); static PyObject *gPyGetProfileInfo(PyObject *) { return gp_KetsjiEngine->GetPyProfileDict(); } -static char gPySendMessage_doc[] = -"sendMessage(subject, [body, to, from])\n\ -sends a message in same manner as a message actuator\ -subject = Subject of the message\ -body = Message body\ -to = Name of object to send the message to\ -from = Name of object to send the string from"; - +PyDoc_STRVAR(gPySendMessage_doc, +"sendMessage(subject, [body, to, from])\n" +"sends a message in same manner as a message actuator" +" subject = Subject of the message" +" body = Message body" +" to = Name of object to send the message to" +" from = Name of object to send the string from" +); static PyObject *gPySendMessage(PyObject *, PyObject *args) { char* subject; @@ -560,11 +563,12 @@ static PyObject *gPyGetBlendFileList(PyObject *, PyObject *args) return list; } -static char gPyAddScene_doc[] = -"addScene(name, [ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs