Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-04-09 20:52:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-09 20:52:18 +0400
commitbca1ca9d1e37aad501dbd5b2768b71cc9d822535 (patch)
tree8ae15f18a3a9453920793b1f072d661922b6a5ee /source
parent26568d03037f4ee06b2bbb29a425473158e1455a (diff)
Added rna functions so they get included in a dir(rna_struct) from python.
Added a check that a panel panel is a subclass of bpy.types.Panel (need a better way to access this type)
Diffstat (limited to 'source')
-rw-r--r--source/blender/python/intern/bpy_panel_wrap.c6
-rw-r--r--source/blender/python/intern/bpy_rna.c33
2 files changed, 35 insertions, 4 deletions
diff --git a/source/blender/python/intern/bpy_panel_wrap.c b/source/blender/python/intern/bpy_panel_wrap.c
index 25fcd34fea5..4a33c90f819 100644
--- a/source/blender/python/intern/bpy_panel_wrap.c
+++ b/source/blender/python/intern/bpy_panel_wrap.c
@@ -123,6 +123,7 @@ PyObject *PyPanel_wrap_add(PyObject *self, PyObject *args)
{
PyObject *item;
PyObject *py_class;
+ PyObject *base_class;
char *space_identifier;
char *region_identifier;
int space_value;
@@ -152,9 +153,12 @@ PyObject *PyPanel_wrap_add(PyObject *self, PyObject *args)
if( !PyArg_ParseTuple( args, "Oss:addPanel", &py_class, &space_identifier, &region_identifier))
return NULL;
+
+ base_class = PyObject_GetAttrStringArgs(PyDict_GetItemString(PyEval_GetGlobals(), "bpy"), 2, "types", "Panel");
+ Py_DECREF(base_class);
/* Should this use a base class? */
- if (BPY_class_validate("Panel", py_class, NULL, pypnl_class_attr_values, pypnl_class_attrs) < 0) {
+ if (BPY_class_validate("Panel", py_class, base_class, pypnl_class_attr_values, pypnl_class_attrs) < 0) {
return NULL; /* BPY_class_validate sets the error */
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4ba7214cf5c..807b77cf1da 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -658,6 +658,10 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
PyObject *ret, *dict;
PyObject *pystring;
+ /* for looping over attrs and funcs */
+ CollectionPropertyIterator iter;
+ PropertyRNA *iterprop;
+
/* Include this incase this instance is a subtype of a python class
* In these instances we may want to return a function or variable provided by the subtype
* */
@@ -681,8 +685,10 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
/* Collect RNA items*/
{
- PropertyRNA *iterprop, *nameprop;
- CollectionPropertyIterator iter;
+ /*
+ * Collect RNA attributes
+ */
+ PropertyRNA *nameprop;
char name[256], *nameptr;
iterprop= RNA_struct_iterator_property(&self->ptr);
@@ -700,7 +706,28 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA * self)
MEM_freeN(nameptr);
}
}
-
+ RNA_property_collection_end(&iter);
+
+ }
+
+
+ {
+ /*
+ * Collect RNA function items
+ */
+ PointerRNA tptr;
+
+ RNA_pointer_create(NULL, &RNA_Struct, self->ptr.type, &tptr);
+ iterprop= RNA_struct_find_property(&tptr, "functions");
+
+ RNA_property_collection_begin(&tptr, iterprop, &iter);
+
+ for(; iter.valid; RNA_property_collection_next(&iter)) {
+ pystring = PyUnicode_FromString(RNA_function_identifier(&tptr, iter.ptr.data));
+ PyList_Append(ret, pystring);
+ Py_DECREF(pystring);
+ }
+
RNA_property_collection_end(&iter);
}