diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 02:07:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-04 02:07:58 +0400 |
commit | 1531e3677a639b9265d26d73e3bc5ee21e996af8 (patch) | |
tree | 4eaa8230aefc3a9071dc4d1359244aade8156e12 /source/blender/python/generic | |
parent | 685fda4f13715ccadb32fa72af1b557cb55c9574 (diff) |
bmesh py api
* add BLI_rfindlink for reverse index lookup (used so bm.select_history[-1] doesn't have to loop the entire list twice).
* add bm.select_history.active so you can get the last selected item or None without having to check seq length.
Diffstat (limited to 'source/blender/python/generic')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 499a691156b..cf352504f71 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -50,11 +50,11 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length, Py_ssize_t value_len; Py_ssize_t i; - if (!(value_fast=PySequence_Fast(value, error_prefix))) { + if (!(value_fast = PySequence_Fast(value, error_prefix))) { return -1; } - value_len= PySequence_Fast_GET_SIZE(value_fast); + value_len = PySequence_Fast_GET_SIZE(value_fast); if (value_len != length) { Py_DECREF(value); @@ -69,13 +69,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length, if (is_double) { double *array_double= array; for (i=0; i<length; i++) { - array_double[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i)); + array_double[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i)); } } else { float *array_float= array; for (i=0; i<length; i++) { - array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i)); + array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i)); } } } @@ -83,13 +83,13 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length, /* could use is_double for 'long int' but no use now */ int *array_int= array; for (i=0; i<length; i++) { - array_int[i]= PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)); + array_int[i] = PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)); } } else if (type == &PyBool_Type) { int *array_bool= array; for (i=0; i<length; i++) { - array_bool[i]= (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0); + array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0); } } else { |