[Bf-blender-cvs] [89c978b] custom-normals-bmesh: Use PySequence_Fast_ITEMS for direct access
Campbell Barton
noreply at git.blender.org
Thu Jun 9 17:15:28 CEST 2016
Commit: 89c978b14f72128defd484ec78ec0b8853233d7b
Author: Campbell Barton
Date: Fri Jun 10 01:16:50 2016 +1000
Branches: custom-normals-bmesh
https://developer.blender.org/rB89c978b14f72128defd484ec78ec0b8853233d7b
Use PySequence_Fast_ITEMS for direct access
===================================================================
M source/blender/python/bmesh/bmesh_py_types_customdata.c
===================================================================
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 27707d9..32cd068 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -361,9 +361,11 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj
return NULL;
}
+ PyObject **value_items = PySequence_Fast_ITEMS(value);
+
vec_size = 3; /* In case value is an array of None's only. */
for (Py_ssize_t i = 0; i < nbr_val; i++) {
- PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i);
+ PyObject *py_vec = value_items[i];
if (py_vec == Py_None) {
continue;
@@ -389,7 +391,7 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj
if (vec_size == 2) {
clnors = MEM_mallocN(sizeof(*clnors) * nbr_val, __func__);
for (Py_ssize_t i = 0; i < nbr_val; i++) {
- PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i);
+ PyObject *py_vec = value_items[i];
if (py_vec == Py_None) {
clnors[i][0] = clnors[i][1] = 0.0f;
@@ -440,7 +442,7 @@ static PyObject *bpy_bmlayeritem_from_array__clnors(BPy_BMLayerItem *self, PyObj
else {
nors = MEM_mallocN(sizeof(*nors) * nbr_val, __func__);
for (Py_ssize_t i = 0; i < nbr_val; i++) {
- PyObject *py_vec = PySequence_Fast_GET_ITEM(value, i);
+ PyObject *py_vec = value_items[i];
if (py_vec == Py_None) {
zero_v3(nors[i]);
More information about the Bf-blender-cvs
mailing list