<p>Hi, <br>
Only to remark that the author of this patch is Quentin Wenger (Matpi). </p>
<p>I know that after phabricator update is more difficult to find the author's mail which it is necessary to give correct acknowledgement using git.<br>
Perhaps, the easiest way is to modify the commit log including an author field.</p>
<p>Regards,<br>
Jorge<br>
</p>
<div class="gmail_quote">El 15/06/2015 21:47, "Porteries Tristan" <<a href="mailto:noreply@git.blender.org">noreply@git.blender.org</a>> escribió:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Commit: 1c707a239258996e4f5a5873517ff34564eaf8da<br>
Author: Porteries Tristan<br>
Date: Mon Jun 15 21:20:47 2015 +0200<br>
Branches: master<br>
<a href="https://developer.blender.org/rB1c707a239258996e4f5a5873517ff34564eaf8da" rel="noreferrer" target="_blank">https://developer.blender.org/rB1c707a239258996e4f5a5873517ff34564eaf8da</a><br>
<br>
BGE: Fix T43918: adding submodule bge.app including attribute version.<br>
<br>
This patch adds the submodule app to bge. apps contains constants similar to bpy.app, particularly version (tuple of three ints like 2.75.1).<br>
<br>
It was requested in T43918 and set as TODO.<br>
<br>
The patch also adds rst doc for the module.<br>
<br>
Reviewers: moguri, kupoman, lordloki, panzergame, campbellbarton<br>
<br>
Reviewed By: lordloki, panzergame, campbellbarton<br>
<br>
Subscribers: marcino15<br>
<br>
Projects: #game_logic, #game_python, #game_engine<br>
<br>
Differential Revision: <a href="https://developer.blender.org/D1348" rel="noreferrer" target="_blank">https://developer.blender.org/D1348</a><br>
<br>
===================================================================<br>
<br>
A doc/python_api/rst/bge.app.rst<br>
M doc/python_api/sphinx_doc_gen.py<br>
M source/gameengine/Ketsji/KX_PythonInit.cpp<br>
M source/gameengine/Ketsji/KX_PythonInit.h<br>
<br>
===================================================================<br>
<br>
diff --git a/doc/python_api/rst/bge.app.rst b/doc/python_api/rst/bge.app.rst<br>
new file mode 100644<br>
index 0000000..a0c2cf3<br>
--- /dev/null<br>
+++ b/doc/python_api/rst/bge.app.rst<br>
@@ -0,0 +1,47 @@<br>
+<br>
+Application Data (bge.app)<br>
+==========================<br>
+<br>
+Module to access application values that remain unchanged during runtime.<br>
+<br>
+.. module:: bge.app<br>
+<br>
+.. data:: version<br>
+<br>
+ The Blender/BGE version as a tuple of 3 ints, eg. (2, 75, 1).<br>
+<br>
+ .. note:: Version tuples can be compared simply with (in)equality symbols;<br>
+ for example, ``(2, 74, 5) <= (2, 75, 0)`` returns True (lexical order).<br>
+<br>
+ :type: tuple of three ints<br>
+<br>
+.. data:: version_string<br>
+<br>
+ The Blender/BGE version formatted as a string, eg. "2.75 (sub 1)".<br>
+<br>
+ :type: str<br>
+<br>
+.. data:: version_char<br>
+<br>
+ The Blender/BGE version character (for minor releases).<br>
+<br>
+ :type: str<br>
+<br>
+.. data:: has_texture_ffmpeg<br>
+<br>
+ True if the BGE has been built with FFmpeg support, enabling use of :class:`~bge.texture.ImageFFmpeg` and :class:`~bge.texture.VideoFFmpeg`.<br>
+<br>
+ :type: bool<br>
+<br>
+.. data:: has_joystick<br>
+<br>
+ True if the BGE has been built with joystick support.<br>
+<br>
+ :type: bool<br>
+<br>
+.. data:: has_physics<br>
+<br>
+ True if the BGE has been built with physics support.<br>
+<br>
+ :type: bool<br>
+<br>
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py<br>
index e5ce4c7..32776ef 100644<br>
--- a/doc/python_api/sphinx_doc_gen.py<br>
+++ b/doc/python_api/sphinx_doc_gen.py<br>
@@ -234,6 +234,7 @@ else:<br>
EXCLUDE_MODULES = [<br>
"aud",<br>
"bge",<br>
+ "bge.app"<br>
"bge.constraints",<br>
"bge.events",<br>
"bge.logic",<br>
@@ -1669,6 +1670,7 @@ def write_rst_contents(basepath):<br>
fw(" bge.texture.rst\n\n")<br>
fw(" bge.events.rst\n\n")<br>
fw(" bge.constraints.rst\n\n")<br>
+ fw(" bge.app.rst\n\n")<br>
<br>
# rna generated change log<br>
fw(title_string("API Info", "=", double=True))<br>
@@ -1825,6 +1827,7 @@ def copy_handwritten_rsts(basepath):<br>
"bge.texture",<br>
"bge.events",<br>
"bge.constraints",<br>
+ "bge.app",<br>
"bgl", # "Blender OpenGl wrapper"<br>
"gpu", # "GPU Shader Module"<br>
<br>
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp<br>
index 80e56a4..a5fb2de 100644<br>
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp<br>
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp<br>
@@ -138,6 +138,7 @@ extern "C" {<br>
#include "BKE_global.h"<br>
#include "BKE_library.h"<br>
#include "BKE_appdir.h"<br>
+#include "BKE_blender.h"<br>
#include "BLI_blenlib.h"<br>
#include "GPU_material.h"<br>
#include "MEM_guardedalloc.h"<br>
@@ -2027,6 +2028,11 @@ PyMODINIT_FUNC initBGE(void)<br>
/* skip "bge." */<br>
#define SUBMOD (mod_full + 4)<br>
<br>
+ mod_full = "bge.app";<br>
+ PyModule_AddObject(mod, SUBMOD, (submodule = initApplicationPythonBinding()));<br>
+ PyDict_SetItemString(sys_modules, mod_full, submodule);<br>
+ Py_INCREF(submodule);<br>
+<br>
mod_full = "bge.constraints";<br>
PyModule_AddObject(mod, SUBMOD, (submodule = initConstraintPythonBinding()));<br>
PyDict_SetItemString(sys_modules, mod_full, submodule);<br>
@@ -2550,6 +2556,77 @@ PyMODINIT_FUNC initGameKeysPythonBinding()<br>
return m;<br>
}<br>
<br>
+<br>
+<br>
+/* ------------------------------------------------------------------------- */<br>
+/* Application: application values that remain unchanged during runtime */<br>
+/* ------------------------------------------------------------------------- */<br>
+<br>
+PyDoc_STRVAR(Application_module_documentation,<br>
+ "This module contains application values that remain unchanged during runtime."<br>
+ );<br>
+<br>
+static struct PyModuleDef Application_module_def = {<br>
+ PyModuleDef_HEAD_INIT,<br>
+ "bge.app", /* m_name */<br>
+ Application_module_documentation, /* m_doc */<br>
+ 0, /* m_size */<br>
+ NULL, /* m_methods */<br>
+ 0, /* m_reload */<br>
+ 0, /* m_traverse */<br>
+ 0, /* m_clear */<br>
+ 0, /* m_free */<br>
+};<br>
+<br>
+PyMODINIT_FUNC initApplicationPythonBinding()<br>
+{<br>
+ PyObject *m;<br>
+ PyObject *d;<br>
+<br>
+ m = PyModule_Create(&Application_module_def);<br>
+<br>
+ // Add some symbolic constants to the module<br>
+ d = PyModule_GetDict(m);<br>
+<br>
+ PyDict_SetItemString(d, "version", Py_BuildValue("(iii)",<br>
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));<br>
+ PyDict_SetItemString(d, "version_string", PyUnicode_FromFormat("%d.%02d (sub %d)",<br>
+ BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));<br>
+ PyDict_SetItemString(d, "version_char", PyUnicode_FromString(<br>
+ STRINGIFY(BLENDER_VERSION_CHAR)));<br>
+<br>
+ PyDict_SetItemString(d, "has_texture_ffmpeg",<br>
+#ifdef WITH_FFMPEG<br>
+ Py_True<br>
+#else<br>
+ Py_False<br>
+#endif<br>
+ );<br>
+ PyDict_SetItemString(d, "has_joystick",<br>
+#ifdef WITH_SDL<br>
+ Py_True<br>
+#else<br>
+ Py_False<br>
+#endif<br>
+ );<br>
+ PyDict_SetItemString(d, "has_physics",<br>
+#ifdef WITH_BULLET<br>
+ Py_True<br>
+#else<br>
+ Py_False<br>
+#endif<br>
+ );<br>
+<br>
+ // Check for errors<br>
+ if (PyErr_Occurred()) {<br>
+ PyErr_Print();<br>
+ PyErr_Clear();<br>
+ }<br>
+<br>
+ return m;<br>
+}<br>
+<br>
+<br>
// utility function for loading and saving the globalDict<br>
int saveGamePythonConfig( char **marshal_buffer)<br>
{<br>
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h<br>
index f74a4b3..06aeb5a 100644<br>
--- a/source/gameengine/Ketsji/KX_PythonInit.h<br>
+++ b/source/gameengine/Ketsji/KX_PythonInit.h<br>
@@ -48,6 +48,7 @@ extern bool gUseVisibilityTemp;<br>
<br>
#ifdef WITH_PYTHON<br>
PyMODINIT_FUNC initBGE(void);<br>
+PyMODINIT_FUNC initApplicationPythonBinding(void);<br>
PyMODINIT_FUNC initGameLogicPythonBinding(void);<br>
PyMODINIT_FUNC initGameKeysPythonBinding(void);<br>
PyMODINIT_FUNC initRasterizerPythonBinding(void);<br>
<br>
_______________________________________________<br>
Bf-blender-cvs mailing list<br>
<a href="mailto:Bf-blender-cvs@blender.org">Bf-blender-cvs@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-blender-cvs" rel="noreferrer" target="_blank">http://lists.blender.org/mailman/listinfo/bf-blender-cvs</a><br>
</blockquote></div>