Blender V5.3
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
22namespace blender {
23
25 /* Wrap. */
26 bpy_rna_uilayout_introspect_doc,
27 ".. method:: introspect()\n"
28 "\n"
29 " Return a list of dictionaries containing a textual representation of the UI layout.\n"
30 "\n"
31 " :rtype: list[dict[str, Any]]\n");
32static PyObject *bpy_rna_uilayout_introspect(PyObject *self)
33{
34 BPy_StructRNA *pyrna = reinterpret_cast<BPy_StructRNA *>(self);
35 ui::Layout *layout = pyrna->ptr->data_as<ui::Layout>();
36
37 std::string expr = layout_introspect(layout);
38 PyObject *main_mod = PyC_MainModule_Backup();
39 PyObject *py_dict = PyC_DefaultNameSpace("<introspect>");
40 PyObject *result = PyRun_String(expr.c_str(), Py_eval_input, py_dict, 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 reinterpret_cast<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
69
70} // namespace blender
Read Blender memory allocation and freeing.
BMesh Iterators.
PyObject * PyC_MainModule_Backup()
PyDoc_STRVAR(bpy_bm_new_doc, ".. function:: new(*, use_operators=True)\n" "\n" " :param use_operators: Support calling operators in :mod:`bmesh.ops` (uses some " "extra memory per vert/edge/face).\n" " :type use_operators: bool\n" " :return: Return a new, empty BMesh.\n" " :rtype: :class:`bmesh.types.BMesh`\n")
PyObject * PyC_DefaultNameSpace(const char *filename)
static PyObject * bpy_rna_uilayout_introspect(PyObject *self)
Definition bpy_rna_ui.cc:32
PyMethodDef BPY_rna_uilayout_introspect_method_def
Definition bpy_rna_ui.cc:55
void PyC_MainModule_Restore(PyObject *main_mod)
PyObject_HEAD std::optional< PointerRNA > ptr
Definition bpy_rna.hh:133