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:
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r--source/blender/python/mathutils/mathutils.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 41c1568dbde..121c5e26e73 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -39,7 +39,9 @@
PyDoc_STRVAR(M_Mathutils_doc,
"This module provides access to matrices, eulers, quaternions and vectors."
);
-static int mathutils_array_parse_fast(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix)
+static int mathutils_array_parse_fast(float *array,
+ int array_min, int array_max,
+ PyObject *value, const char *error_prefix)
{
PyObject *value_fast= NULL;
PyObject *item;
@@ -72,7 +74,9 @@ static int mathutils_array_parse_fast(float *array, int array_min, int array_max
i= size;
do {
i--;
- if (((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) && PyErr_Occurred()) {
+ if ( ((array[i]= PyFloat_AsDouble((item= PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+ PyErr_Occurred())
+ {
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
"found '%.200s' type, ",
@@ -347,6 +351,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
{
PyObject *submodule;
PyObject *item;
+ PyObject *sys_modules= PyThreadState_GET()->interp->modules;
if (PyType_Ready(&vector_Type) < 0)
return NULL;
@@ -373,7 +378,12 @@ PyMODINIT_FUNC PyInit_mathutils(void)
/* 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);
+ PyDict_SetItemString(sys_modules, "mathutils.geometry", item);
+ Py_INCREF(item);
+
+ /* Noise submodule */
+ PyModule_AddObject(submodule, "noise", (item=PyInit_mathutils_noise()));
+ PyDict_SetItemString(sys_modules, "mathutils.noise", item);
Py_INCREF(item);
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);