Join the python modules gpu and _gpu into one.

Maybe it's still early to set the new drawing api for python.
But joining these two modules is an initial step.

```
>>> gpu.
        matrix
        select
        types
```
```
>>> gpu.types.GPU
                 Batch(
                 OffScreen(
                 VertBuf(
                 VertFormat(
```
The creation of a new offscreen object is now done by the `GPUOffscreen.__new__` method.

Reviewers: campbellbarton, dfelinto

Reviewed By: campbellbarton, dfelinto

Tags: #bf_blender_2.8

Differential Revision: https://developer.blender.org/D3667
This commit is contained in:
2018-09-05 21:10:42 -03:00
parent b060248324
commit 6d04e48539
22 changed files with 1726 additions and 1000 deletions

View File

@@ -19,31 +19,44 @@
*/
/** \file blender/python/gpu/gpu_py_api.c
* \ingroup pygpu
* \ingroup bpygpu
*
* Experimental Python API, not considered public yet (called '_gpu'),
* we may re-expose as public later.
*
* - Use ``bpygpu_`` for local API.
* - Use ``BPyGPU`` for public API.
*/
#include <Python.h>
#include "GPU_batch.h"
#include "GPU_vertex_format.h"
#include "gpu_py_api.h"
#include "gpu_py_types.h"
#include "BLI_utildefines.h"
#include "../generic/python_utildefines.h"
#include "gpu_py_matrix.h"
#include "gpu_py_select.h"
#include "gpu_py_types.h"
#include "gpu_py_api.h" /* own include */
PyDoc_STRVAR(GPU_doc,
"This module provides access to gpu drawing functions."
"This module to provide functions concerning the GPU implementation in Blender."
"\n\n"
"Submodules:\n"
"\n"
".. toctree::\n"
" :maxdepth: 1\n"
"\n"
" gpu.types.rst\n"
" gpu.matrix.rst\n"
" gpu.select.rst\n"
"\n"
);
static struct PyModuleDef GPU_module_def = {
PyModuleDef_HEAD_INIT,
.m_name = "_gpu", /* m_name */
.m_doc = GPU_doc, /* m_doc */
.m_name = "gpu",
.m_doc = GPU_doc,
};
PyObject *BPyInit_gpu(void)
@@ -54,10 +67,17 @@ PyObject *BPyInit_gpu(void)
mod = PyModule_Create(&GPU_module_def);
/* _gpu.types */
PyModule_AddObject(mod, "types", (submodule = BPyInit_gpu_types()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
Py_INCREF(submodule);
PyModule_AddObject(mod, "matrix", (submodule = BPyInit_gpu_matrix()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
Py_INCREF(submodule);
PyModule_AddObject(mod, "select", (submodule = BPyInit_gpu_select()));
PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
Py_INCREF(submodule);
return mod;
}