diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-20 11:41:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-20 11:41:47 +0400 |
commit | 3b9b53d8761155d8919465627914a789f482915b (patch) | |
tree | 885232eb2594b9caf0d48954b7c69c05f6c1b8a8 /source/blender/python | |
parent | 65a71a1bbf0fd91738f2a35da4acb756993d39b5 (diff) |
fix [#30589] RNA function descriptions not showing in Python console on autocomplete
show rna function description and arguments now.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index e882d6ccd34..35c8cc60a53 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3938,6 +3938,12 @@ static PyGetSetDef pyrna_struct_getseters[] = { {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; +static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *closure); + +static PyGetSetDef pyrna_func_getseters[] = { + {(char *)"__doc__", (getter)pyrna_func_doc_get, (setter)NULL, NULL, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; PyDoc_STRVAR(pyrna_prop_collection_keys_doc, ".. method:: keys()\n" @@ -5150,6 +5156,22 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject Py_RETURN_NONE; } +static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure)) +{ + PyObject *ret; + char *args; + + args = RNA_function_as_string_keywords(NULL, self->func, NULL, TRUE, TRUE); + + ret = PyUnicode_FromFormat("%.200s.%.200s(%.200s)\n%s", + RNA_struct_identifier(self->ptr.type), + RNA_function_identifier(self->func), + args, RNA_function_ui_description(self->func)); + + MEM_freeN(args); + + return ret; +} /* subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass */ /* note: tp_base member is set to &PyType_Type on init */ @@ -5726,7 +5748,7 @@ PyTypeObject pyrna_func_Type = { /*** Attribute descriptor and subclassing stuff ***/ NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMemberDef *tp_members; */ - NULL, /* struct PyGetSetDef *tp_getset; */ + pyrna_func_getseters, /* struct PyGetSetDef *tp_getset; */ NULL, /* struct _typeobject *tp_base; */ NULL, /* PyObject *tp_dict; */ NULL, /* descrgetfunc tp_descr_get; */ |