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>2021-02-21 13:15:13 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-21 13:15:13 +0300
commitde67e3c0c02e9d08022cff58338099d287505f91 (patch)
treec6a1f1a7fc2089d5440dbc8f2e7d8baa979a722b /source/blender/python
parentc6ddb68b7a71c0f661967bb3fd84596063ea7a27 (diff)
PyAPI: expose bpy_prop_deferred function & keywords
While not needed for Blender, Animation Nodes uses this information, expose this information for scripts to access that need it.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_props.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index c596f81a91c..2b3599df86e 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -227,6 +227,37 @@ static PyObject *bpy_prop_deferred_repr(BPy_PropDeferred *self)
return PyUnicode_FromFormat("<%.200s, %R, %R>", Py_TYPE(self)->tp_name, self->fn, self->kw);
}
+/* Get/Set Items. */
+
+/**
+ * Expose the function in case scripts need to introspect this information
+ * (not currently used by Blender it's self).
+ */
+static PyObject *bpy_prop_deferred_function_get(BPy_PropDeferred *self, void *UNUSED(closure))
+{
+ PyObject *ret = self->fn;
+ Py_IncRef(ret);
+ return ret;
+}
+
+/**
+ * Expose keywords in case scripts need to introspect this information
+ * (not currently used by Blender it's self).
+ */
+static PyObject *bpy_prop_deferred_keywords_get(BPy_PropDeferred *self, void *UNUSED(closure))
+{
+ PyObject *ret = self->kw;
+ Py_IncRef(ret);
+ return ret;
+}
+
+static PyGetSetDef bpy_prop_deferred_getset[] = {
+ {"function", (getter)bpy_prop_deferred_function_get, (setter)NULL, NULL, NULL},
+ {"keywords", (getter)bpy_prop_deferred_keywords_get, (setter)NULL, NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
PyTypeObject bpy_prop_deferred_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
@@ -239,6 +270,8 @@ PyTypeObject bpy_prop_deferred_Type = {
.tp_traverse = (traverseproc)bpy_prop_deferred_traverse,
.tp_clear = (inquiry)bpy_prop_deferred_clear,
+
+ .tp_getset = bpy_prop_deferred_getset,
};
static PyObject *bpy_prop_deferred_data_CreatePyObject(PyObject *fn, PyObject *kw)