From 0229621b512507fabcad8634bcfc02d131ec9450 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 5 Mar 2009 08:53:29 +0000 Subject: 2.5 / PyRNA * a collection of small changes after review together with Campbell. --- source/blender/python/intern/bpy_rna.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source/blender/python/intern') diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index e879be52be6..340e0cc8cb7 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -120,8 +120,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) PyObject *ret; int type = RNA_property_type(ptr, prop); int len = RNA_property_array_length(ptr, prop); - /* resolve path */ - + if (len > 0) { /* resolve the array from a new pytype */ return pyrna_prop_CreatePyObject(ptr, prop); @@ -154,7 +153,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) if (RNA_property_enum_identifier(ptr, prop, val, &identifier)) { ret = PyUnicode_FromString( identifier ); } else { - PyErr_Format(PyExc_AttributeError, "enum \"%d\" not found", val); + PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val); ret = NULL; } @@ -173,10 +172,11 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) break; } case PROP_COLLECTION: - ret = pyrna_prop_CreatePyObject(ptr, prop); + PyErr_SetString(PyExc_AttributeError, "RNA Anomaly: Collection of length 0?"); + ret = NULL; /*pyrna_prop_CreatePyObject(ptr, prop);*/ break; default: - PyErr_SetString(PyExc_AttributeError, "unknown type (pyrna_prop_to_py)"); + PyErr_Format(PyExc_AttributeError, "RNA Error: unknown type \"%d\" (pyrna_prop_to_py)", type); ret = NULL; break; } @@ -189,7 +189,6 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) { int type = RNA_property_type(ptr, prop); int len = RNA_property_array_length(ptr, prop); - /* resolve path */ if (len > 0) { PyObject *item; @@ -374,8 +373,6 @@ static PyObject * pyrna_prop_to_py_index(PointerRNA *ptr, PropertyRNA *prop, int PyObject *ret; int type = RNA_property_type(ptr, prop); - /* resolve path */ - /* see if we can coorce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: @@ -401,8 +398,6 @@ static int pyrna_py_to_prop_index(PointerRNA *ptr, PropertyRNA *prop, int index, int ret = 0; int type = RNA_property_type(ptr, prop); - /* resolve path */ - /* see if we can coorce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: -- cgit v1.2.3