diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index d22297e3da9..5a114199005 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2347,6 +2347,14 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args) return def; } +static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self) +{ + if(self->ptr.data) + return PyCapsule_New(self->ptr.data, RNA_struct_identifier(self->ptr.type), NULL); + + Py_RETURN_NONE; +} + static PyObject *pyrna_prop_get(BPy_PropertyRNA *self, PyObject *args) { PointerRNA newptr; @@ -2661,6 +2669,8 @@ static struct PyMethodDef pyrna_struct_methods[] = { {"get", (PyCFunction)pyrna_struct_get, METH_VARARGS, NULL}, + {"as_pointer", (PyCFunction)pyrna_struct_as_pointer, METH_NOARGS, NULL}, + /* maybe this become and ID function */ {"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, NULL}, {"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS, NULL}, |