diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-31 16:17:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-31 16:17:39 +0300 |
commit | 6b677a2616a6cac3c58e79eda19080a953d68136 (patch) | |
tree | bb0680a5735467292fa7163ecdd44c80e9d265be /source/blender | |
parent | 3a3ac0de8f13b8c06a6c0dea63107d9d3f151f42 (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')
-rw-r--r-- | source/blender/blenkernel/BKE_utildefines.h | 2 | ||||
-rw-r--r-- | source/blender/python/generic/mathutils.c | 10 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index a7b4a71c84d..a1968459fd6 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -282,7 +282,7 @@ behaviour, though it may not be the best in practice. #elif defined(__GNUC__) #define BM_INLINE static inline __attribute((always_inline)) #else -#warning "MSC/GNUC defines not found, inline non-functional" +/* #warning "MSC/GNUC defines not found, inline non-functional" */ #define BM_INLINE static #endif 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}, |