Blender V5.0
bpy_rna_ui.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include <Python.h>
12
13#include "MEM_guardedalloc.h"
14
16
18
19#include "bpy_rna.hh"
20#include "bpy_rna_ui.hh" /* Declare #BPY_rna_uilayout_introspect_method_def. */
21
23 /* Wrap. */
24 bpy_rna_uilayout_introspect_doc,
25 ".. method:: introspect()\n"
26 "\n"
27 " Return a list of dictionaries containing a textual representation of the UI layout.\n"
28 "\n"
29 " :rtype: list[dict[str, Any]]\n");
30static PyObject *bpy_rna_uilayout_introspect(PyObject *self)
31{
33 uiLayout *layout = static_cast<uiLayout *>(pyrna->ptr->data);
34
35 const char *expr = UI_layout_introspect(layout);
36 PyObject *main_mod = PyC_MainModule_Backup();
37 PyObject *py_dict = PyC_DefaultNameSpace("<introspect>");
38 PyObject *result = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
39 MEM_freeN(expr);
40 Py_DECREF(py_dict);
41 PyC_MainModule_Restore(main_mod);
42 return result;
43}
44
45#ifdef __GNUC__
46# ifdef __clang__
47# pragma clang diagnostic push
48# pragma clang diagnostic ignored "-Wcast-function-type"
49# else
50# pragma GCC diagnostic push
51# pragma GCC diagnostic ignored "-Wcast-function-type"
52# endif
53#endif
54
56 "introspect",
57 (PyCFunction)bpy_rna_uilayout_introspect,
58 METH_NOARGS,
59 bpy_rna_uilayout_introspect_doc,
60};
61
62#ifdef __GNUC__
63# ifdef __clang__
64# pragma clang diagnostic pop
65# else
66# pragma GCC diagnostic pop
67# endif
68#endif
Read Guarded memory(de)allocation.
const char * UI_layout_introspect(uiLayout *layout)
PyObject * self
PyDoc_STRVAR(bpy_rna_uilayout_introspect_doc, ".. method:: introspect()\n" "\n" " Return a list of dictionaries containing a textual representation of the UI layout.\n" "\n" " :rtype: list[dict[str, Any]]\n")
PyMethodDef BPY_rna_uilayout_introspect_method_def
Definition bpy_rna_ui.cc:55
static PyObject * bpy_rna_uilayout_introspect(PyObject *self)
Definition bpy_rna_ui.cc:30
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
PyObject * PyC_DefaultNameSpace(const char *filename)
PyObject * PyC_MainModule_Backup()
void PyC_MainModule_Restore(PyObject *main_mod)
Py_DECREF(oname)
PyObject_HEAD std::optional< PointerRNA > ptr
Definition bpy_rna.hh:130