diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-11 05:40:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-11 05:40:14 +0300 |
commit | 65b922ad888faa937f056305a7522682b18d0e26 (patch) | |
tree | 86c6958508968c22e4f70d246a69c51005eb93b3 /source/blender/python | |
parent | 17efeb310d65eaf5e850d0e77e058096ee6c3b8b (diff) |
cls.is_registered() class method for python subclasses of internal types.
Synonymous with ('bl_rna' in cls.__dict__)
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 78873b825d5..c21fbaae9c0 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3607,6 +3607,11 @@ PyObject *pyrna_prop_collection_iter(BPy_PropertyRNA *self) return iter; } +static PyObject *pyrna_struct_is_registered(PyObject *cls) +{ + return PyBool_FromLong(PyDict_GetItemString((((PyTypeObject *)cls)->tp_dict), "bl_rna") != NULL); +} + static struct PyMethodDef pyrna_struct_methods[] = { /* only for PointerRNA's with ID'props */ @@ -3632,6 +3637,9 @@ static struct PyMethodDef pyrna_struct_methods[] = { /* experemental */ {"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL}, {"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL}, + + /* class method */ + {"is_registered", (PyCFunction) pyrna_struct_is_registered, METH_NOARGS | METH_CLASS, NULL}, {NULL, NULL, 0, NULL} }; |