Blender V4.5
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
17#include "UI_interface.hh"
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 dictionary containing a textual representation of the UI layout.\n");
28static PyObject *bpy_rna_uilayout_introspect(PyObject *self)
29{
31 uiLayout *layout = static_cast<uiLayout *>(pyrna->ptr->data);
32
33 const char *expr = UI_layout_introspect(layout);
34 PyObject *main_mod = PyC_MainModule_Backup();
35 PyObject *py_dict = PyC_DefaultNameSpace("<introspect>");
36 PyObject *result = PyRun_String(expr, Py_eval_input, py_dict, py_dict);
37 MEM_freeN(expr);
38 Py_DECREF(py_dict);
39 PyC_MainModule_Restore(main_mod);
40 return result;
41}
42
43#ifdef __GNUC__
44# ifdef __clang__
45# pragma clang diagnostic push
46# pragma clang diagnostic ignored "-Wcast-function-type"
47# else
48# pragma GCC diagnostic push
49# pragma GCC diagnostic ignored "-Wcast-function-type"
50# endif
51#endif
52
54 "introspect",
55 (PyCFunction)bpy_rna_uilayout_introspect,
56 METH_NOARGS,
57 bpy_rna_uilayout_introspect_doc,
58};
59
60#ifdef __GNUC__
61# ifdef __clang__
62# pragma clang diagnostic pop
63# else
64# pragma GCC diagnostic pop
65# endif
66#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 dictionary containing a textual representation of the UI layout.\n")
PyMethodDef BPY_rna_uilayout_introspect_method_def
Definition bpy_rna_ui.cc:53
static PyObject * bpy_rna_uilayout_introspect(PyObject *self)
Definition bpy_rna_ui.cc:28
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)
PyObject_HEAD std::optional< PointerRNA > ptr
Definition bpy_rna.hh:130