diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-24 10:25:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-24 10:25:47 +0300 |
commit | 31c7d694e07f610b7a1e6aa44da43a2587511e80 (patch) | |
tree | 2efaf8315e6d2b9b40d129297bab63044d531bc0 /source/blender/python | |
parent | fbd936494495d0de54eef24a97957e000306785f (diff) |
remove 2 unnecessary checks for array type before assignment.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 16 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_array.c | 6 |
2 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 216048082d9..9390cd80b7b 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1046,17 +1046,11 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb /* char error_str[512]; */ int ok= 1; -#ifdef USE_MATHUTILS - if(MatrixObject_Check(value)) { - MatrixObject *mat = (MatrixObject*)value; - if(!BaseMath_ReadCallback(mat)) - return -1; - } else /* continue... */ -#endif // USE_MATHUTILS - if (!PySequence_Check(value)) { - PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name); - return -1; - } +// if (!PySequence_Check(value)) { +// PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment to %.200s.%.200s expected a sequence, not %.200s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), Py_TYPE(value)->tp_name); +// return -1; +// } + /* done getting the length */ ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix); diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 4ae0dda971e..72b06c04943 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -98,7 +98,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] Py_DECREF(item); /* BLI_snprintf(error_str, error_str_size, "sequence items should be of type %s", item_type_str); */ - PyErr_Format(PyExc_TypeError, "expected sequence items of type %s, not %s", item_type_str, Py_TYPE(item)->tp_name); + PyErr_Format(PyExc_TypeError, "%s expected sequence items of type %s, not %s", error_prefix, item_type_str, Py_TYPE(item)->tp_name); return 0; } @@ -186,7 +186,7 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA if (tot != len) { /* BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len); */ - PyErr_Format(PyExc_ValueError, "%s sequence must have %d items total, not %d", error_prefix, len, tot); + PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, sequence must have %d items total, not %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), len, tot); return 0; } } @@ -315,7 +315,7 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, i if(lvalue_dim == totdim) { /* single item, assign directly */ if(!check_item_type(py)) { - PyErr_Format(PyExc_TypeError, "%s expected a %s type, not %s", error_prefix, item_type_str, Py_TYPE(py)->tp_name); + PyErr_Format(PyExc_TypeError, "%s %.200s.%.200s, expected a %s type, not %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), item_type_str, Py_TYPE(py)->tp_name); return 0; } copy_value_single(py, ptr, prop, NULL, 0, &index, convert_item, rna_set_index); |