[Bf-blender-cvs] [76d67b4db43] blender2.8: Merge branch 'master' into blender2.8
Campbell Barton
noreply at git.blender.org
Thu Sep 13 08:59:54 CEST 2018
Commit: 76d67b4db431591ddf18b131c462bd857950f254
Author: Campbell Barton
Date: Thu Sep 13 17:08:58 2018 +1000
Branches: blender2.8
https://developer.blender.org/rB76d67b4db431591ddf18b131c462bd857950f254
Merge branch 'master' into blender2.8
===================================================================
===================================================================
diff --cc source/blender/python/gpu/gpu_py_api.c
index fc1e7390ffe,00000000000..04a27af09f1
mode 100644,000000..100644
--- a/source/blender/python/gpu/gpu_py_api.c
+++ b/source/blender/python/gpu/gpu_py_api.c
@@@ -1,83 -1,0 +1,83 @@@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/gpu/gpu_py_api.c
+ * \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 "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 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_doc = GPU_doc,
+};
+
+PyObject *BPyInit_gpu(void)
+{
- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ PyObject *submodule;
+ PyObject *mod;
+
+ mod = PyModule_Create(&GPU_module_def);
+
+ 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;
+}
diff --cc source/blender/python/intern/bpy_interface.c
index 3ba024de7c2,123c938b921..94af148da85
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@@ -537,8 -537,7 +537,8 @@@ static bool python_script_exec
if (py_dict) {
#ifdef PYMODULE_CLEAR_WORKAROUND
- PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
+ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItem(
- PyThreadState_GET()->interp->modules, bpy_intern_str___main__);
++ PyImport_GetModuleDict(), bpy_intern_str___main__);
PyObject *dict_back = mmod->md_dict;
/* freeing the module will clear the namespace,
* gives problems running classes defined in this namespace being used later. */
More information about the Bf-blender-cvs
mailing list