Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-31 16:17:39 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-10-31 16:17:39 +0300
commit6b677a2616a6cac3c58e79eda19080a953d68136 (patch)
treebb0680a5735467292fa7163ecdd44c80e9d265be /source/blender/python
parent3a3ac0de8f13b8c06a6c0dea63107d9d3f151f42 (diff)
own recent commit broke this python import:
from mathutils.geometry import PolyFill I couldn't find a way for python's inittab to do this so just inserting mathutils.geometry into sys.modules manually.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/mathutils.c10
-rw-r--r--source/blender/python/intern/bpy_interface.c2
2 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c
index 4f54ee9e90e..73f16cb0cf1 100644
--- a/source/blender/python/generic/mathutils.c
+++ b/source/blender/python/generic/mathutils.c
@@ -248,6 +248,7 @@ static struct PyModuleDef M_Mathutils_module_def = {
PyMODINIT_FUNC BPyInit_mathutils(void)
{
PyObject *submodule;
+ PyObject *item;
if( PyType_Ready( &vector_Type ) < 0 )
return NULL;
@@ -270,8 +271,13 @@ PyMODINIT_FUNC BPyInit_mathutils(void)
PyModule_AddObject( submodule, "Color", (PyObject *)&color_Type );
/* submodule */
- PyModule_AddObject( submodule, "geometry", BPyInit_mathutils_geometry());
-
+ PyModule_AddObject( submodule, "geometry", (item=BPyInit_mathutils_geometry()));
+ /* XXX, python doesnt do imports with this usefully yet
+ * 'from mathutils.geometry import PolyFill'
+ * ...fails without this. */
+ PyDict_SetItemString(PyThreadState_GET()->interp->modules, "mathutils.geometry", item);
+ Py_INCREF(item);
+
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
return submodule;
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index ab8a355be47..a894fa60237 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -199,6 +199,7 @@ void BPY_set_context(bContext *C)
/* init-tab */
extern PyObject *BPyInit_noise(void);
extern PyObject *BPyInit_mathutils(void);
+// extern PyObject *BPyInit_mathutils_geometry(void); // BPyInit_mathutils calls, py doesnt work with thos :S
extern PyObject *BPyInit_bgl(void);
extern PyObject *BPyInit_blf(void);
extern PyObject *AUD_initPython(void);
@@ -206,6 +207,7 @@ extern PyObject *AUD_initPython(void);
static struct _inittab bpy_internal_modules[]= {
{"noise", BPyInit_noise},
{"mathutils", BPyInit_mathutils},
+// {"mathutils.geometry", BPyInit_mathutils_geometry},
{"bgl", BPyInit_bgl},
{"blf", BPyInit_blf},
{"aud", AUD_initPython},