diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-10-31 21:48:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-10-31 21:48:58 +0300 |
commit | af72bb50ae41f5ba1f9f5b2310b2aee77907fecf (patch) | |
tree | eac2c8df182ba238758fb51b2292212326e1c7ac /source/blender/python | |
parent | e4881eef529262ec131ab22688e44fb9af2f0bb9 (diff) |
improved class validation, variables defined by the rna interface as non-optional could fail silently when absent in the class. Set these to PROP_REGISTER_OPTIONAL and raise an error when others are not found.
last commit broke povray too.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index f12c7b55b0e..f914c3cacea 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3194,7 +3194,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun PyObject *item, *fitem; PyObject *py_arg_count; int i, flag, arg_count, func_arg_count; - char *identifier; + const char *identifier; if (base_class) { if (!PyObject_IsSubclass(py_class, base_class)) { @@ -3269,6 +3269,8 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun item = PyObject_GetAttrString(py_class, identifier); if (item==NULL) { + + /* Sneaky workaround to use the class name as the bl_idname */ if(strcmp(identifier, "bl_idname") == 0) { item= PyObject_GetAttrString(py_class, "__name__"); @@ -3280,7 +3282,8 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun } } - if (item==NULL && (flag & PROP_REGISTER_OPTIONAL)==0) { + + if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) { PyErr_Format( PyExc_AttributeError, "expected %.200s class to have an \"%.200s\" attribute", class_type, identifier); return -1; } |