74#define BPY_BM_HFLAG_ALL_STR "('SELECT', 'HIDE', 'SEAM', 'SMOOTH', 'TAG')"
96 bpy_bm_elem_select_doc,
97 "Selected state of this element.\n"
102 bpy_bm_elem_hide_doc,
103 "Hidden state of this element.\n"
109 "Generic attribute scripts can use for own logic\n"
114 bpy_bm_elem_smooth_doc,
115 "Smooth state of this element.\n"
120 bpy_bm_elem_seam_doc,
121 "Seam for UV unwrapping.\n"
156 bpy_bm_elem_index_doc,
157 "Index of this element.\n"
163 " This value is not necessarily valid, while editing the mesh it can become *dirty*.\n"
165 " It's also possible to assign any number to this attribute for a scripts internal logic.\n"
167 " To ensure the value is up to date - see :class:`BMElemSeq.index_update`.\n");
181 if (((param = PyC_Long_AsI32(value)) == -1) && PyErr_Occurred()) {
189 self->bm->elem_index_dirty |=
self->ele->head.htype;
205 "This meshes vert sequence (read-only).\n"
207 ":type: :class:`BMVertSeq`");
217 "This meshes edge sequence (read-only).\n"
219 ":type: :class:`BMEdgeSeq`");
229 "This meshes face sequence (read-only).\n"
231 ":type: :class:`BMFaceSeq`");
241 "This meshes loops (read-only).\n"
243 ":type: :class:`BMLoopSeq`\n"
247 " Loops must be accessed via faces, this is only exposed for layer access.\n");
256 "Edges connected to this vertex (read-only).\n"
258 ":type: :class:`BMElemSeq` of :class:`BMEdge`");
260 "Faces connected to this vertex (read-only).\n"
262 ":type: :class:`BMElemSeq` of :class:`BMFace`");
264 "Loops that use this vertex (read-only).\n"
266 ":type: :class:`BMElemSeq` of :class:`BMLoop`");
270 bpy_bmedge_verts_doc,
271 "Verts this edge uses (always 2), (read-only).\n"
273 ":type: :class:`BMElemSeq` of "
276 "Faces connected to this edge, (read-only).\n"
278 ":type: :class:`BMElemSeq` of :class:`BMFace`");
280 "Loops connected to this edge, (read-only).\n"
282 ":type: :class:`BMElemSeq` of :class:`BMLoop`");
286 bpy_bmface_verts_doc,
287 "Verts of this face, (read-only).\n"
289 ":type: :class:`BMElemSeq` of :class:`BMVert`");
292 bpy_bmface_edges_doc,
293 "Edges of this face, (read-only).\n"
295 ":type: :class:`BMElemSeq` of :class:`BMEdge`");
298 bpy_bmface_loops_doc,
299 "Loops of this face, (read-only).\n"
301 ":type: :class:`BMElemSeq` of :class:`BMLoop`");
304 "Loops connected to this loop, (read-only).\n"
306 ":type: :class:`BMElemSeq` of :class:`BMLoop`");
317 "True when this element is valid (hasn't been removed).\n"
326 "True when this mesh is owned by blender (typically the editmode BMesh).\n"
338 bpy_bmesh_select_mode_doc,
339 "The selection mode, values can be {'VERT', 'EDGE', 'FACE'}, can't be assigned an empty set.\n"
360 PyErr_SetString(PyExc_TypeError,
"bm.select_mode: can't assign an empty value");
370 bpy_bmesh_select_history_doc,
371 "Sequence of selected items (the last is displayed as active).\n"
374 ":class:`BMEditSelSeq`");
395 "The coordinates for this vertex as a 3D, wrapped vector.\n"
398 ":class:`mathutils.Vector`");
417 "The normal for this vertex as a 3D, wrapped vector.\n"
419 ":type: :class:`mathutils.Vector`");
439 bpy_bmvert_is_manifold_doc,
440 "True when this vertex is manifold (read-only).\n"
451 bpy_bmvert_is_wire_doc,
452 "True when this vertex is not connected to any faces (read-only).\n"
462 "True when this vertex is connected to boundary edges (read-only).\n"
476 bpy_bmedge_is_manifold_doc,
477 "True when this edge is manifold (read-only).\n"
488 bpy_bmedge_is_contiguous_doc,
489 "True when this edge is manifold, between two faces with the same winding "
501 bpy_bmedge_is_convex_doc,
502 "True when this edge joins two convex faces, depends on a valid face normal (read-only).\n"
513 bpy_bmedge_is_wire_doc,
514 "True when this edge is not connected to any faces (read-only).\n"
525 bpy_bmedge_is_boundary_doc,
526 "True when this edge is at the boundary of a face (read-only).\n"
539 "The normal for this face as a 3D, wrapped vector.\n"
541 ":type: :class:`mathutils.Vector`");
561 bpy_bmface_material_index_doc,
562 "The face's material index.\n"
568 return PyLong_FromLong(
self->f->mat_nr);
577 if (((param = PyC_Long_AsI32(value)) == -1) && PyErr_Occurred()) {
582 if ((param < 0) || (param >
MAXMAT)) {
584 PyErr_SetString(PyExc_ValueError,
"material index outside of usable range (0 - 32766)");
588 self->f->mat_nr = short(param);
598 "The loop's vertex (read-only).\n"
600 ":type: :class:`BMVert`");
608 "The loop's edge (between this loop and the next), (read-only).\n"
610 ":type: :class:`BMEdge`");
620 "The face this loop makes (read-only).\n"
622 ":type: :class:`BMFace`");
631 bpy_bmloop_link_loop_next_doc,
632 "The next face corner (read-only).\n"
634 ":type: :class:`BMLoop`");
643 bpy_bmloop_link_loop_prev_doc,
644 "The previous face corner (read-only).\n"
646 ":type: :class:`BMLoop`");
655 bpy_bmloop_link_loop_radial_next_doc,
656 "The next loop around the edge (read-only).\n"
658 ":type: :class:`BMLoop`");
667 bpy_bmloop_link_loop_radial_prev_doc,
668 "The previous loop around the edge (read-only).\n"
670 ":type: :class:`BMLoop`");
679 bpy_bmloop_is_convex_doc,
680 "True when this loop is at the convex corner of a face, depends on a valid face "
681 "normal (read-only).\n"
696 bpy_bmelemseq_layers_vert_doc,
697 "custom-data layers (read-only).\n"
699 ":type: :class:`BMLayerAccessVert`");
702 bpy_bmelemseq_layers_edge_doc,
703 "custom-data layers (read-only).\n"
705 ":type: :class:`BMLayerAccessEdge`");
708 bpy_bmelemseq_layers_face_doc,
709 "custom-data layers (read-only).\n"
711 ":type: :class:`BMLayerAccessFace`");
714 bpy_bmelemseq_layers_loop_doc,
715 "custom-data layers (read-only).\n"
717 ":type: :class:`BMLayerAccessLoop`");
730 bpy_bmfaceseq_active_doc,
733 ":type: :class:`BMFace` or None");
749 if (value == Py_None) {
750 bm->act_face =
nullptr;
760 PyErr_Format(PyExc_TypeError,
761 "faces.active = f: expected BMFace or None, not %.200s",
762 Py_TYPE(value)->tp_name);
767 {
"verts", (getter)
bpy_bmvertseq_get, (setter)
nullptr, bpy_bmvertseq_doc,
nullptr},
768 {
"edges", (getter)
bpy_bmedgeseq_get, (setter)
nullptr, bpy_bmedgeseq_doc,
nullptr},
769 {
"faces", (getter)
bpy_bmfaceseq_get, (setter)
nullptr, bpy_bmfaceseq_doc,
nullptr},
770 {
"loops", (getter)
bpy_bmloopseq_get, (setter)
nullptr, bpy_bmloopseq_doc,
nullptr},
774 bpy_bmesh_select_mode_doc,
780 bpy_bmesh_select_history_doc,
787 bpy_bmesh_is_wrapped_doc,
791 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
799 bpy_bm_elem_select_doc,
804 bpy_bm_elem_hide_doc,
814 bpy_bm_elem_index_doc,
821 bpy_bmvert_normal_doc,
828 bpy_bmvert_link_edges_doc,
833 bpy_bmvert_link_faces_doc,
838 bpy_bmvert_link_loops_doc,
845 bpy_bmvert_is_manifold_doc,
851 bpy_bmvert_is_boundary_doc,
855 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
863 bpy_bm_elem_select_doc,
868 bpy_bm_elem_hide_doc,
878 bpy_bm_elem_index_doc,
884 bpy_bm_elem_smooth_doc,
889 bpy_bm_elem_seam_doc,
896 bpy_bmedge_verts_doc,
902 bpy_bmedge_link_faces_doc,
907 bpy_bmedge_link_loops_doc,
914 bpy_bmedge_is_manifold_doc,
919 bpy_bmedge_is_contiguous_doc,
924 bpy_bmedge_is_convex_doc,
930 bpy_bmedge_is_boundary_doc,
934 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
942 bpy_bm_elem_select_doc,
947 bpy_bm_elem_hide_doc,
957 bpy_bm_elem_index_doc,
963 bpy_bm_elem_smooth_doc,
969 bpy_bmface_normal_doc,
975 bpy_bmface_material_index_doc,
982 bpy_bmface_verts_doc,
987 bpy_bmface_edges_doc,
992 bpy_bmface_loops_doc,
998 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1008 bpy_bm_elem_select_doc,
1013 bpy_bm_elem_hide_doc,
1019 bpy_bm_elem_tag_doc,
1024 bpy_bm_elem_index_doc,
1035 bpy_bmloops_link_loops_doc,
1040 bpy_bmloop_link_loop_next_doc,
1045 bpy_bmloop_link_loop_prev_doc,
1047 {
"link_loop_radial_next",
1050 bpy_bmloop_link_loop_radial_next_doc,
1052 {
"link_loop_radial_prev",
1055 bpy_bmloop_link_loop_radial_prev_doc,
1062 bpy_bmloop_is_convex_doc,
1064 {
"is_valid", (getter)
bpy_bm_is_valid_get, (setter)
nullptr, bpy_bm_is_valid_doc,
nullptr},
1066 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1073 bpy_bmelemseq_layers_vert_doc,
1075 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1081 bpy_bmelemseq_layers_edge_doc,
1083 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1089 bpy_bmelemseq_layers_face_doc,
1095 bpy_bmfaceseq_active_doc,
1097 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1103 bpy_bmelemseq_layers_loop_doc,
1105 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1117 ".. method:: copy()\n"
1119 " :return: A copy of this BMesh.\n"
1120 " :rtype: :class:`BMesh`\n");
1136 PyErr_SetString(PyExc_SystemError,
"Unable to copy BMesh, internal error");
1142 bpy_bmesh_clear_doc,
1143 ".. method:: clear()\n"
1145 " Clear all mesh data.\n");
1162 ".. method:: free()\n"
1164 " Explicitly free the BMesh data from memory, causing exceptions on further access.\n"
1168 " The BMesh is freed automatically, typically when the script finishes executing.\n"
1169 " However in some cases its hard to predict when this will be and its useful to\n"
1170 " explicitly free the data.\n");
1180 bm->py_handle =
nullptr;
1194 bpy_bmesh_to_mesh_doc,
1195 ".. method:: to_mesh(mesh)\n"
1197 " Writes this BMesh data into an existing Mesh datablock.\n"
1199 " :arg mesh: The mesh data to write into.\n"
1200 " :type mesh: :class:`Mesh`\n");
1209 if (!PyArg_ParseTuple(args,
"O:to_mesh", &py_mesh) ||
1216 if (mesh->
runtime->edit_mesh) {
1217 PyErr_Format(PyExc_ValueError,
"to_mesh(): Mesh '%s' is in editmode", mesh->
id.
name + 2);
1223 Main *bmain =
nullptr;
1225 params.update_shapekey_indices =
true;
1233 params.calc_object_remap =
true;
1247 bpy_bmesh_from_object_doc,
1248 ".. method:: from_object(object, depsgraph, cage=False, face_normals=True, "
1249 "vertex_normals=True)\n"
1251 " Initialize this bmesh from existing object data-block (only meshes are currently "
1254 " :arg object: The object data to load.\n"
1255 " :type object: :class:`Object`\n"
1256 " :type depsgraph: :class:`Depsgraph`\n"
1257 " :arg cage: Get the mesh as a deformed cage.\n"
1258 " :type cage: bool\n"
1259 " :arg face_normals: Calculate face normals.\n"
1260 " :type face_normals: bool\n"
1261 " :arg vertex_normals: Calculate vertex normals.\n"
1262 " :type vertex_normals: bool\n");
1265 static const char *kwlist[] = {
1266 "object",
"depsgraph",
"cage",
"face_normals",
"vertex_normals",
nullptr};
1267 PyObject *py_object;
1268 PyObject *py_depsgraph;
1272 const Mesh *mesh_eval;
1274 bool use_cage =
false;
1275 bool use_fnorm =
true;
1276 bool use_vert_normal =
true;
1281 if (!PyArg_ParseTupleAndKeywords(args,
1283 "OO|$O&O&O&:from_object",
1292 &use_vert_normal) ||
1300 PyErr_SetString(PyExc_ValueError,
1301 "from_object(...): currently only mesh objects are supported");
1308 bool need_free =
false;
1313 PyErr_SetString(PyExc_ValueError,
1314 "from_object(...): cage arg is unsupported when dependency graph "
1315 "evaluation mode is RENDER");
1331 if (mesh_eval ==
nullptr) {
1332 PyErr_Format(PyExc_ValueError,
1333 "from_object(...): Object '%s' has no usable mesh data",
1341 params.calc_face_normal = use_fnorm;
1342 params.calc_vert_normal = use_vert_normal;
1354 bpy_bmesh_from_mesh_doc,
1355 ".. method:: from_mesh(mesh, face_normals=True, vertex_normals=True, use_shape_key=False, "
1356 "shape_key_index=0)\n"
1358 " Initialize this bmesh from existing mesh datablock.\n"
1360 " :arg mesh: The mesh data to load.\n"
1361 " :type mesh: :class:`Mesh`\n"
1362 " :type face_normals: bool\n"
1363 " :type vertex_normals: bool\n"
1364 " :arg use_shape_key: Use the locations from a shape key.\n"
1365 " :type use_shape_key: bool\n"
1366 " :arg shape_key_index: The shape key index to use.\n"
1367 " :type shape_key_index: int\n"
1371 " Multiple calls can be used to join multiple meshes.\n"
1373 " Custom-data layers are only copied from ``mesh`` on initialization.\n"
1374 " Further calls will copy custom-data to matching layers, layers missing on the target "
1375 "mesh won't be added.\n");
1378 static const char *kwlist[] = {
1379 "mesh",
"face_normals",
"vertex_normals",
"use_shape_key",
"shape_key_index",
nullptr};
1383 bool use_fnorm =
true;
1384 bool use_vert_normal =
true;
1385 bool use_shape_key =
false;
1386 int shape_key_index = 0;
1390 if (!PyArg_ParseTupleAndKeywords(args,
1392 "O|$O&O&O&i:from_mesh",
1401 &shape_key_index) ||
1410 params.calc_face_normal = use_fnorm;
1411 params.calc_vert_normal = use_vert_normal;
1412 params.use_shapekey = use_shape_key;
1413 params.active_shapekey = shape_key_index + 1;
1421 bpy_bmesh_select_flush_mode_doc,
1422 ".. method:: select_flush_mode()\n"
1424 " flush selection based on the current mode current :class:`BMesh.select_mode`.\n");
1436 bpy_bmesh_select_flush_doc,
1437 ".. method:: select_flush(select)\n"
1439 " Flush selection, independent of the current selection mode.\n"
1441 " :arg select: flush selection or de-selected elements.\n"
1442 " :type select: bool\n");
1465 bpy_bmesh_normal_update_doc,
1466 ".. method:: normal_update()\n"
1468 " Update normals of mesh faces and verts.\n"
1472 " The normal of any vertex where :attr:`is_wire` is True will be a zero vector.\n");
1485 bpy_bmesh_transform_doc,
1486 ".. method:: transform(matrix, filter=None)\n"
1488 " Transform the mesh (optionally filtering flagged data only).\n"
1490 " :arg matrix: 4x4x transform matrix.\n"
1491 " :type matrix: :class:`mathutils.Matrix`\n"
1494 " :type filter: set[str]\n");
1497 static const char *kwlist[] = {
"matrix",
"filter",
nullptr};
1500 PyObject *
filter =
nullptr;
1501 int filter_flags = 0;
1505 if (!PyArg_ParseTupleAndKeywords(
1506 args, kw,
"O!|$O!:transform", (
char **)kwlist, &
matrix_Type, &mat, &PySet_Type, &
filter))
1519 PyErr_SetString(PyExc_ValueError,
"expected a 4x4 matrix");
1529 mat_ptr = mat->matrix;
1531 if (!filter_flags) {
1537 const char filter_flags_ch = char(filter_flags);
1550 bpy_bmesh_calc_volume_doc,
1551 ".. method:: calc_volume(signed=False)\n"
1553 " Calculate mesh volume based on face normals.\n"
1555 " :arg signed: when signed is true, negative values may be returned.\n"
1556 " :type signed: bool\n"
1557 " :return: The volume of the mesh.\n"
1558 " :rtype: float\n");
1561 static const char *kwlist[] = {
"signed",
nullptr};
1562 PyObject *is_signed = Py_False;
1566 if (!PyArg_ParseTupleAndKeywords(
1567 args, kw,
"|$O!:calc_volume", (
char **)kwlist, &PyBool_Type, &is_signed))
1577 bpy_bmesh_calc_loop_triangles_doc,
1578 ".. method:: calc_loop_triangles()\n"
1580 " Calculate triangle tessellation from quads/ngons.\n"
1582 " :return: The triangulated faces.\n"
1583 " :rtype: list[tuple[:class:`BMLoop`, :class:`BMLoop`, :class:`BMLoop`]]\n");
1588 int corner_tris_tot;
1601 ret = PyList_New(corner_tris_tot);
1602 for (
i = 0;
i < corner_tris_tot;
i++) {
1614 bpy_bm_elem_select_set_doc,
1615 ".. method:: select_set(select)\n"
1617 " Set the selection.\n"
1618 " This is different from the *select* attribute because it updates the selection "
1619 "state of associated geometry.\n"
1621 " :arg select: Select or de-select.\n"
1622 " :type select: bool\n"
1626 " Currently this only flushes down, so selecting a face will select all its "
1627 "vertices but de-selecting a vertex "
1628 " won't de-select all the faces that use it, before finishing with a mesh "
1629 "typically flushing is still needed.\n");
1647 bpy_bm_elem_hide_set_doc,
1648 ".. method:: hide_set(hide)\n"
1650 " Set the hide state.\n"
1651 " This is different from the *hide* attribute because it updates the selection and "
1652 "hide state of associated geometry.\n"
1654 " :arg hide: Hidden or visible.\n"
1655 " :type hide: bool\n");
1673 bpy_bm_elem_copy_from_doc,
1674 ".. method:: copy_from(other)\n"
1676 " Copy values from another element of matching type.\n");
1681 if (Py_TYPE(
self) != Py_TYPE(value)) {
1682 PyErr_Format(PyExc_TypeError,
1683 "expected element of type '%.200s' not '%.200s'",
1684 Py_TYPE(
self)->tp_name,
1685 Py_TYPE(value)->tp_name);
1689 if (value->
ele !=
self->ele) {
1690 switch (
self->ele->head.htype) {
1696 reinterpret_cast<const BMVert *
>(value->
ele),
1705 reinterpret_cast<const BMEdge *
>(value->
ele),
1714 reinterpret_cast<const BMFace *
>(value->
ele),
1723 reinterpret_cast<const BMLoop *
>(value->
ele),
1738 bpy_bmvert_copy_from_vert_interp_doc,
1739 ".. method:: copy_from_vert_interp(vert_pair, fac)\n"
1741 " Interpolate the customdata from a vert between 2 other verts.\n"
1743 " :arg vert_pair: The verts between which to interpolate data from.\n"
1744 " :type vert_pair: Sequence[:class:`BMVert`]\n"
1745 " :type fac: float\n");
1753 if (!PyArg_ParseTuple(args,
"Of:BMVert.copy_from_vert_interp", &vert_seq, &fac)) {
1758 BMVert **vert_array =
nullptr;
1759 Py_ssize_t vert_seq_len;
1761 vert_array =
static_cast<BMVert **
>(
1770 "BMVert.copy_from_vert_interp(...)"));
1772 if (vert_array ==
nullptr) {
1778 PyMem_FREE(vert_array);
1784 bpy_bmvert_copy_from_face_interp_doc,
1785 ".. method:: copy_from_face_interp(face)\n"
1787 " Interpolate the customdata from a face onto this loop (the loops vert should "
1788 "overlap the face).\n"
1790 " :arg face: The face to interpolate data from.\n"
1791 " :type face: :class:`BMFace`\n");
1798 if (!PyArg_ParseTuple(args,
"O!:BMVert.copy_from_face_interp", &
BPy_BMFace_Type, &py_face)) {
1813 bpy_bmvert_calc_edge_angle_doc,
1814 ".. method:: calc_edge_angle(fallback=None)\n"
1816 " Return the angle between this vert's two connected edges.\n"
1818 " :arg fallback: return this when the vert doesn't have 2 edges\n"
1819 " (instead of raising a :exc:`ValueError`).\n"
1820 " :type fallback: Any\n"
1821 " :return: Angle between edges in radians.\n"
1822 " :rtype: float\n");
1825 const float angle_invalid = -1.0f;
1827 PyObject *fallback =
nullptr;
1831 if (!PyArg_ParseTuple(args,
"|O:calc_edge_angle", &fallback)) {
1837 if (
angle == angle_invalid) {
1840 Py_INCREF(fallback);
1844 PyErr_SetString(PyExc_ValueError,
1845 "BMVert.calc_edge_angle(): "
1846 "vert must connect to exactly 2 edges");
1850 return PyFloat_FromDouble(
angle);
1855 bpy_bmvert_calc_shell_factor_doc,
1856 ".. method:: calc_shell_factor()\n"
1858 " Return a multiplier calculated based on the sharpness of the vertex.\n"
1859 " Where a flat surface gives 1.0, and higher values sharper edges.\n"
1860 " This is used to maintain shell thickness when offsetting verts along their normals.\n"
1862 " :return: offset multiplier\n"
1863 " :rtype: float\n");
1872 bpy_bmvert_normal_update_doc,
1873 ".. method:: normal_update()\n"
1875 " Update vertex normal.\n"
1876 " This does not update the normals of adjoining faces.\n"
1880 " The vertex normal will be a zero vector if vertex :attr:`is_wire` is True.\n");
1895 bpy_bmedge_calc_length_doc,
1896 ".. method:: calc_length()\n"
1898 " :return: The length between both verts.\n"
1899 " :rtype: float\n");
1908 bpy_bmedge_calc_face_angle_doc,
1909 ".. method:: calc_face_angle(fallback=None)\n"
1911 " :arg fallback: return this when the edge doesn't have 2 faces\n"
1912 " (instead of raising a :exc:`ValueError`).\n"
1913 " :type fallback: Any\n"
1914 " :return: The angle between 2 connected faces in radians.\n"
1915 " :rtype: float\n");
1918 const float angle_invalid = -1.0f;
1920 PyObject *fallback =
nullptr;
1924 if (!PyArg_ParseTuple(args,
"|O:calc_face_angle", &fallback)) {
1930 if (
angle == angle_invalid) {
1933 Py_INCREF(fallback);
1937 PyErr_SetString(PyExc_ValueError,
1938 "BMEdge.calc_face_angle(): "
1939 "edge doesn't use 2 faces");
1943 return PyFloat_FromDouble(
angle);
1948 bpy_bmedge_calc_face_angle_signed_doc,
1949 ".. method:: calc_face_angle_signed(fallback=None)\n"
1951 " :arg fallback: return this when the edge doesn't have 2 faces\n"
1952 " (instead of raising a :exc:`ValueError`).\n"
1953 " :type fallback: Any\n"
1954 " :return: The angle between 2 connected faces in radians (negative for concave join).\n"
1955 " :rtype: float\n");
1958 const float angle_invalid = -
FLT_MAX;
1960 PyObject *fallback =
nullptr;
1964 if (!PyArg_ParseTuple(args,
"|O:calc_face_angle_signed", &fallback)) {
1970 if (
angle == angle_invalid) {
1973 Py_INCREF(fallback);
1977 PyErr_SetString(PyExc_ValueError,
1978 "BMEdge.calc_face_angle_signed(): "
1979 "edge doesn't use 2 faces");
1983 return PyFloat_FromDouble(
angle);
1988 bpy_bmedge_calc_tangent_doc,
1989 ".. method:: calc_tangent(loop)\n"
1991 " Return the tangent at this edge relative to a face (pointing inward into the face).\n"
1992 " This uses the face normal for calculation.\n"
1994 " :arg loop: The loop used for tangent calculation.\n"
1995 " :type loop: :class:`BMLoop`\n"
1996 " :return: a normalized vector.\n"
1997 " :rtype: :class:`mathutils.Vector`\n");
2003 if (!PyArg_ParseTuple(args,
"O!:BMEdge.calc_face_tangent", &
BPy_BMLoop_Type, &py_loop)) {
2016 bpy_bmedge_other_vert_doc,
2017 ".. method:: other_vert(vert)\n"
2019 " Return the other vertex on this edge or None if the vertex is not used by this edge.\n"
2021 " :arg vert: a vert in this edge.\n"
2022 " :type vert: :class:`BMVert`\n"
2023 " :return: The edges other vert.\n"
2024 " :rtype: :class:`BMVert` | None\n");
2031 PyErr_Format(PyExc_TypeError,
2032 "BMEdge.other_vert(vert): BMVert expected, not '%.200s'",
2033 Py_TYPE(value)->tp_name);
2051 bpy_bmedge_normal_update_doc,
2052 ".. method:: normal_update()\n"
2054 " Update normals of all connected faces and the edge verts.\n"
2058 " The normal of edge vertex will be a zero vector if vertex :attr:`is_wire` is True.\n");
2073 bpy_bmface_copy_from_face_interp_doc,
2074 ".. method:: copy_from_face_interp(face, vert=True)\n"
2076 " Interpolate the customdata from another face onto this one (faces should overlap).\n"
2078 " :arg face: The face to interpolate data from.\n"
2079 " :type face: :class:`BMFace`\n"
2080 " :arg vert: When True, also copy vertex data.\n"
2081 " :type vert: bool\n");
2085 bool do_vertex =
true;
2089 if (!PyArg_ParseTuple(args,
2090 "O!|O&:BMFace.copy_from_face_interp",
2110 bpy_bmface_copy_doc,
2111 ".. method:: copy(verts=True, edges=True)\n"
2113 " Make a copy of this face.\n"
2115 " :arg verts: When set, the faces verts will be duplicated too.\n"
2116 " :type verts: bool\n"
2117 " :arg edges: When set, the faces edges will be duplicated too.\n"
2118 " :type edges: bool\n"
2119 " :return: The newly created face.\n"
2120 " :rtype: :class:`BMFace`\n");
2123 static const char *kwlist[] = {
"verts",
"edges",
nullptr};
2126 bool do_verts =
true;
2127 bool do_edges =
true;
2132 if (!PyArg_ParseTupleAndKeywords(args,
2134 "|$O&O&:BMFace.copy",
2150 PyErr_SetString(PyExc_ValueError,
"BMFace.copy(): couldn't create the new face, internal error");
2156 bpy_bmface_calc_area_doc,
2157 ".. method:: calc_area()\n"
2159 " Return the area of the face.\n"
2161 " :return: Return the area of the face.\n"
2162 " :rtype: float\n");
2171 bpy_bmface_calc_perimeter_doc,
2172 ".. method:: calc_perimeter()\n"
2174 " Return the perimeter of the face.\n"
2176 " :return: Return the perimeter of the face.\n"
2177 " :rtype: float\n");
2186 bpy_bmface_calc_tangent_edge_doc,
2187 ".. method:: calc_tangent_edge()\n"
2189 " Return face tangent based on longest edge.\n"
2191 " :return: a normalized vector.\n"
2192 " :rtype: :class:`mathutils.Vector`\n");
2204 bpy_bmface_calc_tangent_edge_pair_doc,
2205 ".. method:: calc_tangent_edge_pair()\n"
2207 " Return face tangent based on the two longest disconnected edges.\n"
2209 " - Tris: Use the edge pair with the most similar lengths.\n"
2210 " - Quads: Use the longest edge pair.\n"
2211 " - NGons: Use the two longest disconnected edges.\n"
2213 " :return: a normalized vector.\n"
2214 " :rtype: :class:`mathutils.Vector`\n");
2226 bpy_bmface_calc_tangent_edge_diagonal_doc,
2227 ".. method:: calc_tangent_edge_diagonal()\n"
2229 " Return face tangent based on the edge farthest from any vertex.\n"
2231 " :return: a normalized vector.\n"
2232 " :rtype: :class:`mathutils.Vector`\n");
2244 bpy_bmface_calc_tangent_vert_diagonal_doc,
2245 ".. method:: calc_tangent_vert_diagonal()\n"
2247 " Return face tangent based on the two most distant vertices.\n"
2249 " :return: a normalized vector.\n"
2250 " :rtype: :class:`mathutils.Vector`\n");
2262 bpy_bmface_calc_center_median_doc,
2263 ".. method:: calc_center_median()\n"
2265 " Return median center of the face.\n"
2267 " :return: a 3D vector.\n"
2268 " :rtype: :class:`mathutils.Vector`\n");
2280 bpy_bmface_calc_center_median_weighted_doc,
2281 ".. method:: calc_center_median_weighted()\n"
2283 " Return median center of the face weighted by edge lengths.\n"
2285 " :return: a 3D vector.\n"
2286 " :rtype: :class:`mathutils.Vector`\n");
2298 bpy_bmface_calc_center_bounds_doc,
2299 ".. method:: calc_center_bounds()\n"
2301 " Return bounds center of the face.\n"
2303 " :return: a 3D vector.\n"
2304 " :rtype: :class:`mathutils.Vector`\n");
2316 bpy_bmface_normal_update_doc,
2317 ".. method:: normal_update()\n"
2319 " Update face normal based on the positions of the face verts.\n"
2320 " This does not update the normals of face verts.\n");
2332 bpy_bmface_normal_flip_doc,
2333 ".. method:: normal_flip()\n"
2335 " Reverses winding of a face, which flips its normal.\n");
2350 bpy_bmloop_copy_from_face_interp_doc,
2351 ".. method:: copy_from_face_interp(face, vert=True, multires=True)\n"
2353 " Interpolate the customdata from a face onto this loop (the loops vert should "
2354 "overlap the face).\n"
2356 " :arg face: The face to interpolate data from.\n"
2357 " :type face: :class:`BMFace`\n"
2358 " :arg vert: When enabled, interpolate the loops vertex data (optional).\n"
2359 " :type vert: bool\n"
2360 " :arg multires: When enabled, interpolate the loops multires data (optional).\n"
2361 " :type multires: bool\n");
2365 bool do_vertex =
true;
2366 bool do_multires =
true;
2370 if (!PyArg_ParseTuple(args,
2371 "O!|O&O&:BMLoop.copy_from_face_interp",
2393 bpy_bmloop_calc_angle_doc,
2394 ".. method:: calc_angle()\n"
2396 " Return the angle at this loops corner of the face.\n"
2397 " This is calculated so sharper corners give lower angles.\n"
2399 " :return: The angle in radians.\n"
2400 " :rtype: float\n");
2409 bpy_bmloop_calc_normal_doc,
2410 ".. method:: calc_normal()\n"
2412 " Return normal at this loops corner of the face.\n"
2413 " Falls back to the face normal for straight lines.\n"
2415 " :return: a normalized vector.\n"
2416 " :rtype: :class:`mathutils.Vector`\n");
2427 bpy_bmloop_calc_tangent_doc,
2428 ".. method:: calc_tangent()\n"
2430 " Return the tangent at this loops corner of the face (pointing inward into the face).\n"
2431 " Falls back to the face normal for straight lines.\n"
2433 " :return: a normalized vector.\n"
2434 " :rtype: :class:`mathutils.Vector`\n");
2447 bpy_bmvertseq_new_doc,
2448 ".. method:: new(co=(0.0, 0.0, 0.0), example=None)\n"
2450 " Create a new vertex.\n"
2452 " :arg co: The initial location of the vertex (optional argument).\n"
2453 " :type co: float triplet\n"
2454 " :arg example: Existing vert to initialize settings.\n"
2455 " :type example: :class:`BMVert`\n"
2456 " :return: The newly created vertex.\n"
2457 " :rtype: :class:`BMVert`\n");
2460 PyObject *py_co =
nullptr;
2465 if (!PyArg_ParseTuple(args,
"|OO!:verts.new", &py_co, &
BPy_BMVert_Type, &py_vert_example)) {
2471 float co[3] = {0.0f, 0.0f, 0.0f};
2473 if (py_vert_example) {
2484 PyErr_SetString(PyExc_ValueError,
2485 "faces.new(verts): couldn't create the new face, internal error");
2489 if (py_vert_example) {
2490 if (py_vert_example->
bm ==
bm) {
2507 bpy_bmedgeseq_new_doc,
2508 ".. method:: new(verts, example=None)\n"
2510 " Create a new edge from a given pair of verts.\n"
2512 " :arg verts: Vertex pair.\n"
2513 " :type verts: Sequence[:class:`BMVert`]\n"
2514 " :arg example: Existing edge to initialize settings (optional argument).\n"
2515 " :type example: :class:`BMEdge`\n"
2516 " :return: The newly created edge.\n"
2517 " :rtype: :class:`BMEdge`\n");
2525 if (!PyArg_ParseTuple(args,
"O|O!:edges.new", &vert_seq, &
BPy_BMEdge_Type, &py_edge_example)) {
2531 BMVert **vert_array =
nullptr;
2532 Py_ssize_t vert_seq_len;
2533 PyObject *
ret =
nullptr;
2535 if (py_edge_example) {
2540 &
bm, vert_seq, 2, 2, &vert_seq_len,
BM_VERT,
true,
true,
"edges.new(...)"));
2542 if (vert_array ==
nullptr) {
2547 PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists");
2554 PyErr_SetString(PyExc_ValueError,
2555 "faces.new(verts): couldn't create the new face, internal error");
2559 if (py_edge_example) {
2560 if (py_edge_example->
bm ==
bm) {
2574 PyMem_FREE(vert_array);
2583 bpy_bmfaceseq_new_doc,
2584 ".. method:: new(verts, example=None)\n"
2586 " Create a new face from a given set of verts.\n"
2588 " :arg verts: Sequence of 3 or more verts.\n"
2589 " :type verts: Sequence[:class:`BMVert`]\n"
2590 " :arg example: Existing face to initialize settings (optional argument).\n"
2591 " :type example: :class:`BMFace`\n"
2592 " :return: The newly created face.\n"
2593 " :rtype: :class:`BMFace`\n");
2601 if (!PyArg_ParseTuple(args,
"O|O!:faces.new", &vert_seq, &
BPy_BMFace_Type, &py_face_example)) {
2606 Py_ssize_t vert_seq_len;
2608 BMVert **vert_array =
nullptr;
2610 PyObject *
ret =
nullptr;
2614 if (py_face_example) {
2619 &
bm, vert_seq, 3, PY_SSIZE_T_MAX, &vert_seq_len,
BM_VERT,
true,
true,
"faces.new(...)"));
2621 if (vert_array ==
nullptr) {
2627 PyErr_SetString(PyExc_ValueError,
"faces.new(verts): face already exists");
2637 py_face_example ? py_face_example->
f :
nullptr,
2642 PyErr_SetString(PyExc_ValueError,
2643 "faces.new(verts): couldn't create the new face, internal error");
2652 PyMem_FREE(vert_array);
2662 bpy_bmvertseq_remove_doc,
2663 ".. method:: remove(vert)\n"
2667 " :type vert: :class:`BMVert`\n");
2688 bpy_bmedgeseq_remove_doc,
2689 ".. method:: remove(edge)\n"
2691 " Remove an edge.\n"
2693 " :type edge: :class:`BMEdge`\n");
2714 bpy_bmfaceseq_remove_doc,
2715 ".. method:: remove(face)\n"
2719 " :type face: :class:`BMFace`\n");
2740 bpy_bmedgeseq_get__method_doc,
2741 ".. method:: get(verts, fallback=None)\n"
2743 " Return an edge which uses the **verts** passed.\n"
2745 " :arg verts: Sequence of verts.\n"
2746 " :type verts: Sequence[:class:`BMVert`]\n"
2747 " :arg fallback: Return this value if nothing is found.\n"
2748 " :return: The edge found or None\n"
2749 " :rtype: :class:`BMEdge`\n");
2753 PyObject *fallback = Py_None;
2757 if (!PyArg_ParseTuple(args,
"O|O:edges.get", &vert_seq, &fallback)) {
2763 BMVert **vert_array =
nullptr;
2764 Py_ssize_t vert_seq_len;
2765 PyObject *
ret =
nullptr;
2768 &
bm, vert_seq, 2, 2, &vert_seq_len,
BM_VERT,
true,
true,
"edges.get(...)"));
2770 if (vert_array ==
nullptr) {
2782 PyMem_FREE(vert_array);
2788 bpy_bmfaceseq_get__method_doc,
2789 ".. method:: get(verts, fallback=None)\n"
2791 " Return a face which uses the **verts** passed.\n"
2793 " :arg verts: Sequence of verts.\n"
2794 " :type verts: Sequence[:class:`BMVert`]\n"
2795 " :arg fallback: Return this value if nothing is found.\n"
2796 " :return: The face found or None\n"
2797 " :rtype: :class:`BMFace`\n");
2801 PyObject *fallback = Py_None;
2805 if (!PyArg_ParseTuple(args,
"O|O:faces.get", &vert_seq, &fallback)) {
2811 BMVert **vert_array =
nullptr;
2812 Py_ssize_t vert_seq_len;
2813 PyObject *
ret =
nullptr;
2816 &
bm, vert_seq, 1, PY_SSIZE_T_MAX, &vert_seq_len,
BM_VERT,
true,
true,
"faces.get(...)"));
2818 if (vert_array ==
nullptr) {
2831 PyMem_FREE(vert_array);
2837 bpy_bmelemseq_index_update_doc,
2838 ".. method:: index_update()\n"
2840 " Initialize the index values of this sequence.\n"
2842 " This is the equivalent of looping over all elements and assigning the index values.\n"
2844 " .. code-block:: python\n"
2846 " for index, ele in enumerate(sequence):\n"
2847 " ele.index = index\n"
2851 " Running this on sequences besides :class:`BMesh.verts`, :class:`BMesh.edges`, "
2852 ":class:`BMesh.faces`\n"
2853 " works but won't result in each element having a valid index, instead its order in the "
2854 "sequence will be set.\n");
2884 bm->elem_index_dirty |= htype;
2895 bpy_bmelemseq_ensure_lookup_table_doc,
2896 ".. method:: ensure_lookup_table()\n"
2898 " Ensure internal data needed for int subscription is initialized with "
2899 "verts/edges/faces, eg ``bm.verts[index]``.\n"
2901 " This needs to be called again after adding/removing data in this sequence.");
2913 bpy_bmelemseq_sort_doc,
2914 ".. method:: sort(key=None, reverse=False)\n"
2916 " Sort the elements of this sequence, using an optional custom sort key.\n"
2917 " Indices of elements are not changed, :class:`BMElemSeq.index_update` can be used for "
2920 " :arg key: The key that sets the ordering of the elements.\n"
2921 " :type key: Callable[[:class:`BMVert` | :class:`BMEdge` | :class:`BMFace`], int] | None\n"
2922 " :arg reverse: Reverse the order of the elements\n"
2923 " :type reverse: bool\n"
2927 " When the 'key' argument is not provided, the elements are reordered following their "
2928 "current index value.\n"
2929 " In particular this can be used by setting indices manually before calling this "
2934 " Existing references to the N'th element, will continue to point the data at that "
2950 const void *index2_v,
2953 const double *keys =
static_cast<const double *
>(keys_v);
2954 const int *index1 = (
int *)index1_v;
2955 const int *index2 = (
int *)index2_v;
2957 if (keys[*index1] < keys[*index2]) {
2960 if (keys[*index1] > keys[*index2]) {
2968 const void *index2_v,
2976 static const char *kwlist[] = {
"key",
"reverse",
nullptr};
2977 PyObject *keyfunc =
nullptr;
2978 bool do_reverse =
false;
2989 int (*elem_idx_compare_by_keys)(
const void *,
const void *,
void *);
2991 uint *vert_idx =
nullptr;
2992 uint *edge_idx =
nullptr;
2993 uint *face_idx =
nullptr;
3000 if (args !=
nullptr) {
3001 if (!PyArg_ParseTupleAndKeywords(args,
3003 "|$OO&:BMElemSeq.sort",
3011 if (keyfunc == Py_None) {
3016 if (keyfunc !=
nullptr && !PyCallable_Check(keyfunc)) {
3017 PyErr_SetString(PyExc_TypeError,
"the 'key' argument is not a callable object");
3027 keys =
static_cast<double *
>(PyMem_MALLOC(
sizeof(*keys) * n_elem));
3028 if (keys ==
nullptr) {
3035 if (keyfunc !=
nullptr) {
3040 index = PyObject_CallFunctionObjArgs(keyfunc, py_elem,
nullptr);
3042 if (index ==
nullptr) {
3049 if ((keys[
i] = PyFloat_AsDouble(index)) == -1 && PyErr_Occurred()) {
3050 PyErr_SetString(PyExc_ValueError,
3051 "the value returned by the 'key' function is not a number");
3068 elem_idx =
static_cast<int *
>(PyMem_MALLOC(
sizeof(*elem_idx) * n_elem));
3069 if (elem_idx ==
nullptr) {
3086 BLI_qsort_r(elem_idx, n_elem,
sizeof(*elem_idx), elem_idx_compare_by_keys, keys);
3088 elem_map_idx =
static_cast<uint *
>(PyMem_MALLOC(
sizeof(*elem_map_idx) * n_elem));
3089 if (elem_map_idx ==
nullptr) {
3091 PyMem_FREE(elem_idx);
3101 for (
i = 0;
i < n_elem;
i++) {
3102 elem_map_idx[elem_idx[
i]] =
i;
3107 vert_idx = elem_map_idx;
3110 edge_idx = elem_map_idx;
3113 face_idx = elem_map_idx;
3116 PyErr_Format(PyExc_TypeError,
"element type %d not supported",
self->itype);
3117 PyMem_FREE(elem_map_idx);
3118 PyMem_FREE(elem_idx);
3125 PyMem_FREE(elem_map_idx);
3126 PyMem_FREE(elem_idx);
3134# pragma clang diagnostic push
3135# pragma clang diagnostic ignored "-Wcast-function-type"
3137# pragma GCC diagnostic push
3138# pragma GCC diagnostic ignored "-Wcast-function-type"
3144 {
"copy", (PyCFunction)
bpy_bmesh_copy, METH_NOARGS, bpy_bmesh_copy_doc},
3145 {
"clear", (PyCFunction)
bpy_bmesh_clear, METH_NOARGS, bpy_bmesh_clear_doc},
3146 {
"free", (PyCFunction)
bpy_bmesh_free, METH_NOARGS, bpy_bmesh_free_doc},
3151 METH_VARARGS | METH_KEYWORDS,
3152 bpy_bmesh_from_object_doc},
3155 METH_VARARGS | METH_KEYWORDS,
3156 bpy_bmesh_from_mesh_doc},
3157 {
"to_mesh", (PyCFunction)
bpy_bmesh_to_mesh, METH_VARARGS, bpy_bmesh_to_mesh_doc},
3160 {
"select_flush_mode",
3163 bpy_bmesh_select_flush_mode_doc},
3168 bpy_bmesh_normal_update_doc},
3171 METH_VARARGS | METH_KEYWORDS,
3172 bpy_bmesh_transform_doc},
3177 METH_VARARGS | METH_KEYWORDS,
3178 bpy_bmesh_calc_volume_doc},
3179 {
"calc_loop_triangles",
3182 bpy_bmesh_calc_loop_triangles_doc},
3183 {
nullptr,
nullptr, 0,
nullptr},
3190 {
"copy_from_face_interp",
3193 bpy_bmvert_copy_from_face_interp_doc},
3194 {
"copy_from_vert_interp",
3197 bpy_bmvert_copy_from_vert_interp_doc},
3202 bpy_bmvert_calc_edge_angle_doc},
3203 {
"calc_shell_factor",
3206 bpy_bmvert_calc_shell_factor_doc},
3211 bpy_bmvert_normal_update_doc},
3213 {
nullptr,
nullptr, 0,
nullptr},
3227 bpy_bmedge_calc_face_angle_doc},
3228 {
"calc_face_angle_signed",
3231 bpy_bmedge_calc_face_angle_signed_doc},
3235 bpy_bmedge_calc_tangent_doc},
3240 bpy_bmedge_normal_update_doc},
3242 {
nullptr,
nullptr, 0,
nullptr},
3250 {
"copy_from_face_interp",
3253 bpy_bmface_copy_from_face_interp_doc},
3255 {
"copy", (PyCFunction)
bpy_bmface_copy, METH_VARARGS | METH_KEYWORDS, bpy_bmface_copy_doc},
3261 bpy_bmface_calc_perimeter_doc},
3262 {
"calc_tangent_edge",
3265 bpy_bmface_calc_tangent_edge_doc},
3266 {
"calc_tangent_edge_pair",
3269 bpy_bmface_calc_tangent_edge_pair_doc},
3270 {
"calc_tangent_edge_diagonal",
3273 bpy_bmface_calc_tangent_edge_diagonal_doc},
3274 {
"calc_tangent_vert_diagonal",
3277 bpy_bmface_calc_tangent_vert_diagonal_doc},
3278 {
"calc_center_median",
3281 bpy_bmface_calc_center_median_doc},
3282 {
"calc_center_median_weighted",
3285 bpy_bmface_calc_center_median_weighted_doc},
3286 {
"calc_center_bounds",
3289 bpy_bmface_calc_center_bounds_doc},
3294 bpy_bmface_normal_update_doc},
3297 {
nullptr,
nullptr, 0,
nullptr},
3302 {
"copy_from_face_interp",
3305 bpy_bmloop_copy_from_face_interp_doc},
3312 bpy_bmloop_calc_tangent_doc},
3313 {
nullptr,
nullptr, 0,
nullptr},
3321 bpy_bmelemseq_index_update_doc},
3322 {
nullptr,
nullptr, 0,
nullptr},
3333 bpy_bmelemseq_index_update_doc},
3334 {
"ensure_lookup_table",
3337 bpy_bmelemseq_ensure_lookup_table_doc},
3340 METH_VARARGS | METH_KEYWORDS,
3341 bpy_bmelemseq_sort_doc},
3342 {
nullptr,
nullptr, 0,
nullptr},
3355 bpy_bmelemseq_index_update_doc},
3356 {
"ensure_lookup_table",
3359 bpy_bmelemseq_ensure_lookup_table_doc},
3362 METH_VARARGS | METH_KEYWORDS,
3363 bpy_bmelemseq_sort_doc},
3364 {
nullptr,
nullptr, 0,
nullptr},
3377 bpy_bmelemseq_index_update_doc},
3378 {
"ensure_lookup_table",
3381 bpy_bmelemseq_ensure_lookup_table_doc},
3384 METH_VARARGS | METH_KEYWORDS,
3385 bpy_bmelemseq_sort_doc},
3386 {
nullptr,
nullptr, 0,
nullptr},
3393 {
nullptr,
nullptr, 0,
nullptr},
3398# pragma clang diagnostic pop
3400# pragma GCC diagnostic pop
3448 return self->bm->totvert;
3450 return self->bm->totedge;
3452 return self->bm->totface;
3494 switch (
self->itype) {
3496 if (keynum < self->
bm->totvert) {
3501 if (keynum < self->
bm->totedge) {
3506 if (keynum < self->
bm->totface) {
3517 PyErr_SetString(PyExc_IndexError,
3518 "BMElemSeq[index]: outdated internal index table, "
3519 "run ensure_lookup_table() first");
3525 self->bm,
self->itype,
self->py_ele ?
self->py_ele->ele :
nullptr, keynum));
3532 PyErr_Format(PyExc_IndexError,
"BMElemSeq[index]: index %d out of range", keynum);
3549 list = PyList_New(0);
3560 for (ok =
true; ok; ok = (BM_iter_step(&iter) !=
nullptr)) {
3561 if (
count == start) {
3568 while ((ele =
static_cast<BMHeader *
>(BM_iter_step(&iter)))) {
3583 if (PyIndex_Check(key)) {
3584 const Py_ssize_t
i = PyNumber_AsSsize_t(key, PyExc_IndexError);
3585 if (
i == -1 && PyErr_Occurred()) {
3590 if (PySlice_Check(key)) {
3591 PySliceObject *key_slice = (PySliceObject *)key;
3592 Py_ssize_t
step = 1;
3594 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &
step)) {
3598 PyErr_SetString(PyExc_TypeError,
"BMElemSeq[slice]: slice steps not supported");
3601 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
3605 Py_ssize_t start = 0,
stop = PY_SSIZE_T_MAX;
3608 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
3611 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &
stop)) {
3615 if (start < 0 ||
stop < 0) {
3628 if (
stop - start <= 0) {
3629 return PyList_New(0);
3635 PyErr_SetString(PyExc_AttributeError,
"BMElemSeq[key]: invalid key, key must be an int");
3645 if (value_bm_ele->
bm ==
self->bm) {
3646 BMElem *ele, *ele_test = value_bm_ele->
ele;
3649 if (ele == ele_test) {
3693 (objobjargproc)
nullptr,
3714 return (PyObject *)py_iter;
3720 if (ele ==
nullptr) {
3721 PyErr_SetNone(PyExc_StopIteration);
3752 bm->py_handle =
nullptr;
3766 void **
ptr =
static_cast<void **
>(
3779 void **
ptr =
static_cast<void **
>(
3792 void **
ptr =
static_cast<void **
>(
3805 void **
ptr =
static_cast<void **
>(
3816 Py_XDECREF(
self->py_ele);
3838 "The BMesh data structure\n");
3842 "The BMesh vertex type\n");
3846 "The BMesh edge connecting 2 verts\n");
3850 "The BMesh face with 3 or more sides\n");
3854 "This is normally accessed from :class:`BMFace.loops` where each face loop "
3855 "represents a corner of the face.\n");
3859 "General sequence type used for accessing any sequence of\n"
3860 ":class:`BMVert`, :class:`BMEdge`, :class:`BMFace`, :class:`BMLoop`.\n"
3862 "When accessed via :class:`BMesh.verts`, :class:`BMesh.edges`, :class:`BMesh.faces`\n"
3863 "there are also functions to create/remove items.\n");
3867 "Internal BMesh type for looping over verts/faces/edges,\n"
3868 "used for iterating over :class:`BMElemSeq` types.\n");
3875 return PyUnicode_FromFormat(
"<BMesh(%p), totvert=%d, totedge=%d, totface=%d, totloop=%d>",
3883 return PyUnicode_FromFormat(
"<BMesh dead at %p>",
self);
3895 return PyUnicode_FromFormat(
"<BMVert dead at %p>",
self);
3904 return PyUnicode_FromFormat(
"<BMEdge(%p), index=%d, verts=(%p/%d, %p/%d)>",
3913 return PyUnicode_FromFormat(
"<BMEdge dead at %p>",
self);
3922 return PyUnicode_FromFormat(
3926 return PyUnicode_FromFormat(
"<BMFace dead at %p>",
self);
3935 return PyUnicode_FromFormat(
"<BMLoop(%p), index=%d, vert=%p/%d, edge=%p/%d, face=%p/%d>",
3946 return PyUnicode_FromFormat(
"<BMLoop dead at %p>",
self);
4135 PyObject *submodule;
4175 if (
bm->py_handle) {
4195 return (PyObject *)
self;
4202 void **
ptr =
static_cast<void **
>(
4211 if (*
ptr !=
nullptr) {
4222 return (PyObject *)
self;
4229 void **
ptr =
static_cast<void **
>(
4238 if (*
ptr !=
nullptr) {
4249 return (PyObject *)
self;
4256 void **
ptr =
static_cast<void **
>(
4265 if (*
ptr !=
nullptr) {
4276 return (PyObject *)
self;
4283 void **
ptr =
static_cast<void **
>(
4292 if (*
ptr !=
nullptr) {
4303 return (PyObject *)
self;
4310 self->py_ele = py_ele;
4313 return (PyObject *)
self;
4320 self->py_ele =
nullptr;
4322 return (PyObject *)
self;
4329 self->py_ele =
nullptr;
4331 return (PyObject *)
self;
4338 self->py_ele =
nullptr;
4340 return (PyObject *)
self;
4347 self->py_ele =
nullptr;
4349 return (PyObject *)
self;
4357 return (PyObject *)
self;
4362 switch (ele->
htype) {
4373 PyErr_SetString(PyExc_SystemError,
"internal error");
4390 PyExc_ReferenceError,
"BMesh used by %.200s has become invalid", Py_TYPE(
self)->tp_name);
4399 PyExc_ReferenceError,
"BMesh data of type %.200s has been removed", Py_TYPE(
self)->tp_name);
4404 const char *error_prefix,
4410 while (args_tot--) {
4423 PyErr_Format(PyExc_ValueError,
4424 "%.200s: BMesh data of type %.200s is from another mesh",
4426 Py_TYPE(py_bm_elem)->tp_name);
4447 const bool do_unique_check,
4448 const bool do_bm_check,
4449 const char *error_prefix)
4451 BMesh *
bm = (r_bm && *r_bm) ? *r_bm :
nullptr;
4452 PyObject **seq_fast_items = PySequence_Fast_ITEMS(seq_fast);
4453 const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast);
4454 Py_ssize_t
i, i_last_dirty = PY_SSIZE_T_MAX;
4461 if (seq_len < min || seq_len >
max) {
4462 PyErr_Format(PyExc_TypeError,
4463 "%s: sequence incorrect size, expected [%d - %d], given %d",
4472 alloc =
static_cast<BMElem **
>(PyMem_MALLOC(seq_len *
sizeof(
BPy_BMElem **)));
4474 for (
i = 0;
i < seq_len;
i++) {
4478 PyErr_Format(PyExc_TypeError,
4479 "%s: expected %.200s, not '%.200s'",
4482 Py_TYPE(item)->tp_name);
4487 PyExc_TypeError,
"%s: %d %s has been removed", error_prefix,
i, Py_TYPE(item)->tp_name);
4492 else if (do_bm_check && (
bm &&
bm != item->
bm)) {
4493 PyErr_Format(PyExc_ValueError,
4494 "%s: %d %s is from another mesh",
4501 if (
bm ==
nullptr) {
4505 alloc[
i] = item->
ele;
4507 if (do_unique_check) {
4513 if (do_unique_check) {
4516 for (
i = 0;
i < seq_len;
i++) {
4527 i_last_dirty = PY_SSIZE_T_MAX;
4528 PyErr_Format(PyExc_ValueError,
4529 "%s: found the same %.200s used multiple times",
4543 if (do_unique_check && (i_last_dirty != PY_SSIZE_T_MAX)) {
4544 for (
i = 0;
i <= i_last_dirty;
i++) {
4558 const bool do_unique_check,
4559 const bool do_bm_check,
4560 const char *error_prefix)
4565 if (!(seq_fast = PySequence_Fast(seq, error_prefix))) {
4570 r_bm, seq_fast,
min,
max, r_size, htype, do_unique_check, do_bm_check, error_prefix));
4572 Py_DECREF(seq_fast);
4579 PyObject *
ret = PyTuple_New(elem_len);
4580 for (
i = 0;
i < elem_len;
i++) {
4588 PyObject *
ret = PyTuple_New(elem_len);
4589 for (
i = 0;
i < elem_len;
i++) {
4597 PyObject *
ret = PyTuple_New(elem_len);
4598 for (
i = 0;
i < elem_len;
i++) {
4607 PyObject *
ret = PyTuple_New(elem_len);
4608 for (
i = 0;
i < elem_len;
i++) {
4617 PyObject *
ret = PyTuple_New(elem_len);
4618 for (
i = 0;
i < elem_len;
i++) {
4636 const char *ret_array[4];
4653 ret[ret_ofs + 1] =
'\0';
4659 static char ret[32];
CustomData interface, see also DNA_customdata_types.h.
BMCustomDataCopyMap CustomData_bmesh_copy_map_calc(const CustomData &src, const CustomData &dst, eCustomDataMask mask_exclude=0)
void * CustomData_bmesh_get(const CustomData *data, void *block, eCustomDataType type)
const CustomData_MeshMasks CD_MASK_BMESH
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
void BKE_id_free(Main *bmain, void *idv)
bool BKE_id_is_in_global_main(ID *id)
Mesh * BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers, bool preserve_origindex, bool ensure_subdivision)
General operations, lookup, etc. for blender objects.
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
#define BLI_assert_unreachable()
MINLINE float clamp_f(float value, float min, float max)
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void range_vn_i(int *array_tar, int size, int start)
void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk)
size_t BLI_string_join_array_by_sep_char(char *result, size_t result_maxncpy, char sep, const char *strings[], uint strings_num) ATTR_NONNULL()
#define POINTER_AS_INT(i)
void DEG_id_tag_update(ID *id, unsigned int flags)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
@ ID_RECALC_GEOMETRY_ALL_MODES
Object is a sort of wrapper for general info.
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
BMesh * BM_mesh_copy(BMesh *bm_old)
void BM_vert_kill(BMesh *bm, BMVert *v)
void BM_face_kill(BMesh *bm, BMFace *f)
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
BMFace * BM_face_copy(BMesh *bm_dst, const BMCustomDataCopyMap &cd_face_map, const BMCustomDataCopyMap &cd_loop_map, BMFace *f, const bool copy_verts, const bool copy_edges)
void BM_edge_kill(BMesh *bm, BMEdge *e)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_vert_interp_from_face(BMesh *bm, BMVert *v_dst, const BMFace *f_src)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, const bool do_vertex)
void BM_loop_interp_from_face(BMesh *bm, BMLoop *l_dst, const BMFace *f_src, const bool do_vertex, const bool do_multires)
void BM_data_interp_from_verts(BMesh *bm, const BMVert *v_src_1, const BMVert *v_src_2, BMVert *v_dst, const float fac)
Data, Interpolate From Verts.
void * BM_iter_at_index(BMesh *bm, const char itype, void *data, int index)
const char bm_iter_itype_htype_map[BM_ITYPE_MAX]
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_iter_init(iter, bm, itype, data)
BMIterType
BMesh Iterators.
BMesh const char void * data
void BM_mesh_select_mode_flush(BMesh *bm)
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
void BM_mesh_select_flush(BMesh *bm)
void BM_mesh_deselect_flush(BMesh *bm)
#define BM_elem_hide_set(bm, ele, hide)
void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx)
void BM_mesh_clear(BMesh *bm)
BMesh Clear Mesh.
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
int BM_mesh_elem_count(BMesh *bm, const char htype)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
void BM_mesh_normals_update(BMesh *bm)
void BM_mesh_calc_tessellation(BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris)
bool BM_mesh_validate(BMesh *bm)
void BM_face_calc_tangent_from_vert_diagonal(const BMFace *f, float r_tangent[3])
void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
void BM_vert_normal_update(BMVert *v)
void BM_face_calc_tangent_from_edge_pair(const BMFace *f, float r_tangent[3])
void BM_face_normal_update(BMFace *f)
void BM_face_normal_flip(BMesh *bm, BMFace *f)
float BM_face_calc_area(const BMFace *f)
void BM_face_calc_tangent_from_edge(const BMFace *f, float r_tangent[3])
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
void BM_face_calc_tangent_from_edge_diagonal(const BMFace *f, float r_tangent[3])
void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
float BM_face_calc_perimeter(const BMFace *f)
void BM_edge_normals_update(BMEdge *e)
static Py_hash_t bpy_bm_hash(PyObject *self)
PyObject * BPy_BMEdgeSeq_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmedge_calc_face_angle_signed(BPy_BMEdge *self, PyObject *args)
static void bpy_bmvert_dealloc(BPy_BMElem *self)
PyObject * BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f)
static PyObject * bpy_bmvert_normal_update(BPy_BMVert *self)
static PyObject * bpy_bmloop_vert_get(BPy_BMLoop *self, void *)
static Py_hash_t bpy_bm_elem_hash(PyObject *self)
static PyObject * bpy_bmloop_link_loop_prev_get(BPy_BMLoop *self, void *)
PyC_FlagSet bpy_bm_htype_all_flags[]
static PyMappingMethods bpy_bmelemseq_as_mapping
static PyObject * bpy_bmesh_normal_update(BPy_BMesh *self)
static PyObject * bpy_bmesh_select_flush_mode(BPy_BMesh *self)
static PyObject * bpy_bmface_calc_center_bounds(BPy_BMFace *self)
PyObject * BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_len)
static int bpy_bmvert_co_set(BPy_BMVert *self, PyObject *value, void *)
static PyObject * bpy_bmface_normal_update(BPy_BMFace *self)
static PyObject * bpy_bmvertseq_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmesh_clear(BPy_BMesh *self)
static PyObject * bpy_bmesh_select_history_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmesh_calc_loop_triangles(BPy_BMElem *self)
PyObject * BPy_BMLoopSeq_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmvert_calc_edge_angle(BPy_BMVert *self, PyObject *args)
PyObject * BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len)
PyObject * BPy_BMFaceSeq_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmloop_link_loop_radial_next_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmloop_calc_tangent(BPy_BMLoop *self)
static PyObject * bpy_bmelemseq_iter(BPy_BMElemSeq *self)
static PyGetSetDef bpy_bmvertseq_getseters[]
PyObject * BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
static PyObject * bpy_bmface_calc_tangent_vert_diagonal(BPy_BMFace *self)
static PyGetSetDef bpy_bmloopseq_getseters[]
static PyObject * bpy_bmloop_calc_normal(BPy_BMLoop *self)
PyObject * BPy_BMesh_CreatePyObject(BMesh *bm, int flag)
PyObject * BPy_BMVert_Array_As_Tuple(BMesh *bm, BMVert **elem, Py_ssize_t elem_len)
static PyObject * bpy_bmedge_is_contiguous_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmvert_is_boundary_get(BPy_BMVert *self, void *)
PyTypeObject BPy_BMesh_Type
PyObject * BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype)
static PyObject * bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *)
static PyModuleDef BPy_BM_types_module_def
static PyObject * bpy_bmloop_is_convex_get(BPy_BMLoop *self, void *)
PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[]
PyObject * BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v)
PyObject * BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l)
static PyMethodDef bpy_bmedgeseq_methods[]
static PyObject * bpy_bmvert_calc_shell_factor(BPy_BMVert *self)
static PyObject * bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmface_normal_get(BPy_BMFace *self, void *)
static PyObject * bpy_bmloop_edge_get(BPy_BMLoop *self, void *)
PyObject * BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop *const *elem, Py_ssize_t elem_len)
static PyMappingMethods bpy_bm_elem_as_mapping
static PyObject * bpy_bmloop_calc_angle(BPy_BMLoop *self)
static PyObject * bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value)
char * BPy_BMElem_StringFromHType(const char htype)
static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyObject *value)
static PyObject * bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
static PyObject * bpy_bmloop_link_loop_next_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmloop_link_loop_radial_prev_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmedge_calc_face_angle(BPy_BMEdge *self, PyObject *args)
static PyObject * bpy_bmelemseq_elem_get(BPy_BMElem *self, void *itype)
static void bm_dealloc_editmode_warn(BPy_BMesh *self)
static PyObject * bpy_bmedge_is_wire_get(BPy_BMEdge *self, void *)
PyTypeObject BPy_BMVertSeq_Type
PyTypeObject BPy_BMLoopSeq_Type
static PyObject * bpy_bmface_repr(BPy_BMFace *self)
static void bpy_bmedge_dealloc(BPy_BMElem *self)
static int bpy_bmvert_normal_set(BPy_BMVert *self, PyObject *value, void *)
static PyObject * bpy_bmesh_repr(BPy_BMesh *self)
static PyGetSetDef bpy_bmvert_getseters[]
PyObject * BPy_BMVertSeq_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmedge_normal_update(BPy_BMEdge *self)
static PyObject * bpy_bmedge_repr(BPy_BMEdge *self)
static PyMethodDef bpy_bmedge_methods[]
static void bpy_bmloop_dealloc(BPy_BMElem *self)
static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq *self)
char * BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
static PyObject * bpy_bmvert_is_wire_get(BPy_BMVert *self, void *)
static PyGetSetDef bpy_bmesh_getseters[]
void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
PyObject * BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_len)
static PyMethodDef bpy_bmvert_methods[]
static PyObject * bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
static int bpy_bmface_normal_set(BPy_BMFace *self, PyObject *value, void *)
static PyObject * bpy_bmloop_face_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmesh_copy(BPy_BMesh *self)
static PyObject * bpy_bmedge_calc_tangent(BPy_BMEdge *self, PyObject *args)
static PyObject * bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
PyTypeObject BPy_BMEdgeSeq_Type
static PyObject * bpy_bmvert_is_manifold_get(BPy_BMVert *self, void *)
static PyObject * bpy_bmedge_is_convex_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args)
static PyObject * bpy_bmface_calc_tangent_edge_diagonal(BPy_BMFace *self)
static PyObject * bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value)
PyTypeObject BPy_BMEdge_Type
static PyObject * bpy_bmedge_calc_length(BPy_BMEdge *self)
static PyMethodDef bpy_bmelemseq_methods[]
static PyObject * bpy_bmedgeseq_get(BPy_BMesh *self, void *)
void * BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, const char htype, const bool do_unique_check, const bool do_bm_check, const char *error_prefix)
static PyObject * bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args)
static PyObject * bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
static PyObject * bpy_bmface_calc_tangent_edge_pair(BPy_BMFace *self)
static PyTypeObject * bpy_bm_itype_as_pytype(const char itype)
static PyObject * bpy_bmface_normal_flip(BPy_BMFace *self)
static PyObject * bpy_bmedge_is_manifold_get(BPy_BMEdge *self, void *)
static PyGetSetDef bpy_bmfaceseq_getseters[]
static PyObject * bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
static PyObject * bpy_bmloop_repr(BPy_BMLoop *self)
static PyGetSetDef bpy_bmedge_getseters[]
static int bpy_bmfaceseq_active_set(BPy_BMElem *self, PyObject *value, void *)
static PyObject * bpy_bmelemseq_index_update(BPy_BMElemSeq *self)
static PyObject * bpy_bm_is_valid_get(BPy_BMGeneric *self, void *)
static int bpy_bmelemseq_sort_cmp_by_keys_descending(const void *index1_v, const void *index2_v, void *keys_v)
static PyObject * bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject *kw)
int bpy_bm_generic_valid_check_source(BMesh *bm_source, const char *error_prefix, void **args, uint args_tot)
static PyObject * bpy_bmvert_co_get(BPy_BMVert *self, void *)
static PyObject * bpy_bmesh_select_mode_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
static PyMethodDef bpy_bmfaceseq_methods[]
static PyObject * bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
static PyMethodDef bpy_bmloopseq_methods[]
static PyObject * bpy_bmedge_is_boundary_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
static PyGetSetDef bpy_bmedgeseq_getseters[]
static PyObject * bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t start, Py_ssize_t stop)
static void bpy_bmelemseq_dealloc(BPy_BMElemSeq *self)
int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
static PyObject * bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, Py_ssize_t keynum)
static PyObject * bpy_bmface_calc_perimeter(BPy_BMFace *self)
void * BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm, PyObject *seq_fast, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, const char htype, const bool do_unique_check, const bool do_bm_check, const char *error_prefix)
static void bpy_bmface_dealloc(BPy_BMElem *self)
PyTypeObject BPy_BMFaceSeq_Type
PyTypeObject BPy_BMVert_Type
PyTypeObject BPy_BMIter_Type
static int bpy_bmface_material_index_set(BPy_BMFace *self, PyObject *value, void *)
static PyObject * bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *args)
static int bpy_bmesh_select_history_set(BPy_BMesh *self, PyObject *value, void *)
static PyMethodDef bpy_bmface_methods[]
static PyMethodDef bpy_bmloop_methods[]
static PyObject * bpy_bmface_calc_center_mean(BPy_BMFace *self)
static PyObject * bpy_bm_elem_index_get(BPy_BMElem *self, void *)
PyDoc_STRVAR(bpy_bm_elem_select_doc, "Selected state of this element.\n" "\n" ":type: bool")
static PyObject * bpy_bmface_calc_tangent_edge(BPy_BMFace *self)
#define BPY_BM_HFLAG_ALL_STR
static PyObject * bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObject *kw)
PyTypeObject BPy_BMElemSeq_Type
static PyMethodDef bpy_bmesh_methods[]
static PyObject * bpy_bmfaceseq_active_get(BPy_BMElemSeq *self, void *)
static PyObject * bpy_bmloopseq_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmvert_normal_get(BPy_BMVert *self, void *)
static PyObject * bpy_bmelemseq_ensure_lookup_table(BPy_BMElemSeq *self)
static PyGetSetDef bpy_bmface_getseters[]
static PyObject * bpy_bmfaceseq_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmiter_next(BPy_BMIter *self)
static PyObject * bpy_bmesh_free(BPy_BMesh *self)
PyTypeObject BPy_BMFace_Type
static PyObject * bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw)
static int bpy_bmesh_select_mode_set(BPy_BMesh *self, PyObject *value, void *)
static int bpy_bmelemseq_sort_cmp_by_keys_ascending(const void *index1_v, const void *index2_v, void *keys_v)
static PyObject * bpy_bmface_calc_center_median_weighted(BPy_BMFace *self)
static void bpy_bmesh_dealloc(BPy_BMesh *self)
static PyGetSetDef bpy_bmloop_getseters[]
static PyObject * bpy_bmface_calc_area(BPy_BMFace *self)
PyTypeObject BPy_BMLoop_Type
PyObject * BPy_BMIter_CreatePyObject(BMesh *bm)
static int bpy_bmelemseq_contains(BPy_BMElemSeq *self, PyObject *value)
static PyObject * bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args)
PyC_FlagSet bpy_bm_hflag_all_flags[]
static PyMethodDef bpy_bmvertseq_methods[]
static PyObject * bpy_bmvert_copy_from_face_interp(BPy_BMVert *self, PyObject *args)
PyC_FlagSet bpy_bm_scene_vert_edge_face_flags[]
int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype)
static PyObject * bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value)
static PySequenceMethods bpy_bmelemseq_as_sequence
static PyObject * bpy_bmelem_subscript(BPy_BMElem *self, BPy_BMLayerItem *key)
static PyObject * bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
static PyObject * bpy_bmface_material_index_get(BPy_BMFace *self, void *)
static PyObject * bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value)
PyObject * BPyInit_bmesh_types()
PyObject * BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e)
static PyObject * bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *args)
static PyObject * bpy_bmesh_is_wrapped_get(BPy_BMesh *self, void *)
static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
static PyObject * bpy_bm_elem_copy_from(BPy_BMElem *self, BPy_BMElem *value)
static PyObject * bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
static PyObject * bpy_bmvert_repr(BPy_BMVert *self)
#define BPy_BMFace_Check(v)
#define BPY_BM_CHECK_OBJ(obj)
#define BPY_BM_CHECK_SOURCE_INT(bm, errmsg,...)
#define BPy_BMVert_Check(v)
#define BPy_BMElem_Check(v)
#define BPy_BMesh_Check(v)
#define BPy_BMEdge_Check(v)
#define BPY_BM_CHECK_SOURCE_OBJ(bm, errmsg,...)
#define BPY_BM_IS_VALID(obj)
#define BM_ITER_BPY_BM_SEQ(ele, iter, bpy_bmelemseq)
#define BPY_BM_CHECK_INT(obj)
PyTypeObject BPy_BMLayerCollection_Type
PyObject * BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype)
PyTypeObject BPy_BMLayerItem_Type
PyTypeObject BPy_BMLayerAccessLoop_Type
PyTypeObject BPy_BMLayerAccessVert_Type
int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *py_value)
PyTypeObject BPy_BMLayerAccessFace_Type
PyTypeObject BPy_BMLayerAccessEdge_Type
PyObject * BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
BMElem.__getitem__() / setitem().
PyTypeObject BPy_BMDeformVert_Type
PyTypeObject BPy_BMLoopUV_Type
int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
PyTypeObject BPy_BMEditSelSeq_Type
PyTypeObject BPy_BMEditSelIter_Type
PyObject * BPy_BMEditSel_CreatePyObject(BMesh *bm)
bool BM_vert_is_wire(const BMVert *v)
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
BMFace * BM_face_exists(BMVert *const *varr, int len)
bool BM_vert_is_manifold(const BMVert *v)
float BM_vert_calc_shell_factor(const BMVert *v)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback)
BMESH VERT/EDGE ANGLE.
float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback)
BMESH EDGE/FACE ANGLE.
bool BM_loop_is_convex(const BMLoop *l)
double BM_mesh_calc_volume(BMesh *bm, bool is_signed)
float BM_loop_calc_face_angle(const BMLoop *l)
float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, const float fallback)
BMESH EDGE/FACE ANGLE.
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
float BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3])
BM_loop_calc_face_normal.
bool BM_vert_is_boundary(const BMVert *v)
bool BM_edge_is_convex(const BMEdge *e)
BLI_INLINE bool BM_edge_is_contiguous(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define CD_MASK_BM_ELEM_PYPTR
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
#define BaseMath_ReadCallback(_self)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
PyObject * Vector_CreatePyObject_wrap(float *vec, const int vec_num, PyTypeObject *base_type)
Mesh * mesh_get_eval_deform(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
void * PyC_RNA_AsPointer(PyObject *value, const char *type_name)
int PyC_Long_AsBool(PyObject *value)
int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
int PyC_ParseBool(PyObject *o, void *p)
PyObject * PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag)
header-only compatibility defines.
PyObject_VAR_HEAD BMesh * bm
PyObject_VAR_HEAD BMesh * bm
PyObject_VAR_HEAD BMesh * bm
PyObject_VAR_HEAD BMesh * bm
MeshRuntimeHandle * runtime