[Bf-committers] [Bf-blender-cvs] [1c707a2] master: BGE: Fix T43918: adding submodule bge.app including attribute version.

Jorge Bernal jbernalmartinez at gmail.com
Mon Jun 15 23:15:40 CEST 2015


Hi,
Only to remark that the author of this patch is Quentin Wenger (Matpi).

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.
Perhaps, the easiest way is to modify the commit log including an author
field.

Regards,
Jorge
 El 15/06/2015 21:47, "Porteries Tristan" <noreply at git.blender.org>
escribió:

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


More information about the Bf-committers mailing list