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-17 23:46:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-17 23:46:59 +0300
commit2ae15e39ad01768ce0d54aeb106a9cfa5162efa3 (patch)
treee170c43676686589756ef2e34f0e45065ce25261 /source/blender/python
parentc07dde45a2fc67c787088e1fa95645722fe332ba (diff)
make animation system and rna internals use getattr style syntax for user defined properties
bone["foo"] rather then bone.foo matches python and avoids naming collisions
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_rna.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index e247b060088..4e11da8c2cb 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1410,6 +1410,23 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
return PyBool_FromLong(hidden);
}
+static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *value)
+{
+ char *path= _PyUnicode_AsString(value);
+ PointerRNA r_ptr;
+ PropertyRNA *r_prop;
+
+ if(path==NULL) {
+ PyErr_SetString( PyExc_TypeError, "items() is only valid for collection types" );
+ return NULL;
+ }
+
+ if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop))
+ return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
+
+ Py_RETURN_NONE;
+}
+
static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
{
PyObject *ret, *dict;
@@ -1507,7 +1524,6 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
return ret;
}
-
//---------------getattr--------------------------------------------
static PyObject *pyrna_struct_getattro( BPy_StructRNA *self, PyObject *pyname )
{
@@ -2119,6 +2135,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"driver_add", (PyCFunction)pyrna_struct_driver_add, METH_VARARGS, NULL},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, NULL},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
+ {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_O, NULL},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
{NULL, NULL, 0, NULL}
};