11#define PY_SSIZE_T_CLEAN
55 std::optional<TextRegion> *region_p =
static_cast<std::optional<TextRegion> *
>(p);
77 bpy_rna_region_as_string_doc,
78 ".. method:: region_as_string(*, range=None)\n"
80 " :param range: The region of text to be returned, "
81 "defaulting to the selection when no range is passed.\n"
82 " Each int pair represents a line and column: "
83 "((start_line, start_column), (end_line, end_column))\n"
84 " The values match Python's slicing logic "
85 "(negative values count backwards from the end, the end value is not inclusive).\n"
86 " :type range: tuple[tuple[int, int], tuple[int, int]] | None\n"
87 " :return: The specified region as a string.\n"
95 std::optional<TextRegion> region;
97 static const char *_keywords[] = {
"range",
nullptr};
98 static _PyArg_Parser _parser = {
110 txt_sel_set(text, region->curl, region->curc, region->sell, region->selc);
115 return PyUnicode_FromString(
"");
118 PyObject *sel_text = PyUnicode_FromString(buf);
126# pragma clang diagnostic push
127# pragma clang diagnostic ignored "-Wcast-function-type"
129# pragma GCC diagnostic push
130# pragma GCC diagnostic ignored "-Wcast-function-type"
137 METH_VARARGS | METH_KEYWORDS,
138 bpy_rna_region_as_string_doc,
143# pragma clang diagnostic pop
145# pragma GCC diagnostic pop
151 bpy_rna_region_from_string_doc,
152 ".. method:: region_from_string(body, /, *, range=None)\n"
154 " :param body: The text to be inserted.\n"
156 " :param range: The region of text to be returned, "
157 "defaulting to the selection when no range is passed.\n"
158 " Each int pair represents a line and column: "
159 "((start_line, start_column), (end_line, end_column))\n"
160 " The values match Python's slicing logic "
161 "(negative values count backwards from the end, the end value is not inclusive).\n"
162 " :type range: tuple[tuple[int, int], tuple[int, int]] | None\n");
166 Text *text =
static_cast<Text *
>(pyrna->
ptr->data);
171 std::optional<TextRegion> region;
173 static const char *_keywords[] = {
"",
"range",
nullptr};
174 static _PyArg_Parser _parser = {
178 ":region_from_string",
182 if (!_PyArg_ParseTupleAndKeywordsFast(
189 txt_sel_set(text, region->curl, region->curc, region->sell, region->selc);
202# pragma clang diagnostic push
203# pragma clang diagnostic ignored "-Wcast-function-type"
205# pragma GCC diagnostic push
206# pragma GCC diagnostic ignored "-Wcast-function-type"
211 "region_from_string",
213 METH_VARARGS | METH_KEYWORDS,
214 bpy_rna_region_from_string_doc,
219# pragma clang diagnostic pop
221# pragma GCC diagnostic pop
Read Blender memory allocation and freeing.
void WM_main_add_notifier(uint type, void *reference)
static PyObject * bpy_rna_region_from_string(PyObject *self, PyObject *args, PyObject *kwds)
PyMethodDef BPY_rna_region_from_string_method_def
void txt_insert_buf(struct Text *text, const char *in_buffer, int in_buffer_len) ATTR_NONNULL(1
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")
bool txt_has_sel(const struct Text *text)
void txt_sel_set(struct Text *text, int startl, int startc, int endl, int endc)
static PyObject * bpy_rna_region_as_string(PyObject *self, PyObject *args, PyObject *kwds)
static int py_parse_optional_region(PyObject *o, void *p)
char * txt_sel_to_buf(const struct Text *text, size_t *r_buf_strlen)
PyMethodDef BPY_rna_region_as_string_method_def
header-only compatibility defines.
PyObject_HEAD std::optional< PointerRNA > ptr