diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-13 04:52:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-13 04:52:09 +0400 |
commit | 6955c47faca1c772c9278136d53337c2083aea18 (patch) | |
tree | 113d4bb3ffdd58fa5b6853271b4edfa8115b34bb /source/blender/python | |
parent | cfebab77152c082e93a771d1da2a6dc5b4c6c5e7 (diff) |
bpy/rna new property attribute 'data', this means its possible to get back the rna-struct which a property uses.
Without this you cant get the bone from an fcurve data path for example, needed to fix bug [#28889].
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ba7e2d41e69..0acd844cc84 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2972,7 +2972,7 @@ PyDoc_STRVAR(pyrna_struct_path_from_id_doc, " :arg property: Optional property name which can be used if the path is\n" " to a property of this object.\n" " :type property: string\n" -" :return: The path from :class:`bpy_struct.id_data`\n" +" :return: The path from :class:`bpy.types.bpy_struct.id_data`\n" " to this struct and property (when given).\n" " :rtype: str\n" ); @@ -3028,7 +3028,7 @@ PyDoc_STRVAR(pyrna_prop_path_from_id_doc, "\n" " Returns the data path from the ID to this property (string).\n" "\n" -" :return: The path from :class:`bpy_struct.id_data` to this property.\n" +" :return: The path from :class:`bpy.types.bpy_struct.id_data` to this property.\n" " :rtype: str\n" ); static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self) @@ -3059,7 +3059,7 @@ PyDoc_STRVAR(pyrna_struct_type_recast_doc, " such as textures can be changed at runtime.\n" "\n" " :return: a new instance of this object with the type initialized again.\n" -" :rtype: subclass of :class:`bpy_struct`\n" +" :rtype: subclass of :class:`bpy.types.bpy_struct`\n" ); static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { @@ -3664,6 +3664,11 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self) Py_RETURN_NONE; } +static PyObject *pyrna_struct_get_pointer_data(BPy_DummyPointerRNA *self) +{ + return pyrna_struct_CreatePyObject(&self->ptr); +} + static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) { PointerRNA tptr; @@ -3679,6 +3684,7 @@ static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self) static PyGetSetDef pyrna_prop_getseters[]= { {(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL}, + {(char *)"data", (getter)pyrna_struct_get_pointer_data, (setter)NULL, (char *)"The data this property is using, *type* :class:`bpy.types.bpy_struct`", NULL}, {(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; |