[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34771] trunk/blender/source/blender/ python/intern/bpy_rna.c: cls.is_registered() class method for python subclasses of internal types.
Campbell Barton
ideasman42 at gmail.com
Fri Feb 11 03:40:15 CET 2011
Revision: 34771
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34771
Author: campbellbarton
Date: 2011-02-11 02:40:14 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
cls.is_registered() class method for python subclasses of internal types.
Synonymous with ('bl_rna' in cls.__dict__)
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2011-02-11 01:27:00 UTC (rev 34770)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2011-02-11 02:40:14 UTC (rev 34771)
@@ -3607,6 +3607,11 @@
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 @@
/* 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}
};
More information about the Bf-blender-cvs
mailing list