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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-19 21:22:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-19 21:22:21 +0300
commit512c06afdb61740e4c102b590ee563e8b83f2e65 (patch)
tree5e14b124c00875dfcc025778f88b228ef210e7f6 /source/blender
parente61c90e4162040f564e154da055995e2ed280fdf (diff)
- StructRNA's __dir__ was missing members from its classes __dict__
- property editor can now set button min/max values and edit the tooltip - custom props tooltips were not displayed - cleanup the property UI - remove hacks that were used for editing (edit is now a popup operator) - object.children was broken
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/makesrna/intern/rna_access.c6
-rw-r--r--source/blender/python/intern/bpy_rna.c30
2 files changed, 28 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 155f2ff594d..ce2e256004e 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -424,8 +424,10 @@ static const char *rna_ensure_property_description(PropertyRNA *prop)
IDProperty *idp_ui= rna_idproperty_ui(prop);
if(idp_ui) { /* TODO, type checking on ID props */
+
IDProperty *item= IDP_GetPropertyFromGroup(idp_ui, "description");
- return item ? ((IDProperty*)prop)->name : item->data.pointer;
+ if(item)
+ return (char *)item->data.pointer ;
}
return ((IDProperty*)prop)->name; /* XXX - not correct */
@@ -955,7 +957,7 @@ const char *RNA_property_ui_name(PropertyRNA *prop)
const char *RNA_property_ui_description(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->description;
+ return rna_ensure_property_description(prop);
}
int RNA_property_ui_icon(PropertyRNA *prop)
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 1673f4e9d26..b63e41248f3 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1443,18 +1443,22 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
if (BPy_StructRNA_CheckExact(self)) {
ret = PyList_New(0);
} else {
- pystring = PyUnicode_FromString("__dict__");
- dict = PyObject_GenericGetAttr((PyObject *)self, pystring);
- Py_DECREF(pystring);
+ PyObject *list;
+ /* class instances */
+ dict = *_PyObject_GetDictPtr((PyObject *)self);
if (dict==NULL) {
- PyErr_Clear();
ret = PyList_New(0);
}
else {
ret = PyDict_Keys(dict);
- Py_DECREF(dict);
}
+
+ /* classes dict */
+ dict= ((PyTypeObject *)Py_TYPE(self))->tp_dict;
+ list = PyDict_Keys(dict);
+ PyList_SetSlice(ret, INT_MAX, INT_MAX, list);
+ Py_DECREF(list);
}
/* Collect RNA items*/
@@ -1617,6 +1621,17 @@ static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
return ret;
}
+#if 0
+static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname)
+{
+ PyObject *dict= *(_PyObject_GetDictPtr((PyObject *)self));
+ if (dict==NULL) /* unlikely */
+ return 0;
+
+ return PyDict_Contains(dict, pyname);
+}
+#endif
+
//--------------- setattr-------------------------------------------
static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObject *value )
{
@@ -1627,7 +1642,10 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
// XXX - This currently allows anything to be assigned to an rna prop, need to see how this should be used
// but for now it makes porting scripts confusing since it fails silently.
// edit: allowing this for setting classes internal attributes.
- if (name[0]=='_' && !BPy_StructRNA_CheckExact(self) && PyObject_GenericSetAttr((PyObject *)self, pyname, value) >= 0) {
+ // edit: allow this for any attribute that alredy exists as a python attr
+ if ( (name[0]=='_' /* || pyrna_struct_pydict_contains(self, pyname) */ ) &&
+ !BPy_StructRNA_CheckExact(self) &&
+ PyObject_GenericSetAttr((PyObject *)self, pyname, value) >= 0) {
return 0;
} else
{