diff options
Diffstat (limited to 'source/blender/python/intern/gpu.c')
-rw-r--r-- | source/blender/python/intern/gpu.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index a7ece10f06c..66c1ddcc352 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -32,11 +32,6 @@ * from blender materials. */ -/* python redefines */ -#ifdef _POSIX_C_SOURCE -#undef _POSIX_C_SOURCE -#endif - #include <Python.h> #include "DNA_scene_types.h" @@ -60,7 +55,7 @@ #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, # name, name) PyDoc_STRVAR(M_gpu_doc, -"This module provides access to the GLSL shader." +"This module provides access to the GLSL shader and Offscreen rendering functionalities." ); static struct PyModuleDef gpumodule = { PyModuleDef_HEAD_INIT, @@ -102,6 +97,8 @@ static PyObject *PyInit_gpu(void) PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_MAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_VIEWIMAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_IMAT); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_LOCTOVIEWMAT); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_LOCTOVIEWIMAT); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_COLOR); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE); /* GPU_DYNAMIC_GROUP_LAMP */ @@ -116,6 +113,7 @@ static PyObject *PyInit_gpu(void) PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_DISTANCE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTSIZE); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTBLEND); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_LAMP_SPOTSCALE); /* GPU_DYNAMIC_GROUP_SAMPLER */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DBUFFER); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_SAMPLER_2DIMAGE); @@ -130,6 +128,7 @@ static PyObject *PyInit_gpu(void) /* GPU_DYNAMIC_GROUP_WORLD */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_HORIZON_COLOR); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_AMBIENT_COLOR); + PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_ZENITH_COLOR); /* GPU_DYNAMIC_GROUP_MAT */ PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_DIFFRGB); PY_MODULE_ADD_CONSTANT(m, GPU_DYNAMIC_MAT_REF); @@ -313,12 +312,25 @@ static PyMethodDef meth_export_shader[] = { {"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc} }; +/* -------------------------------------------------------------------- */ +/* Initialize Module */ + PyObject *GPU_initPython(void) { - PyObject *module = PyInit_gpu(); + PyObject *module; + PyObject *submodule; + PyObject *sys_modules = PyThreadState_GET()->interp->modules; + + module = PyInit_gpu(); + PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL)); - PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module); + /* gpu.offscreen */ + PyModule_AddObject(module, "offscreen", (submodule = BPyInit_gpu_offscreen())); + PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule); + Py_INCREF(submodule); + + PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module); return module; } |