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>2014-12-30 14:47:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2014-12-30 14:49:52 +0300
commitcefb76426980b763bbf68f022fc0df8aec8a25bd (patch)
tree2fcd4f3329109a96fd46eb7cbec7e4631b24c4fc /source/blender/python/mathutils/mathutils.c
parent68600920ced198eaa1524993f988f26118402e50 (diff)
PyAPI: geometry.normal, support polygons
Previously this only supported tri/quads, now arbitrary size poly lines are supported.
Diffstat (limited to 'source/blender/python/mathutils/mathutils.c')
-rw-r--r--source/blender/python/mathutils/mathutils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 5c3f38e2c12..8aaf47f090f 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -72,7 +72,7 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
const int flag = array_max;
int size;
- array_max &= ~(MU_ARRAY_ZERO | MU_ARRAY_SPILL);
+ array_max &= ~MU_ARRAY_FLAGS;
#if 1 /* approx 6x speedup for mathutils types */
@@ -217,6 +217,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value, const char *error_prefix)
{
PyObject *value_fast = NULL;
+ const int array_dim_flag = array_dim;
int i, size;
/* non list/tuple cases */
@@ -230,12 +231,14 @@ int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value,
if (size != 0) {
float *fp;
+ array_dim &= ~MU_ARRAY_FLAGS;
+
fp = *array = PyMem_Malloc(size * array_dim * sizeof(float));
for (i = 0; i < size; i++, fp += array_dim) {
PyObject *item = PySequence_Fast_GET_ITEM(value, i);
- if (mathutils_array_parse(fp, array_dim, array_dim, item, error_prefix) == -1) {
+ if (mathutils_array_parse(fp, array_dim, array_dim_flag, item, error_prefix) == -1) {
PyMem_Free(*array);
*array = NULL;
size = -1;