79#define BPY_BM_HTYPE_NOLOOP "'VERT', 'EDGE', 'FACE'"
82#define BPY_BM_HFLAG_ALL_STR "'SELECT', 'HIDE', 'SEAM', 'SMOOTH', 'TAG'"
113 bpy_bm_elem_select_doc,
114 "Selected state of this element.\n"
119 bpy_bm_elem_hide_doc,
120 "Hidden state of this element.\n"
126 "Generic attribute scripts can use for own logic\n"
131 bpy_bm_elem_smooth_doc,
132 "Smooth state of this element.\n"
137 bpy_bm_elem_seam_doc,
138 "Seam for UV unwrapping.\n"
143 bpy_bm_elem_uv_select_doc,
144 "UV selected state of this element.\n"
149 bpy_bm_elem_uv_select_vert_doc,
150 "UV vertex selected state of this loop.\n"
155 bpy_bm_elem_uv_select_edge_doc,
156 "UV edge selected state of this loop.\n"
191 bpy_bm_elem_index_doc,
192 "Index of this element.\n"
198 " This value is not necessarily valid, while editing the mesh it can become *dirty*.\n"
200 " It's also possible to assign any number to this attribute for a scripts internal logic.\n"
202 " To ensure the value is up to date - see :meth:`bmesh.types.BMElemSeq.index_update`.\n");
216 if (((param = PyC_Long_AsI32(value)) == -1) && PyErr_Occurred()) {
240 "This mesh's vert sequence (read-only).\n"
242 ":type: :class:`bmesh.types.BMVertSeq`\n");
252 "This mesh's edge sequence (read-only).\n"
254 ":type: :class:`bmesh.types.BMEdgeSeq`\n");
264 "This mesh's face sequence (read-only).\n"
266 ":type: :class:`bmesh.types.BMFaceSeq`\n");
276 "This mesh's loops (read-only).\n"
278 ":type: :class:`bmesh.types.BMLoopSeq`\n"
282 " Loops must be accessed via faces, this is only exposed for layer access.\n");
292 bpy_bmvert_link_edges_doc,
293 "Edges connected to this vertex (read-only).\n"
295 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMEdge`]\n");
298 bpy_bmvert_link_faces_doc,
299 "Faces connected to this vertex (read-only).\n"
301 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMFace`]\n");
304 bpy_bmvert_link_loops_doc,
305 "Loops that use this vertex (read-only).\n"
307 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMLoop`]\n");
311 bpy_bmedge_verts_doc,
312 "Verts this edge uses (always 2), (read-only).\n"
314 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMVert`]\n");
317 bpy_bmedge_link_faces_doc,
318 "Faces connected to this edge, (read-only).\n"
320 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMFace`]\n");
323 bpy_bmedge_link_loops_doc,
324 "Loops connected to this edge, (read-only).\n"
326 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMLoop`]\n");
330 bpy_bmface_verts_doc,
331 "Verts of this face, (read-only).\n"
333 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMVert`]\n");
336 bpy_bmface_edges_doc,
337 "Edges of this face, (read-only).\n"
339 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMEdge`]\n");
342 bpy_bmface_loops_doc,
343 "Loops of this face, (read-only).\n"
345 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMLoop`]\n");
349 bpy_bmloops_link_loops_doc,
350 "Loops connected to this loop, (read-only).\n"
352 ":type: :class:`bmesh.types.BMElemSeq`\\ [:class:`bmesh.types.BMLoop`]\n");
363 "True when this element is valid (hasn't been freed or removed).\n"
373 bpy_bmesh_is_wrapped_doc,
374 "True when this mesh is owned by blender (typically the editmode BMesh).\n"
386 bpy_bmesh_select_mode_doc,
387 "The selection mode, cannot be assigned an empty set.\n"
408 PyErr_SetString(PyExc_TypeError,
"bm.select_mode: cannot assign an empty value");
418 bpy_bmesh_select_history_doc,
419 "Sequence of selected items (the last is displayed as active).\n"
422 ":class:`bmesh.types.BMEditSelSeq`\n");
439 bpy_bmesh_uv_select_sync_valid_doc,
440 "When true, the UV selection has been synchronized. "
441 "Setting to False means the UV selection will be ignored. "
442 "While setting to true is supported it is up to the script author to "
443 "ensure a correct selection state before doing so.\n"
471 "The coordinates for this vertex as a 3D, wrapped vector.\n"
474 ":class:`mathutils.Vector`\n");
494 bpy_bmvert_normal_doc,
495 "The normal for this vertex as a 3D, wrapped vector.\n"
497 ":type: :class:`mathutils.Vector`\n");
517 bpy_bmvert_is_manifold_doc,
518 "True when this vertex is manifold (read-only).\n"
529 bpy_bmvert_is_wire_doc,
530 "True when this vertex is not connected to any faces (read-only).\n"
541 bpy_bmvert_is_boundary_doc,
542 "True when this vertex is connected to boundary edges (read-only).\n"
556 bpy_bmedge_is_manifold_doc,
557 "True when this edge is manifold (read-only).\n"
568 bpy_bmedge_is_contiguous_doc,
569 "True when this edge is manifold, between two faces with the same winding "
581 bpy_bmedge_is_convex_doc,
582 "True when this edge joins two convex faces, depends on a valid face normal (read-only).\n"
593 bpy_bmedge_is_wire_doc,
594 "True when this edge is not connected to any faces (read-only).\n"
605 bpy_bmedge_is_boundary_doc,
606 "True when this edge is at the boundary of a face (read-only).\n"
620 bpy_bmface_normal_doc,
621 "The normal for this face as a 3D, wrapped vector.\n"
623 ":type: :class:`mathutils.Vector`\n");
643 bpy_bmface_material_index_doc,
644 "The face's material index.\n"
650 return PyLong_FromLong(self->
f->
mat_nr);
659 if (((param = PyC_Long_AsI32(value)) == -1) && PyErr_Occurred()) {
664 if ((param < 0) || (param >
MAXMAT)) {
666 PyErr_SetString(PyExc_ValueError,
"material index outside of usable range (0 - 32766)");
670 self->
f->
mat_nr = short(param);
680 "The loop's vertex (read-only).\n"
682 ":type: :class:`bmesh.types.BMVert`\n");
692 "The loop's edge (between this loop and the next), (read-only).\n"
694 ":type: :class:`bmesh.types.BMEdge`\n");
704 "The face this loop belongs to (read-only).\n"
706 ":type: :class:`bmesh.types.BMFace`\n");
715 bpy_bmloop_link_loop_next_doc,
716 "The next face corner (read-only).\n"
718 ":type: :class:`bmesh.types.BMLoop`\n");
727 bpy_bmloop_link_loop_prev_doc,
728 "The previous face corner (read-only).\n"
730 ":type: :class:`bmesh.types.BMLoop`\n");
739 bpy_bmloop_link_loop_radial_next_doc,
740 "The next loop around the edge (read-only).\n"
742 ":type: :class:`bmesh.types.BMLoop`\n");
751 bpy_bmloop_link_loop_radial_prev_doc,
752 "The previous loop around the edge (read-only).\n"
754 ":type: :class:`bmesh.types.BMLoop`\n");
763 bpy_bmloop_is_convex_doc,
764 "True when this loop is at the convex corner of a face, depends on a valid face "
765 "normal (read-only).\n"
780 bpy_bmelemseq_layers_vert_doc,
781 "custom-data layers (read-only).\n"
783 ":type: :class:`bmesh.types.BMLayerAccessVert`\n");
786 bpy_bmelemseq_layers_edge_doc,
787 "custom-data layers (read-only).\n"
789 ":type: :class:`bmesh.types.BMLayerAccessEdge`\n");
792 bpy_bmelemseq_layers_face_doc,
793 "custom-data layers (read-only).\n"
795 ":type: :class:`bmesh.types.BMLayerAccessFace`\n");
798 bpy_bmelemseq_layers_loop_doc,
799 "custom-data layers (read-only).\n"
801 ":type: :class:`bmesh.types.BMLayerAccessLoop`\n");
814 bpy_bmfaceseq_active_doc,
817 ":type: :class:`bmesh.types.BMFace` | None\n");
832 const char *error_prefix =
"faces.active = f";
834 if (value == Py_None) {
845 PyErr_Format(PyExc_TypeError,
846 "%s: expected BMFace or None, not %.200s",
848 Py_TYPE(value)->tp_name);
855 static_cast<setter
>(
nullptr),
860 static_cast<setter
>(
nullptr),
865 static_cast<setter
>(
nullptr),
870 static_cast<setter
>(
nullptr),
876 bpy_bmesh_select_mode_doc,
882 bpy_bmesh_select_history_doc,
885 {
"uv_select_sync_valid",
888 bpy_bmesh_uv_select_sync_valid_doc,
894 static_cast<setter
>(
nullptr),
895 bpy_bmesh_is_wrapped_doc,
899 static_cast<setter
>(
nullptr),
903 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
911 bpy_bm_elem_select_doc,
916 bpy_bm_elem_hide_doc,
926 bpy_bm_elem_index_doc,
937 bpy_bmvert_normal_doc,
943 static_cast<setter
>(
nullptr),
944 bpy_bmvert_link_edges_doc,
948 static_cast<setter
>(
nullptr),
949 bpy_bmvert_link_faces_doc,
953 static_cast<setter
>(
nullptr),
954 bpy_bmvert_link_loops_doc,
960 static_cast<setter
>(
nullptr),
961 bpy_bmvert_is_manifold_doc,
965 static_cast<setter
>(
nullptr),
966 bpy_bmvert_is_wire_doc,
970 static_cast<setter
>(
nullptr),
971 bpy_bmvert_is_boundary_doc,
975 static_cast<setter
>(
nullptr),
979 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
987 bpy_bm_elem_select_doc,
992 bpy_bm_elem_hide_doc,
1002 bpy_bm_elem_index_doc,
1008 bpy_bm_elem_smooth_doc,
1013 bpy_bm_elem_seam_doc,
1019 static_cast<setter
>(
nullptr),
1020 bpy_bmedge_verts_doc,
1025 static_cast<setter
>(
nullptr),
1026 bpy_bmedge_link_faces_doc,
1030 static_cast<setter
>(
nullptr),
1031 bpy_bmedge_link_loops_doc,
1037 static_cast<setter
>(
nullptr),
1038 bpy_bmedge_is_manifold_doc,
1042 static_cast<setter
>(
nullptr),
1043 bpy_bmedge_is_contiguous_doc,
1047 static_cast<setter
>(
nullptr),
1048 bpy_bmedge_is_convex_doc,
1052 static_cast<setter
>(
nullptr),
1053 bpy_bmedge_is_wire_doc,
1057 static_cast<setter
>(
nullptr),
1058 bpy_bmedge_is_boundary_doc,
1062 static_cast<setter
>(
nullptr),
1063 bpy_bm_is_valid_doc,
1066 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1074 bpy_bm_elem_select_doc,
1079 bpy_bm_elem_hide_doc,
1084 bpy_bm_elem_tag_doc,
1089 bpy_bm_elem_uv_select_doc,
1094 bpy_bm_elem_index_doc,
1100 bpy_bm_elem_smooth_doc,
1106 bpy_bmface_normal_doc,
1112 bpy_bmface_material_index_doc,
1118 static_cast<setter
>(
nullptr),
1119 bpy_bmface_verts_doc,
1123 static_cast<setter
>(
nullptr),
1124 bpy_bmface_edges_doc,
1128 static_cast<setter
>(
nullptr),
1129 bpy_bmface_loops_doc,
1135 static_cast<setter
>(
nullptr),
1136 bpy_bm_is_valid_doc,
1139 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1149 bpy_bm_elem_select_doc,
1154 bpy_bm_elem_hide_doc,
1160 bpy_bm_elem_tag_doc,
1165 bpy_bm_elem_uv_select_vert_doc,
1170 bpy_bm_elem_uv_select_edge_doc,
1175 bpy_bm_elem_index_doc,
1180 static_cast<setter
>(
nullptr),
1181 bpy_bmloop_vert_doc,
1185 static_cast<setter
>(
nullptr),
1186 bpy_bmloop_edge_doc,
1190 static_cast<setter
>(
nullptr),
1191 bpy_bmloop_face_doc,
1197 static_cast<setter
>(
nullptr),
1198 bpy_bmloops_link_loops_doc,
1202 static_cast<setter
>(
nullptr),
1203 bpy_bmloop_link_loop_next_doc,
1207 static_cast<setter
>(
nullptr),
1208 bpy_bmloop_link_loop_prev_doc,
1210 {
"link_loop_radial_next",
1212 static_cast<setter
>(
nullptr),
1213 bpy_bmloop_link_loop_radial_next_doc,
1215 {
"link_loop_radial_prev",
1217 static_cast<setter
>(
nullptr),
1218 bpy_bmloop_link_loop_radial_prev_doc,
1224 static_cast<setter
>(
nullptr),
1225 bpy_bmloop_is_convex_doc,
1229 static_cast<setter
>(
nullptr),
1230 bpy_bm_is_valid_doc,
1233 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1239 static_cast<setter
>(
nullptr),
1240 bpy_bmelemseq_layers_vert_doc,
1241 reinterpret_cast<void *
>(
BM_VERT)},
1242 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1247 static_cast<setter
>(
nullptr),
1248 bpy_bmelemseq_layers_edge_doc,
1249 reinterpret_cast<void *
>(
BM_EDGE)},
1250 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1255 static_cast<setter
>(
nullptr),
1256 bpy_bmelemseq_layers_face_doc,
1257 reinterpret_cast<void *
>(
BM_FACE)},
1262 bpy_bmfaceseq_active_doc,
1264 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1269 static_cast<setter
>(
nullptr),
1270 bpy_bmelemseq_layers_loop_doc,
1271 reinterpret_cast<void *
>(
BM_LOOP)},
1272 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
1284 ".. method:: copy()\n"
1286 " :return: A copy of this BMesh.\n"
1287 " :rtype: :class:`bmesh.types.BMesh`\n");
1299 PyErr_SetString(PyExc_SystemError,
"Unable to copy BMesh, internal error");
1305 bpy_bmesh_clear_doc,
1306 ".. method:: clear()\n"
1308 " Clear all mesh data.\n");
1323 ".. method:: free()\n"
1325 " Explicitly free the BMesh data from memory, causing exceptions on further access.\n"
1329 " The BMesh is freed automatically, typically when the script finishes executing.\n"
1330 " However in some cases it's hard to predict when this will be and it's useful to\n"
1331 " explicitly free the data.\n");
1355 bpy_bmesh_to_mesh_doc,
1356 ".. method:: to_mesh(mesh)\n"
1358 " Writes this BMesh data into an existing Mesh data-block.\n"
1360 " :param mesh: The mesh data to write into.\n"
1361 " :type mesh: :class:`bpy.types.Mesh`\n");
1369 if (!PyArg_ParseTuple(args,
1379 if (
mesh->runtime->edit_mesh) {
1380 PyErr_Format(PyExc_ValueError,
"to_mesh(): Mesh '%s' is in editmode",
mesh->id.name + 2);
1386 Main *bmain =
nullptr;
1410 bpy_bmesh_from_object_doc,
1411 ".. method:: from_object(object, depsgraph, *, "
1412 "cage=False, face_normals=True, vertex_normals=True)\n"
1414 " Initialize this bmesh from existing object data-block (only meshes are currently "
1417 " :param object: The object data to load.\n"
1418 " :type object: :class:`bpy.types.Object`\n"
1419 " :param depsgraph: The dependency graph for evaluated data.\n"
1420 " :type depsgraph: :class:`bpy.types.Depsgraph`\n"
1421 " :param cage: Get the mesh as a deformed cage.\n"
1422 " :type cage: bool\n"
1423 " :param face_normals: Calculate face normals.\n"
1424 " :type face_normals: bool\n"
1425 " :param vertex_normals: Calculate vertex normals.\n"
1426 " :type vertex_normals: bool\n");
1429 static const char *kwlist[] = {
1430 "object",
"depsgraph",
"cage",
"face_normals",
"vertex_normals",
nullptr};
1431 PyObject *py_object;
1432 PyObject *py_depsgraph;
1434 Depsgraph *depsgraph;
1436 const Mesh *mesh_eval;
1437 bool use_cage =
false;
1438 bool use_fnorm =
true;
1439 bool use_vert_normal =
true;
1444 if (!PyArg_ParseTupleAndKeywords(args,
1453 const_cast<char **
>(kwlist),
1461 &use_vert_normal) ||
1463 !(depsgraph =
static_cast<Depsgraph *
>(
PyC_RNA_AsPointer(py_depsgraph,
"Depsgraph"))))
1469 PyErr_SetString(PyExc_ValueError,
1470 "from_object(...): currently only mesh objects are supported");
1477 bool need_free =
false;
1482 PyErr_SetString(PyExc_ValueError,
1483 "from_object(...): cage arg is unsupported when dependency graph "
1484 "evaluation mode is RENDER");
1500 if (mesh_eval ==
nullptr) {
1501 PyErr_Format(PyExc_ValueError,
1502 "from_object(...): Object '%s' has no usable mesh data",
1523 bpy_bmesh_from_mesh_doc,
1524 ".. method:: from_mesh(mesh, *, "
1525 "face_normals=True, vertex_normals=True, use_shape_key=False, shape_key_index=0)\n"
1527 " Initialize this bmesh from existing mesh data-block.\n"
1529 " :param mesh: The mesh data to load.\n"
1530 " :type mesh: :class:`bpy.types.Mesh`\n"
1531 " :param face_normals: Calculate face normals.\n"
1532 " :type face_normals: bool\n"
1533 " :param vertex_normals: Calculate vertex normals.\n"
1534 " :type vertex_normals: bool\n"
1535 " :param use_shape_key: Use the locations from a shape key.\n"
1536 " :type use_shape_key: bool\n"
1537 " :param shape_key_index: The shape key index to use.\n"
1538 " :type shape_key_index: int\n"
1542 " Multiple calls can be used to join multiple meshes.\n"
1544 " Custom-data layers are only copied from ``mesh`` on initialization.\n"
1545 " Further calls will copy custom-data to matching layers, layers missing on the target "
1546 "mesh won't be added.\n");
1549 static const char *kwlist[] = {
1550 "mesh",
"face_normals",
"vertex_normals",
"use_shape_key",
"shape_key_index",
nullptr};
1553 bool use_fnorm =
true;
1554 bool use_vert_normal =
true;
1555 bool use_shape_key =
false;
1556 int shape_key_index = 0;
1560 if (!PyArg_ParseTupleAndKeywords(args,
1569 const_cast<char **
>(kwlist),
1577 &shape_key_index) ||
1597 bpy_bmesh_select_flush_mode_doc,
1598 ".. method:: select_flush_mode(*, flush_down=False)\n"
1600 " Flush selection based on the current mode "
1601 ":attr:`bmesh.types.BMesh.select_mode`.\n"
1603 " :param flush_down: Flush selection down from faces to edges & verts "
1604 "or from edges to verts. "
1605 "This option is ignored when vertex selection mode is enabled.\n"
1606 " :type flush_down: bool\n");
1611 bool flush_down =
false;
1614 static const char *kwlist[] = {
1618 if (!PyArg_ParseTupleAndKeywords(args,
1622 ":select_flush_mode",
1623 const_cast<char **
>(kwlist),
1641 bpy_bmesh_select_flush_doc,
1642 ".. method:: select_flush(select)\n"
1644 " Flush selection from vertices, independent of the current selection mode.\n"
1646 " :param select: flush selection or de-selected elements.\n"
1647 " :type select: bool\n");
1667 bpy_bmesh_uv_select_flush_mode_doc,
1668 ".. method:: uv_select_flush_mode(*, flush_down=False)\n"
1670 " Flush UV selection based on the current mode :attr:`bmesh.types.BMesh.select_mode`.\n"
1672 " :param flush_down: Flush selection down from faces to edges & verts "
1673 "or from edges to verts. "
1674 "This option is ignored when vertex selection mode is enabled.\n"
1675 " :type flush_down: bool\n");
1681 bool flush_down =
false;
1682 static const char *kwlist[] = {
1686 if (!PyArg_ParseTupleAndKeywords(args,
1690 ":uv_select_flush_mode",
1691 const_cast<char **
>(kwlist),
1704 bpy_bmesh_uv_select_flush_doc,
1705 ".. method:: uv_select_flush(select)\n"
1707 " Flush selection from UV vertices to edges & faces independent of the selection mode.\n"
1709 " :param select: Flush selection or de-selected elements.\n"
1710 " :type select: bool\n"
1714 " - |UV_SELECT_SYNC_TO_MESH_NEEDED|\n");
1717 const char *error_prefix =
"uv_select_flush(...)";
1737 bpy_bmesh_uv_select_flush_shared_doc,
1738 ".. method:: uv_select_flush_shared(select)\n"
1740 " Flush selection from UV vertices to contiguous UV's independent of the selection mode.\n"
1742 " :param select: Flush selection or de-selected elements.\n"
1743 " :type select: bool\n"
1747 " - |UV_SELECT_SYNC_TO_MESH_NEEDED|\n");
1750 const char *error_prefix =
"uv_select_flush_shared(...)";
1775 bpy_bmesh_uv_select_sync_from_mesh_doc,
1776 ".. method:: uv_select_sync_from_mesh(*, "
1777 "sticky_select_mode='SHARED_LOCATION')\n"
1779 " Sync selection from mesh to UVs.\n"
1781 " :param sticky_select_mode: Behavior when flushing from the mesh to UV selection "
1782 "|UV_STICKY_SELECT_MODE_REF|. "
1783 "This should only be used when preparing to create a UV selection.\n"
1784 " :type sticky_select_mode: |UV_STICKY_SELECT_MODE_TYPE|\n"
1788 " - |UV_SELECT_SYNC_TO_MESH_NEEDED|\n");
1791 static const char *kwlist[] = {
1792 "sticky_select_mode",
1800 if (!PyArg_ParseTupleAndKeywords(args,
1804 ":uv_select_sync_from_mesh",
1805 const_cast<char **
>(kwlist),
1807 &uv_sticky_select_mode))
1816 if (cd_loop_uv_offset == -1) {
1817 PyErr_SetString(PyExc_ValueError,
"sticky_select_mode='SHARED_LOCATION' requires UV's");
1838 bpy_bmesh_uv_select_sync_to_mesh_doc,
1839 ".. method:: uv_select_sync_to_mesh()\n"
1841 " Sync selection from UVs to the mesh.\n");
1844 const char *error_prefix =
"uv_select_sync_to_mesh(...)";
1858 bpy_bmesh_uv_select_foreach_set_doc,
1859 ".. method:: uv_select_foreach_set(select, /, *, "
1860 "loop_verts=(), loop_edges=(), faces=(), sticky_select_mode='SHARED_LOCATION')\n"
1862 " Set the UV selection state for loop-vertices, loop-edges & faces.\n"
1864 " This is a close equivalent to selecting in the UV editor.\n"
1866 " :param select: The selection state to set.\n"
1867 " :type select: bool\n"
1868 " :param loop_verts: Loop verts to operate on.\n"
1869 " :type loop_verts: Iterable[:class:`bmesh.types.BMLoop`]\n"
1870 " :param loop_edges: Loop edges to operate on.\n"
1871 " :type loop_edges: Iterable[:class:`bmesh.types.BMLoop`]\n"
1872 " :param faces: Faces to operate on.\n"
1873 " :type faces: Iterable[:class:`bmesh.types.BMFace`]\n"
1874 " :param sticky_select_mode: See |UV_STICKY_SELECT_MODE_REF|.\n"
1875 " :type sticky_select_mode: |UV_STICKY_SELECT_MODE_TYPE|\n"
1879 " - |UV_SELECT_FLUSH_MODE_NEEDED|\n"
1880 " - |UV_SELECT_SYNC_TO_MESH_NEEDED|\n");
1883 const char *error_prefix =
"uv_select_foreach_set(...)";
1884 static const char *kwlist[] = {
1889 "sticky_select_mode",
1893 bool use_select =
false;
1894 PyObject *py_loop_verts =
nullptr;
1895 PyObject *py_loop_edges =
nullptr;
1896 PyObject *py_faces =
nullptr;
1901 if (!PyArg_ParseTupleAndKeywords(args,
1909 ":uv_select_foreach_set",
1910 const_cast<char **
>(kwlist),
1917 &uv_sticky_select_mode))
1928 if (
shared && (cd_loop_uv_offset == -1)) {
1932 Py_ssize_t loop_vert_array_num = 0;
1933 Py_ssize_t loop_edge_array_num = 0;
1934 Py_ssize_t face_array_num = 0;
1935 BMLoop **loop_vert_array =
nullptr;
1936 BMLoop **loop_edge_array =
nullptr;
1937 BMFace **face_array =
nullptr;
1940 if (ok && py_loop_verts) {
1941 BMesh *bm_test =
nullptr;
1946 &loop_vert_array_num,
1957 if (ok && py_loop_edges) {
1958 BMesh *bm_test =
nullptr;
1963 &loop_edge_array_num,
1974 if (ok && py_faces) {
1975 BMesh *bm_test =
nullptr;
1977 &bm_test, py_faces, 0, PY_SSIZE_T_MAX, &face_array_num,
true,
true, error_prefix)))
1991 Span(loop_vert_array, loop_vert_array_num),
1992 Span(loop_edge_array, loop_edge_array_num),
1993 Span(face_array, face_array_num));
1996 PyMem_FREE(loop_vert_array);
1997 PyMem_FREE(loop_edge_array);
1998 PyMem_FREE(face_array);
2009 bpy_bmesh_uv_select_foreach_set_from_mesh_doc,
2010 ".. method:: uv_select_foreach_set_from_mesh(select, /, *, "
2011 "verts=(), edges=(), faces=(), sticky_select_mode='SHARED_LOCATION')\n"
2013 " Select or de-select mesh elements, updating the UV selection.\n"
2015 " An equivalent to selecting from the 3D viewport "
2016 "for selection operations that support maintaining a synchronized UV selection.\n"
2018 " :param select: The selection state to set.\n"
2019 " :type select: bool\n"
2020 " :param verts: Verts to operate on.\n"
2021 " :type verts: Iterable[:class:`bmesh.types.BMVert`]\n"
2022 " :param edges: Edges to operate on.\n"
2023 " :type edges: Iterable[:class:`bmesh.types.BMEdge`]\n"
2024 " :param faces: Faces to operate on.\n"
2025 " :type faces: Iterable[:class:`bmesh.types.BMFace`]\n"
2026 " :param sticky_select_mode: See |UV_STICKY_SELECT_MODE_REF|.\n"
2027 " :type sticky_select_mode: |UV_STICKY_SELECT_MODE_TYPE|\n");
2032 const char *error_prefix =
"uv_select_foreach_set_from_mesh(...)";
2033 static const char *kwlist[] = {
2038 "sticky_select_mode",
2041 bool use_select =
false;
2042 PyObject *py_verts =
nullptr;
2043 PyObject *py_edges =
nullptr;
2044 PyObject *py_faces =
nullptr;
2049 if (!PyArg_ParseTupleAndKeywords(args,
2057 ":uv_select_foreach_set_from_mesh",
2058 const_cast<char **
>(kwlist),
2065 &uv_sticky_select_mode))
2076 if (
shared && (cd_loop_uv_offset == -1)) {
2080 Py_ssize_t vert_array_num = 0;
2081 Py_ssize_t edge_array_num = 0;
2082 Py_ssize_t face_array_num = 0;
2083 BMVert **vert_array =
nullptr;
2084 BMEdge **edge_array =
nullptr;
2085 BMFace **face_array =
nullptr;
2088 if (ok && py_verts) {
2089 BMesh *bm_test =
nullptr;
2091 &bm_test, py_verts, 0, PY_SSIZE_T_MAX, &vert_array_num,
true,
true, error_prefix)))
2099 if (ok && py_edges) {
2100 BMesh *bm_test =
nullptr;
2102 &bm_test, py_edges, 0, PY_SSIZE_T_MAX, &edge_array_num,
true,
true, error_prefix)))
2110 if (ok && py_faces) {
2111 BMesh *bm_test =
nullptr;
2113 &bm_test, py_faces, 0, PY_SSIZE_T_MAX, &face_array_num,
true,
true, error_prefix)))
2130 Span(vert_array, vert_array_num),
2131 Span(edge_array, edge_array_num),
2132 Span(face_array, face_array_num));
2135 PyMem_FREE(vert_array);
2136 PyMem_FREE(edge_array);
2137 PyMem_FREE(face_array);
2150 bpy_bmesh_normal_update_doc,
2151 ".. method:: normal_update()\n"
2153 " Update normals of mesh faces and verts.\n"
2157 " The normal of any vertex where :attr:`is_wire` is True will be a zero vector.\n");
2169 bpy_bmesh_transform_doc,
2170 ".. method:: transform(matrix, *, filter=None)\n"
2172 " Transform the mesh (optionally filtering flagged data only).\n"
2174 " :param matrix: 4x4 transform matrix.\n"
2175 " :type matrix: :class:`mathutils.Matrix`\n"
2176 " :param filter: Flag to filter vertices.\n"
2181 PyObject *
filter =
nullptr;
2183 int filter_flags = 0;
2187 static const char *_keywords[] = {
"matrix",
"filter",
nullptr};
2188 static _PyArg_Parser _parser = {
2196 if (!_PyArg_ParseTupleAndKeywordsFast(
2210 PyErr_SetString(PyExc_ValueError,
"expected a 4x4 matrix");
2220 mat_ptr = mat->matrix;
2222 if (!filter_flags) {
2224 mul_m4_v3(
static_cast<float (*)[4]
>(mat_ptr), eve->
co);
2228 const char filter_flags_ch = char(filter_flags);
2231 mul_m4_v3(
static_cast<float (*)[4]
>(mat_ptr), eve->
co);
2241 bpy_bmesh_calc_volume_doc,
2242 ".. method:: calc_volume(*, signed=False)\n"
2244 " Calculate mesh volume based on face normals.\n"
2246 " :param signed: when signed is true, negative values may be returned.\n"
2247 " :type signed: bool\n"
2248 " :return: The volume of the mesh.\n"
2249 " :rtype: float\n");
2252 static const char *kwlist[] = {
"signed",
nullptr};
2253 bool is_signed =
false;
2257 if (!PyArg_ParseTupleAndKeywords(args,
2262 const_cast<char **
>(kwlist),
2274 bpy_bmesh_calc_loop_triangles_doc,
2275 ".. method:: calc_loop_triangles()\n"
2277 " Calculate triangle tessellation from quads/ngons.\n"
2279 " :return: The triangulated faces.\n"
2280 " :rtype: list[tuple[:class:`bmesh.types.BMLoop`, "
2281 ":class:`bmesh.types.BMLoop`, "
2282 ":class:`bmesh.types.BMLoop`]]\n");
2285 int corner_tris_tot;
2297 ret = PyList_New(corner_tris_tot);
2298 for (
int i = 0; i < corner_tris_tot; i++) {
2310 bpy_bm_elem_select_set_doc,
2311 ".. method:: select_set(select)\n"
2313 " Set the selection.\n"
2314 " This is different from the *select* attribute because it updates the selection "
2315 "state of associated geometry.\n"
2317 " :param select: Select or de-select.\n"
2318 " :type select: bool\n"
2322 " This flushes selection down (e.g. selecting a face also selects its edges and "
2323 "vertices), but not up (e.g. de-selecting a vertex won't de-select faces that use it). "
2324 "Before finishing with a mesh, flushing is typically still needed.\n");
2342 bpy_bm_elem_hide_set_doc,
2343 ".. method:: hide_set(hide)\n"
2345 " Set the hide state.\n"
2346 " This is different from the *hide* attribute because it updates the selection and "
2347 "hide state of associated geometry.\n"
2349 " :param hide: Hidden or visible.\n"
2350 " :type hide: bool\n");
2368 bpy_bm_elem_copy_from_doc,
2369 ".. method:: copy_from(other)\n"
2371 " Copy values from another element of matching type.\n"
2373 " :param other: Another element of the same type to copy from.\n"
2374 " :type other: Self\n");
2379 if (Py_TYPE(self) != Py_TYPE(value)) {
2380 PyErr_Format(PyExc_TypeError,
2381 "expected element of type '%.200s' not '%.200s'",
2382 Py_TYPE(self)->tp_name,
2383 Py_TYPE(value)->tp_name);
2387 if (value->
ele != self->
ele) {
2394 reinterpret_cast<const BMVert *
>(value->
ele),
2403 reinterpret_cast<const BMEdge *
>(value->
ele),
2412 reinterpret_cast<const BMFace *
>(value->
ele),
2421 reinterpret_cast<const BMLoop *
>(value->
ele),
2436 bpy_bmvert_copy_from_vert_interp_doc,
2437 ".. method:: copy_from_vert_interp(vert_pair, fac)\n"
2439 " Interpolate the customdata from a vert between 2 other verts.\n"
2441 " :param vert_pair: The verts between which to interpolate data from.\n"
2442 " :type vert_pair: Sequence[:class:`bmesh.types.BMVert`]\n"
2443 " :param fac: The interpolation factor.\n"
2444 " :type fac: float\n");
2447 const char *error_prefix =
"BMVert.copy_from_vert_interp(...)";
2453 if (!PyArg_ParseTuple(args,
2456 ":BMVert.copy_from_vert_interp",
2465 Py_ssize_t vert_seq_num;
2467 &
bm, vert_seq, 2, 2, &vert_seq_num,
true,
true, error_prefix);
2469 if (vert_array ==
nullptr) {
2475 PyMem_FREE(vert_array);
2481 bpy_bmvert_copy_from_face_interp_doc,
2482 ".. method:: copy_from_face_interp(face)\n"
2484 " Interpolate the customdata from a face onto this vert (the vert should "
2485 "overlap the face).\n"
2487 " :param face: The face to interpolate data from.\n"
2488 " :type face: :class:`bmesh.types.BMFace`\n");
2491 const char *error_prefix =
"copy_from_face_interp(...)";
2496 if (!PyArg_ParseTuple(args,
2498 ":BMVert.copy_from_face_interp",
2516 bpy_bmvert_calc_edge_angle_doc,
2517 ".. method:: calc_edge_angle(fallback=None)\n"
2519 " Return the angle between this vert's two connected edges.\n"
2521 " :param fallback: return this when the vert doesn't have 2 edges\n"
2522 " (instead of raising a :exc:`ValueError`).\n"
2523 " :type fallback: Any\n"
2524 " :return: Angle between edges in radians.\n"
2525 " :rtype: float\n");
2528 const float angle_invalid = -1.0f;
2530 PyObject *fallback =
nullptr;
2534 if (!PyArg_ParseTuple(args,
2545 if (
angle == angle_invalid) {
2548 Py_INCREF(fallback);
2552 PyErr_SetString(PyExc_ValueError,
2553 "BMVert.calc_edge_angle(): "
2554 "vert must connect to exactly 2 edges");
2558 return PyFloat_FromDouble(
angle);
2563 bpy_bmvert_calc_shell_factor_doc,
2564 ".. method:: calc_shell_factor()\n"
2566 " Return a multiplier calculated based on the sharpness of the vertex.\n"
2567 " Where a flat surface gives 1.0, and higher values sharper edges.\n"
2568 " This is used to maintain shell thickness when offsetting verts along their normals.\n"
2570 " :return: offset multiplier\n"
2571 " :rtype: float\n");
2580 bpy_bmvert_normal_update_doc,
2581 ".. method:: normal_update()\n"
2583 " Update vertex normal.\n"
2584 " This does not update the normals of adjoining faces.\n"
2588 " The vertex normal will be a zero vector if vertex :attr:`is_wire` is True.\n");
2603 bpy_bmedge_calc_length_doc,
2604 ".. method:: calc_length()\n"
2606 " Return the length of the edge.\n"
2608 " :return: The length between both verts.\n"
2609 " :rtype: float\n");
2618 bpy_bmedge_calc_face_angle_doc,
2619 ".. method:: calc_face_angle(fallback=None)\n"
2621 " Return the angle between this edge's two connected faces.\n"
2623 " :param fallback: return this when the edge doesn't have 2 faces\n"
2624 " (instead of raising a :exc:`ValueError`).\n"
2625 " :type fallback: Any\n"
2626 " :return: The angle between 2 connected faces in radians.\n"
2627 " :rtype: float\n");
2630 const float angle_invalid = -1.0f;
2632 PyObject *fallback =
nullptr;
2636 if (!PyArg_ParseTuple(args,
2647 if (
angle == angle_invalid) {
2650 Py_INCREF(fallback);
2654 PyErr_SetString(PyExc_ValueError,
2655 "BMEdge.calc_face_angle(): "
2656 "edge doesn't use 2 faces");
2660 return PyFloat_FromDouble(
angle);
2665 bpy_bmedge_calc_face_angle_signed_doc,
2666 ".. method:: calc_face_angle_signed(fallback=None)\n"
2668 " Return the signed angle between this edge's two connected faces.\n"
2670 " :param fallback: return this when the edge doesn't have 2 faces\n"
2671 " (instead of raising a :exc:`ValueError`).\n"
2672 " :type fallback: Any\n"
2673 " :return: The angle between 2 connected faces in radians (negative for concave join).\n"
2674 " :rtype: float\n");
2677 const float angle_invalid = -
FLT_MAX;
2679 PyObject *fallback =
nullptr;
2683 if (!PyArg_ParseTuple(args,
2686 ":calc_face_angle_signed",
2694 if (
angle == angle_invalid) {
2697 Py_INCREF(fallback);
2701 PyErr_SetString(PyExc_ValueError,
2702 "BMEdge.calc_face_angle_signed(): "
2703 "edge doesn't use 2 faces");
2707 return PyFloat_FromDouble(
angle);
2712 bpy_bmedge_calc_tangent_doc,
2713 ".. method:: calc_tangent(loop)\n"
2715 " Return the tangent at this edge relative to a face (pointing inward into the face).\n"
2716 " This uses the face normal for calculation.\n"
2718 " :param loop: The loop used for tangent calculation.\n"
2719 " :type loop: :class:`bmesh.types.BMLoop`\n"
2720 " :return: a normalized vector.\n"
2721 " :rtype: :class:`mathutils.Vector`\n");
2727 if (!PyArg_ParseTuple(args,
2729 ":BMEdge.calc_tangent",
2745 bpy_bmedge_other_vert_doc,
2746 ".. method:: other_vert(vert)\n"
2748 " Return the other vertex on this edge or None if the vertex is not used by this edge.\n"
2750 " :param vert: a vert in this edge.\n"
2751 " :type vert: :class:`bmesh.types.BMVert`\n"
2752 " :return: The edge's other vert.\n"
2753 " :rtype: :class:`bmesh.types.BMVert` | None\n");
2756 const char *error_prefix =
"BMEdge.other_vert(...)";
2761 PyErr_Format(PyExc_TypeError,
2762 "%s: BMVert expected, not '%.200s'",
2764 Py_TYPE(value)->tp_name);
2782 bpy_bmedge_normal_update_doc,
2783 ".. method:: normal_update()\n"
2785 " Update normals of all connected faces and the edge verts.\n"
2789 " The normal of edge vertex will be a zero vector if vertex :attr:`is_wire` is True.\n");
2804 bpy_bmface_copy_from_face_interp_doc,
2805 ".. method:: copy_from_face_interp(face, vert=True)\n"
2807 " Interpolate the customdata from another face onto this one (faces should overlap).\n"
2809 " :param face: The face to interpolate data from.\n"
2810 " :type face: :class:`bmesh.types.BMFace`\n"
2811 " :param vert: When True, also copy vertex data.\n"
2812 " :type vert: bool\n");
2815 const char *error_prefix =
"BMFace.copy_from_face_interp(...)";
2817 bool do_vertex =
true;
2821 if (!PyArg_ParseTuple(args,
2825 ":BMFace.copy_from_face_interp",
2845 bpy_bmface_copy_doc,
2846 ".. method:: copy(*, verts=True, edges=True)\n"
2848 " Make a copy of this face.\n"
2850 " :param verts: When set, the faces verts will be duplicated too.\n"
2851 " :type verts: bool\n"
2852 " :param edges: When set, the faces edges will be duplicated too.\n"
2853 " :type edges: bool\n"
2854 " :return: The newly created face.\n"
2855 " :rtype: :class:`bmesh.types.BMFace`\n");
2858 static const char *kwlist[] = {
"verts",
"edges",
nullptr};
2861 bool do_verts =
true;
2862 bool do_edges =
true;
2867 if (!PyArg_ParseTupleAndKeywords(args,
2873 const_cast<char **
>(kwlist),
2888 PyErr_SetString(PyExc_ValueError,
"BMFace.copy(): couldn't create the new face, internal error");
2894 bpy_bmface_uv_select_set_doc,
2895 ".. method:: uv_select_set(select)\n"
2897 " Set the UV face selection state.\n"
2899 " :param select: Select or de-select.\n"
2900 " :type select: bool\n"
2904 " This flushes selection down (selecting a face also selects its edges and "
2905 "vertices), but not up. Before finishing with a mesh, "
2906 "flushing with :meth:`bmesh.types.BMesh.uv_select_flush_mode` is still needed.\n");
2921 bpy_bmface_calc_area_doc,
2922 ".. method:: calc_area()\n"
2924 " Return the area of the face.\n"
2926 " :return: The area of the face.\n"
2927 " :rtype: float\n");
2936 bpy_bmface_calc_perimeter_doc,
2937 ".. method:: calc_perimeter()\n"
2939 " Return the perimeter of the face.\n"
2941 " :return: The perimeter of the face.\n"
2942 " :rtype: float\n");
2951 bpy_bmface_calc_tangent_edge_doc,
2952 ".. method:: calc_tangent_edge()\n"
2954 " Return face tangent based on longest edge.\n"
2956 " :return: a normalized vector.\n"
2957 " :rtype: :class:`mathutils.Vector`\n");
2969 bpy_bmface_calc_tangent_edge_pair_doc,
2970 ".. method:: calc_tangent_edge_pair()\n"
2972 " Return face tangent based on the two longest disconnected edges.\n"
2974 " - Tris: Use the edge pair with the most similar lengths.\n"
2975 " - Quads: Use the longest edge pair.\n"
2976 " - NGons: Use the two longest disconnected edges.\n"
2978 " :return: a normalized vector.\n"
2979 " :rtype: :class:`mathutils.Vector`\n");
2991 bpy_bmface_calc_tangent_edge_diagonal_doc,
2992 ".. method:: calc_tangent_edge_diagonal()\n"
2994 " Return face tangent based on the edge farthest from any vertex.\n"
2996 " :return: a normalized vector.\n"
2997 " :rtype: :class:`mathutils.Vector`\n");
3009 bpy_bmface_calc_tangent_vert_diagonal_doc,
3010 ".. method:: calc_tangent_vert_diagonal()\n"
3012 " Return face tangent based on the two most distant vertices.\n"
3014 " :return: a normalized vector.\n"
3015 " :rtype: :class:`mathutils.Vector`\n");
3027 bpy_bmface_calc_center_median_doc,
3028 ".. method:: calc_center_median()\n"
3030 " Return median center of the face.\n"
3032 " :return: a 3D vector.\n"
3033 " :rtype: :class:`mathutils.Vector`\n");
3045 bpy_bmface_calc_center_median_weighted_doc,
3046 ".. method:: calc_center_median_weighted()\n"
3048 " Return median center of the face weighted by edge lengths.\n"
3050 " :return: a 3D vector.\n"
3051 " :rtype: :class:`mathutils.Vector`\n");
3063 bpy_bmface_calc_center_bounds_doc,
3064 ".. method:: calc_center_bounds()\n"
3066 " Return bounds center of the face.\n"
3068 " :return: a 3D vector.\n"
3069 " :rtype: :class:`mathutils.Vector`\n");
3081 bpy_bmface_normal_update_doc,
3082 ".. method:: normal_update()\n"
3084 " Update face normal based on the positions of the face verts.\n"
3085 " This does not update the normals of face verts.\n");
3097 bpy_bmface_normal_flip_doc,
3098 ".. method:: normal_flip()\n"
3100 " Reverses winding of a face, which flips its normal.\n");
3115 bpy_bmloop_copy_from_face_interp_doc,
3116 ".. method:: copy_from_face_interp(face, vert=True, multires=True)\n"
3118 " Interpolate the customdata from a face onto this loop (the loop's vert should "
3119 "overlap the face).\n"
3121 " :param face: The face to interpolate data from.\n"
3122 " :type face: :class:`bmesh.types.BMFace`\n"
3123 " :param vert: When enabled, interpolate the loop's vertex data (optional).\n"
3124 " :type vert: bool\n"
3125 " :param multires: When enabled, interpolate the loop's multires data (optional).\n"
3126 " :type multires: bool\n");
3129 const char *error_prefix =
"BMLoop.copy_from_face_interp(face)";
3131 bool do_vertex =
true;
3132 bool do_multires =
true;
3136 if (!PyArg_ParseTuple(args,
3141 ":BMLoop.copy_from_face_interp",
3163 bpy_bmloop_uv_select_vert_set_doc,
3164 ".. method:: uv_select_vert_set(select)\n"
3166 " Set the UV vertex selection state.\n"
3168 " :param select: Select or de-select.\n"
3169 " :type select: bool\n"
3173 " This does not flush selection, so selecting a vertex won't "
3174 "select the edges & faces that use it. Before finishing with a mesh, "
3175 "flushing with :meth:`bmesh.types.BMesh.uv_select_flush_mode` is still needed.\n");
3193 bpy_bmloop_uv_select_edge_set_doc,
3194 ".. method:: uv_select_edge_set(select)\n"
3196 " Set the UV edge selection state.\n"
3198 " :param select: Select or de-select.\n"
3199 " :type select: bool\n"
3203 " This flushes selection down (selecting an edge also selects its "
3204 "vertices), but not up (de-selecting a vertex won't de-select the edges & faces "
3205 "that use it). Before finishing with a mesh, "
3206 "flushing with :meth:`bmesh.types.BMesh.uv_select_flush_mode` is still needed.\n");
3221 bpy_bmloop_calc_angle_doc,
3222 ".. method:: calc_angle()\n"
3224 " Return the angle at this loops corner of the face.\n"
3225 " This is calculated so sharper corners give lower angles.\n"
3227 " :return: The angle in radians.\n"
3228 " :rtype: float\n");
3237 bpy_bmloop_calc_normal_doc,
3238 ".. method:: calc_normal()\n"
3240 " Return normal at this loops corner of the face.\n"
3241 " Falls back to the face normal for straight lines.\n"
3243 " :return: a normalized vector.\n"
3244 " :rtype: :class:`mathutils.Vector`\n");
3255 bpy_bmloop_calc_tangent_doc,
3256 ".. method:: calc_tangent()\n"
3258 " Return the tangent at this loops corner of the face (pointing inward into the face).\n"
3259 " Falls back to the face normal for straight lines.\n"
3261 " :return: a normalized vector.\n"
3262 " :rtype: :class:`mathutils.Vector`\n");
3275 bpy_bmvertseq_new_doc,
3276 ".. method:: new(co=(0.0, 0.0, 0.0), source=None)\n"
3278 " Create a new vertex.\n"
3280 " :param co: The initial location of the vertex (optional argument).\n"
3281 " :type co: tuple[float, float, float] | Sequence[float]\n"
3282 " :param source: Existing vert to initialize settings.\n"
3283 " :type source: :class:`bmesh.types.BMVert` | None\n"
3284 " :return: The newly created vertex.\n"
3285 " :rtype: :class:`bmesh.types.BMVert`\n");
3288 PyObject *py_co =
nullptr;
3294 static const char *_keywords[] = {
"",
"source",
nullptr};
3295 static _PyArg_Parser _parser = {
3303 if (!_PyArg_ParseTupleAndKeywordsFast(
3311 float co[3] = {0.0f, 0.0f, 0.0f};
3313 if (py_vert_source) {
3324 PyErr_SetString(PyExc_ValueError,
3325 "verts.new(co): couldn't create the new vert, internal error");
3329 if (py_vert_source) {
3330 if (py_vert_source->
bm ==
bm) {
3347 bpy_bmedgeseq_new_doc,
3348 ".. method:: new(verts, source=None)\n"
3350 " Create a new edge from a given pair of verts.\n"
3352 " :param verts: Vertex pair.\n"
3353 " :type verts: Sequence[:class:`bmesh.types.BMVert`]\n"
3354 " :param source: Existing edge to initialize settings (optional argument).\n"
3355 " :type source: :class:`bmesh.types.BMEdge` | None\n"
3356 " :return: The newly created edge.\n"
3357 " :rtype: :class:`bmesh.types.BMEdge`\n");
3360 const char *error_prefix =
"edges.new(...)";
3367 static const char *_keywords[] = {
"",
"source",
nullptr};
3368 static _PyArg_Parser _parser = {
3376 if (!_PyArg_ParseTupleAndKeywordsFast(
3384 PyObject *
ret =
nullptr;
3386 if (py_edge_source) {
3390 Py_ssize_t vert_seq_num;
3392 &
bm, vert_seq, 2, 2, &vert_seq_num,
true,
true, error_prefix);
3393 if (vert_array ==
nullptr) {
3398 PyErr_SetString(PyExc_ValueError,
"edges.new(): this edge exists");
3405 PyErr_SetString(PyExc_ValueError,
3406 "edges.new(verts): couldn't create the new edge, internal error");
3410 if (py_edge_source) {
3411 if (py_edge_source->
bm ==
bm) {
3425 PyMem_FREE(vert_array);
3434 bpy_bmfaceseq_new_doc,
3435 ".. method:: new(verts, source=None)\n"
3437 " Create a new face from a given set of verts.\n"
3439 " :param verts: Sequence of 3 or more verts.\n"
3440 " :type verts: Sequence[:class:`bmesh.types.BMVert`]\n"
3441 " :param source: Existing face to initialize settings (optional argument).\n"
3442 " :type source: :class:`bmesh.types.BMFace` | None\n"
3443 " :return: The newly created face.\n"
3444 " :rtype: :class:`bmesh.types.BMFace`\n");
3447 const char *error_prefix =
"faces.new(...)";
3454 static const char *_keywords[] = {
"",
"source",
nullptr};
3455 static _PyArg_Parser _parser = {
3463 if (!_PyArg_ParseTupleAndKeywordsFast(
3471 PyObject *
ret =
nullptr;
3475 if (py_face_source) {
3479 Py_ssize_t vert_seq_num;
3481 &
bm, vert_seq, 3, PY_SSIZE_T_MAX, &vert_seq_num,
true,
true, error_prefix);
3482 if (vert_array ==
nullptr) {
3488 PyErr_Format(PyExc_ValueError,
"%s: face already exists", error_prefix);
3498 py_face_source ? py_face_source->
f :
nullptr,
3502 if (f_new ==
nullptr) [[unlikely]] {
3504 PyExc_ValueError,
"%s: couldn't create the new face, internal error", error_prefix);
3513 PyMem_FREE(vert_array);
3523 bpy_bmvertseq_remove_doc,
3524 ".. method:: remove(vert)\n"
3528 " :param vert: The vert to remove.\n"
3529 " :type vert: :class:`bmesh.types.BMVert`\n");
3532 const char *error_prefix =
"verts.remove(vert)";
3551 bpy_bmedgeseq_remove_doc,
3552 ".. method:: remove(edge)\n"
3554 " Remove an edge.\n"
3556 " :param edge: The edge to remove.\n"
3557 " :type edge: :class:`bmesh.types.BMEdge`\n");
3560 const char *error_prefix =
"edges.remove(...)";
3579 bpy_bmfaceseq_remove_doc,
3580 ".. method:: remove(face)\n"
3584 " :param face: The face to remove.\n"
3585 " :type face: :class:`bmesh.types.BMFace`\n");
3588 const char *error_prefix =
"faces.remove(...)";
3607 bpy_bmedgeseq_get__method_doc,
3608 ".. method:: get(verts, fallback=None)\n"
3610 " Return an edge which uses the **verts** passed.\n"
3612 " :param verts: Pair of verts (exactly 2).\n"
3613 " :type verts: Sequence[:class:`bmesh.types.BMVert`]\n"
3614 " :param fallback: Return this value if nothing is found.\n"
3615 " :type fallback: Any\n"
3616 " :return: The edge found or the fallback value.\n"
3617 " :rtype: :class:`bmesh.types.BMEdge` | None\n");
3620 const char *error_prefix =
"edges.get(...)";
3622 PyObject *fallback = Py_None;
3626 if (!PyArg_ParseTuple(args,
3639 PyObject *
ret =
nullptr;
3641 Py_ssize_t vert_seq_num;
3643 &
bm, vert_seq, 2, 2, &vert_seq_num,
true,
true, error_prefix);
3645 if (vert_array ==
nullptr) {
3657 PyMem_FREE(vert_array);
3663 bpy_bmfaceseq_get__method_doc,
3664 ".. method:: get(verts, fallback=None)\n"
3666 " Return a face which uses the **verts** passed.\n"
3668 " :param verts: Sequence of verts.\n"
3669 " :type verts: Sequence[:class:`bmesh.types.BMVert`]\n"
3670 " :param fallback: Return this value if nothing is found.\n"
3671 " :type fallback: Any\n"
3672 " :return: The face found or the fallback value.\n"
3673 " :rtype: :class:`bmesh.types.BMFace` | None\n");
3676 const char *error_prefix =
"faces.get(...)";
3678 PyObject *fallback = Py_None;
3682 if (!PyArg_ParseTuple(args,
3695 PyObject *
ret =
nullptr;
3697 Py_ssize_t vert_seq_num;
3699 &
bm, vert_seq, 1, PY_SSIZE_T_MAX, &vert_seq_num,
true,
true, error_prefix);
3701 if (vert_array ==
nullptr) {
3714 PyMem_FREE(vert_array);
3720 bpy_bmelemseq_index_update_doc,
3721 ".. method:: index_update()\n"
3723 " Initialize the index values of this sequence.\n"
3725 " This is the equivalent of looping over all elements and assigning the index values.\n"
3727 " .. code-block:: python\n"
3729 " for index, ele in enumerate(sequence):\n"
3730 " ele.index = index\n"
3734 " Running this on sequences besides "
3735 ":class:`bmesh.types.BMesh.verts`, "
3736 ":class:`bmesh.types.BMesh.edges`, "
3737 ":class:`bmesh.types.BMesh.faces`\n"
3738 " works but won't result in each element having a valid index, instead its order in the "
3739 "sequence will be set.\n");
3780 bpy_bmelemseq_ensure_lookup_table_doc,
3781 ".. method:: ensure_lookup_table()\n"
3783 " Ensure internal data needed for int subscript access is initialized with "
3784 "verts/edges/faces, eg ``bm.verts[index]``.\n"
3786 " This needs to be called again after adding/removing data in this sequence.\n");
3798 bpy_bmelemseq_sort_doc,
3799 ".. method:: sort(*, key=None, reverse=False)\n"
3801 " Sort the elements of this sequence, using an optional custom sort key.\n"
3802 " Indices of elements are not changed, :meth:`bmesh.types.BMElemSeq.index_update` "
3803 "can be used for that.\n"
3805 " :param key: The key that sets the ordering of the elements.\n"
3806 " :type key: Callable[["
3807 ":class:`bmesh.types.BMVert` | "
3808 ":class:`bmesh.types.BMEdge` | "
3809 ":class:`bmesh.types.BMFace`], int] | None\n"
3810 " :param reverse: Reverse the order of the elements\n"
3811 " :type reverse: bool\n"
3815 " When the 'key' argument is not provided, the elements are reordered following their "
3816 "current index value.\n"
3817 " In particular this can be used by setting indices manually before calling this "
3822 " Existing references to the N'th element, will continue to point the data at that "
3838 const void *index2_v,
3841 const double *keys =
static_cast<const double *
>(keys_v);
3842 const int *index1 =
static_cast<int *
>(
const_cast<void *
>(index1_v));
3843 const int *index2 =
static_cast<int *
>(
const_cast<void *
>(index2_v));
3845 if (keys[*index1] < keys[*index2]) {
3848 if (keys[*index1] > keys[*index2]) {
3856 const void *index2_v,
3864 static const char *kwlist[] = {
"key",
"reverse",
nullptr};
3865 PyObject *keyfunc =
nullptr;
3866 bool do_reverse =
false;
3877 int (*elem_idx_compare_by_keys)(
const void *,
const void *,
void *);
3879 uint *vert_idx =
nullptr;
3880 uint *edge_idx =
nullptr;
3881 uint *face_idx =
nullptr;
3888 if (args !=
nullptr) {
3889 if (!PyArg_ParseTupleAndKeywords(args,
3895 const_cast<char **
>(kwlist),
3902 if (keyfunc == Py_None) {
3907 if (keyfunc !=
nullptr && !PyCallable_Check(keyfunc)) {
3908 PyErr_SetString(PyExc_TypeError,
"the 'key' argument is not a callable object");
3918 keys =
static_cast<double *
>(PyMem_MALLOC(
sizeof(*keys) * n_elem));
3919 if (keys ==
nullptr) {
3926 if (keyfunc !=
nullptr) {
3931 index = PyObject_CallFunctionObjArgs(keyfunc, py_elem,
nullptr);
3933 if (
index ==
nullptr) {
3940 if ((keys[i] = PyFloat_AsDouble(
index)) == -1 && PyErr_Occurred()) {
3941 PyErr_SetString(PyExc_ValueError,
3942 "the value returned by the 'key' function is not a number");
3959 elem_idx =
static_cast<int *
>(PyMem_MALLOC(
sizeof(*elem_idx) * n_elem));
3960 if (elem_idx ==
nullptr) {
3977 BLI_qsort_r(elem_idx, n_elem,
sizeof(*elem_idx), elem_idx_compare_by_keys, keys);
3979 elem_map_idx =
static_cast<uint *
>(PyMem_MALLOC(
sizeof(*elem_map_idx) * n_elem));
3980 if (elem_map_idx ==
nullptr) {
3982 PyMem_FREE(elem_idx);
3992 for (i = 0; i < n_elem; i++) {
3993 elem_map_idx[elem_idx[i]] = i;
3998 vert_idx = elem_map_idx;
4001 edge_idx = elem_map_idx;
4004 face_idx = elem_map_idx;
4007 PyErr_Format(PyExc_TypeError,
"element type %d not supported", self->
itype);
4008 PyMem_FREE(elem_map_idx);
4009 PyMem_FREE(elem_idx);
4016 PyMem_FREE(elem_map_idx);
4017 PyMem_FREE(elem_idx);
4025# pragma clang diagnostic push
4026# pragma clang diagnostic ignored "-Wcast-function-type"
4028# pragma GCC diagnostic push
4029# pragma GCC diagnostic ignored "-Wcast-function-type"
4035 {
"copy",
reinterpret_cast<PyCFunction
>(
bpy_bmesh_copy), METH_NOARGS, bpy_bmesh_copy_doc},
4036 {
"clear",
reinterpret_cast<PyCFunction
>(
bpy_bmesh_clear), METH_NOARGS, bpy_bmesh_clear_doc},
4037 {
"free",
reinterpret_cast<PyCFunction
>(
bpy_bmesh_free), METH_NOARGS, bpy_bmesh_free_doc},
4042 METH_VARARGS | METH_KEYWORDS,
4043 bpy_bmesh_from_object_doc},
4046 METH_VARARGS | METH_KEYWORDS,
4047 bpy_bmesh_from_mesh_doc},
4051 bpy_bmesh_to_mesh_doc},
4054 {
"select_flush_mode",
4056 METH_VARARGS | METH_KEYWORDS,
4057 bpy_bmesh_select_flush_mode_doc},
4061 bpy_bmesh_select_flush_doc},
4064 {
"uv_select_flush_mode",
4066 METH_VARARGS | METH_KEYWORDS,
4067 bpy_bmesh_uv_select_flush_mode_doc},
4071 bpy_bmesh_uv_select_flush_doc},
4072 {
"uv_select_flush_shared",
4075 bpy_bmesh_uv_select_flush_shared_doc},
4077 {
"uv_select_sync_from_mesh",
4079 METH_VARARGS | METH_KEYWORDS,
4080 bpy_bmesh_uv_select_sync_from_mesh_doc},
4081 {
"uv_select_sync_to_mesh",
4084 bpy_bmesh_uv_select_sync_to_mesh_doc},
4085 {
"uv_select_foreach_set",
4087 METH_VARARGS | METH_KEYWORDS,
4088 bpy_bmesh_uv_select_foreach_set_doc},
4089 {
"uv_select_foreach_set_from_mesh",
4091 METH_VARARGS | METH_KEYWORDS,
4092 bpy_bmesh_uv_select_foreach_set_from_mesh_doc},
4098 bpy_bmesh_normal_update_doc},
4101 METH_VARARGS | METH_KEYWORDS,
4102 bpy_bmesh_transform_doc},
4107 METH_VARARGS | METH_KEYWORDS,
4108 bpy_bmesh_calc_volume_doc},
4109 {
"calc_loop_triangles",
4112 bpy_bmesh_calc_loop_triangles_doc},
4113 {
nullptr,
nullptr, 0,
nullptr},
4120 bpy_bm_elem_select_set_doc},
4124 bpy_bm_elem_hide_set_doc},
4128 bpy_bm_elem_copy_from_doc},
4129 {
"copy_from_face_interp",
4132 bpy_bmvert_copy_from_face_interp_doc},
4133 {
"copy_from_vert_interp",
4136 bpy_bmvert_copy_from_vert_interp_doc},
4141 bpy_bmvert_calc_edge_angle_doc},
4142 {
"calc_shell_factor",
4145 bpy_bmvert_calc_shell_factor_doc},
4150 bpy_bmvert_normal_update_doc},
4152 {
nullptr,
nullptr, 0,
nullptr},
4159 bpy_bm_elem_select_set_doc},
4163 bpy_bm_elem_hide_set_doc},
4167 bpy_bm_elem_copy_from_doc},
4172 bpy_bmedge_other_vert_doc},
4177 bpy_bmedge_calc_length_doc},
4181 bpy_bmedge_calc_face_angle_doc},
4182 {
"calc_face_angle_signed",
4185 bpy_bmedge_calc_face_angle_signed_doc},
4189 bpy_bmedge_calc_tangent_doc},
4194 bpy_bmedge_normal_update_doc},
4196 {
nullptr,
nullptr, 0,
nullptr},
4203 bpy_bm_elem_select_set_doc},
4207 bpy_bm_elem_hide_set_doc},
4212 bpy_bm_elem_copy_from_doc},
4213 {
"copy_from_face_interp",
4216 bpy_bmface_copy_from_face_interp_doc},
4220 METH_VARARGS | METH_KEYWORDS,
4221 bpy_bmface_copy_doc},
4226 bpy_bmface_uv_select_set_doc},
4231 bpy_bmface_calc_area_doc},
4235 bpy_bmface_calc_perimeter_doc},
4236 {
"calc_tangent_edge",
4239 bpy_bmface_calc_tangent_edge_doc},
4240 {
"calc_tangent_edge_pair",
4243 bpy_bmface_calc_tangent_edge_pair_doc},
4244 {
"calc_tangent_edge_diagonal",
4247 bpy_bmface_calc_tangent_edge_diagonal_doc},
4248 {
"calc_tangent_vert_diagonal",
4251 bpy_bmface_calc_tangent_vert_diagonal_doc},
4252 {
"calc_center_median",
4255 bpy_bmface_calc_center_median_doc},
4256 {
"calc_center_median_weighted",
4259 bpy_bmface_calc_center_median_weighted_doc},
4260 {
"calc_center_bounds",
4263 bpy_bmface_calc_center_bounds_doc},
4268 bpy_bmface_normal_update_doc},
4272 bpy_bmface_normal_flip_doc},
4274 {
nullptr,
nullptr, 0,
nullptr},
4281 bpy_bm_elem_copy_from_doc},
4282 {
"copy_from_face_interp",
4285 bpy_bmloop_copy_from_face_interp_doc},
4287 {
"uv_select_vert_set",
4290 bpy_bmloop_uv_select_vert_set_doc},
4291 {
"uv_select_edge_set",
4294 bpy_bmloop_uv_select_edge_set_doc},
4299 bpy_bmloop_calc_angle_doc},
4303 bpy_bmloop_calc_normal_doc},
4307 bpy_bmloop_calc_tangent_doc},
4308 {
nullptr,
nullptr, 0,
nullptr},
4316 bpy_bmelemseq_index_update_doc},
4317 {
nullptr,
nullptr, 0,
nullptr},
4323 METH_VARARGS | METH_KEYWORDS,
4324 bpy_bmvertseq_new_doc},
4328 bpy_bmvertseq_remove_doc},
4334 bpy_bmelemseq_index_update_doc},
4335 {
"ensure_lookup_table",
4338 bpy_bmelemseq_ensure_lookup_table_doc},
4341 METH_VARARGS | METH_KEYWORDS,
4342 bpy_bmelemseq_sort_doc},
4343 {
nullptr,
nullptr, 0,
nullptr},
4349 METH_VARARGS | METH_KEYWORDS,
4350 bpy_bmedgeseq_new_doc},
4354 bpy_bmedgeseq_remove_doc},
4359 bpy_bmedgeseq_get__method_doc},
4365 bpy_bmelemseq_index_update_doc},
4366 {
"ensure_lookup_table",
4369 bpy_bmelemseq_ensure_lookup_table_doc},
4372 METH_VARARGS | METH_KEYWORDS,
4373 bpy_bmelemseq_sort_doc},
4374 {
nullptr,
nullptr, 0,
nullptr},
4380 METH_VARARGS | METH_KEYWORDS,
4381 bpy_bmfaceseq_new_doc},
4385 bpy_bmfaceseq_remove_doc},
4390 bpy_bmfaceseq_get__method_doc},
4396 bpy_bmelemseq_index_update_doc},
4397 {
"ensure_lookup_table",
4400 bpy_bmelemseq_ensure_lookup_table_doc},
4403 METH_VARARGS | METH_KEYWORDS,
4404 bpy_bmelemseq_sort_doc},
4405 {
nullptr,
nullptr, 0,
nullptr},
4412 {
nullptr,
nullptr, 0,
nullptr},
4417# pragma clang diagnostic pop
4419# pragma GCC diagnostic pop
4513 switch (self->
itype) {
4536 PyErr_SetString(PyExc_IndexError,
4537 "BMElemSeq[index]: outdated internal index table, "
4538 "run ensure_lookup_table() first");
4551 PyErr_Format(PyExc_IndexError,
"BMElemSeq[index]: index %d out of range", keynum);
4568 list = PyList_New(0);
4574 if (ok ==
false) [[unlikely]] {
4579 for (ok =
true; ok; ok = (BM_iter_step(&iter) !=
nullptr)) {
4580 if (count == start) {
4587 while ((ele =
static_cast<BMHeader *
>(BM_iter_step(&iter)))) {
4591 if (count == stop) {
4602 if (PyIndex_Check(key)) {
4603 const Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
4604 if (i == -1 && PyErr_Occurred()) {
4609 if (PySlice_Check(key)) {
4610 PySliceObject *key_slice =
reinterpret_cast<PySliceObject *
>(key);
4611 Py_ssize_t
step = 1;
4613 if (key_slice->step != Py_None && !_PyEval_SliceIndex(key_slice->step, &
step)) {
4617 PyErr_SetString(PyExc_TypeError,
"BMElemSeq[slice]: slice steps not supported");
4620 if (key_slice->start == Py_None && key_slice->stop == Py_None) {
4624 Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
4627 if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) {
4630 if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop)) {
4634 if (start < 0 || stop < 0) {
4647 if (stop - start <= 0) {
4648 return PyList_New(0);
4654 PyErr_SetString(PyExc_AttributeError,
"BMElemSeq[key]: invalid key, key must be an int");
4664 if (value_bm_ele->
bm == self->
bm) {
4665 BMElem *ele, *ele_test = value_bm_ele->
ele;
4668 if (ele == ele_test) {
4712 static_cast<objobjargproc
>(
nullptr),
4717 static_cast<lenfunc
>(
4734 return reinterpret_cast<PyObject *
>(py_iter);
4740 if (ele ==
nullptr) {
4741 PyErr_SetNone(PyExc_StopIteration);
4786 void **ptr =
static_cast<void **
>(
4799 void **ptr =
static_cast<void **
>(
4812 void **ptr =
static_cast<void **
>(
4825 void **ptr =
static_cast<void **
>(
4836 Py_XDECREF(self->
py_ele);
4858 "The BMesh data structure\n");
4862 "The BMesh vertex type\n");
4866 "The BMesh edge connecting 2 verts\n");
4870 "The BMesh face with 3 or more sides\n");
4874 "This is normally accessed from :class:`bmesh.types.BMFace.loops` where each face loop "
4875 "represents a corner of the face.\n");
4879 "General sequence type used for accessing any sequence of\n"
4880 ":class:`bmesh.types.BMVert`, "
4881 ":class:`bmesh.types.BMEdge`, "
4882 ":class:`bmesh.types.BMFace`, "
4883 ":class:`bmesh.types.BMLoop`.\n"
4885 "When accessed via "
4886 ":class:`bmesh.types.BMesh.verts`, "
4887 ":class:`bmesh.types.BMesh.edges`, "
4888 ":class:`bmesh.types.BMesh.faces`\n"
4889 "there are also functions to create/remove items.\n");
4893 "Internal BMesh type for looping over verts/faces/edges,\n"
4894 "used for iterating over :class:`bmesh.types.BMElemSeq` types.\n");
4901 return PyUnicode_FromFormat(
"<BMesh(%p), totvert=%d, totedge=%d, totface=%d, totloop=%d>",
4909 return PyUnicode_FromFormat(
"<BMesh dead at %p>", self);
4921 return PyUnicode_FromFormat(
"<BMVert dead at %p>", self);
4930 return PyUnicode_FromFormat(
"<BMEdge(%p), index=%d, verts=(%p/%d, %p/%d)>",
4939 return PyUnicode_FromFormat(
"<BMEdge dead at %p>", self);
4948 return PyUnicode_FromFormat(
4952 return PyUnicode_FromFormat(
"<BMFace dead at %p>", self);
4961 return PyUnicode_FromFormat(
"<BMLoop(%p), index=%d, vert=%p/%d, edge=%p/%d, face=%p/%d>",
4972 return PyUnicode_FromFormat(
"<BMLoop dead at %p>", self);
5150 BPy_BM_types_module_doc,
5152 ".. |UV_STICKY_SELECT_MODE_REF| replace:: "
5153 "(:class:`bpy.types.ToolSettings.uv_sticky_select_mode` which may be passed in directly).\n"
5155 ".. |UV_STICKY_SELECT_MODE_TYPE| replace:: "
5156 "Literal['SHARED_LOCATION', 'DISABLED', 'SHARED_VERTEX']\n"
5158 ".. |UV_SELECT_FLUSH_MODE_NEEDED| replace:: "
5159 "This function is selection-mode independent, "
5160 "typically :meth:`bmesh.types.BMesh.uv_select_flush_mode` should be called afterwards.\n"
5162 ".. |UV_SELECT_SYNC_TO_MESH_NEEDED| replace:: "
5163 "This function doesn't flush the selection to the mesh, "
5164 "typically :meth:`bmesh.types.BMesh.uv_select_sync_to_mesh` should be called afterwards.\n");
5168 BPy_BM_types_module_doc,
5179 PyObject *submodule;
5240 return reinterpret_cast<PyObject *
>(self);
5247 void **ptr =
static_cast<void **
>(
5251 if (ptr ==
nullptr) [[unlikely]] {
5256 if (*ptr !=
nullptr) {
5267 return reinterpret_cast<PyObject *
>(self);
5274 void **ptr =
static_cast<void **
>(
5278 if (ptr ==
nullptr) [[unlikely]] {
5283 if (*ptr !=
nullptr) {
5294 return reinterpret_cast<PyObject *
>(self);
5301 void **ptr =
static_cast<void **
>(
5305 if (ptr ==
nullptr) [[unlikely]] {
5310 if (*ptr !=
nullptr) {
5321 return reinterpret_cast<PyObject *
>(self);
5328 void **ptr =
static_cast<void **
>(
5332 if (ptr ==
nullptr) [[unlikely]] {
5337 if (*ptr !=
nullptr) {
5348 return reinterpret_cast<PyObject *
>(self);
5358 return reinterpret_cast<PyObject *
>(self);
5367 return reinterpret_cast<PyObject *
>(self);
5376 return reinterpret_cast<PyObject *
>(self);
5385 return reinterpret_cast<PyObject *
>(self);
5394 return reinterpret_cast<PyObject *
>(self);
5402 return reinterpret_cast<PyObject *
>(self);
5407 switch (ele->
htype) {
5418 PyErr_SetString(PyExc_SystemError,
"internal error");
5425 if (self->
bm) [[likely]] {
5435 PyExc_ReferenceError,
"BMesh used by %.200s has become invalid", Py_TYPE(self)->tp_name);
5444 PyExc_ReferenceError,
"BMesh data of type %.200s has been removed", Py_TYPE(self)->tp_name);
5449 const char *error_prefix,
5455 while (args_tot--) {
5462 if (
ret == -1) [[unlikely]] {
5466 if (py_bm_elem->
bm != bm_source) [[unlikely]] {
5468 PyErr_Format(PyExc_ValueError,
5469 "%.200s: BMesh data of type %.200s is from another mesh",
5471 Py_TYPE(py_bm_elem)->tp_name);
5485 PyErr_Format(PyExc_ValueError,
"%s: bm.uv_select_sync_valid: must be true", error_prefix);
5494 if (cd_loop_uv_offset == -1) {
5495 PyErr_Format(PyExc_ValueError,
"%s: failed, no UV layer found", error_prefix);
5497 return cd_loop_uv_offset;
5503 PyErr_Format(PyExc_ValueError,
"%s: elements must be from a singe BMesh", error_prefix);
5518 Py_ssize_t *r_seq_num,
5520 const bool do_unique_check,
5521 const bool do_bm_check,
5522 const char *error_prefix)
5524 BMesh *
bm = (r_bm && *r_bm) ? *r_bm :
nullptr;
5525 PyObject **seq_fast_items = PySequence_Fast_ITEMS(seq_fast);
5526 const Py_ssize_t seq_num = PySequence_Fast_GET_SIZE(seq_fast);
5527 Py_ssize_t i, i_last_dirty = PY_SSIZE_T_MAX;
5534 if (seq_num < min || seq_num >
max) {
5535 PyErr_Format(PyExc_TypeError,
5536 "%s: sequence incorrect size, expected [%d - %d], given %d",
5545 alloc =
static_cast<BMElem **
>(PyMem_MALLOC(seq_num *
sizeof(
BPy_BMElem **)));
5547 for (i = 0; i < seq_num; i++) {
5548 item =
reinterpret_cast<BPy_BMElem *
>(seq_fast_items[i]);
5551 PyErr_Format(PyExc_TypeError,
5552 "%s: expected %.200s, not '%.200s'",
5555 Py_TYPE(item)->tp_name);
5560 PyExc_TypeError,
"%s: %d %s has been removed", error_prefix, i, Py_TYPE(item)->tp_name);
5565 else if (do_bm_check && (
bm &&
bm != item->
bm)) {
5566 PyErr_Format(PyExc_ValueError,
5567 "%s: %d %s is from another mesh",
5574 if (
bm ==
nullptr) {
5578 alloc[i] = item->
ele;
5580 if (do_unique_check) {
5586 if (do_unique_check) {
5589 for (i = 0; i < seq_num; i++) {
5600 i_last_dirty = PY_SSIZE_T_MAX;
5601 PyErr_Format(PyExc_ValueError,
5602 "%s: found the same %.200s used multiple times",
5609 *r_seq_num = seq_num;
5616 if (do_unique_check && (i_last_dirty != PY_SSIZE_T_MAX)) {
5617 for (i = 0; i <= i_last_dirty; i++) {
5629 Py_ssize_t *r_seq_num,
5631 const bool do_unique_check,
5632 const bool do_bm_check,
5633 const char *error_prefix)
5638 if (!(seq_fast = PySequence_Fast(
seq, error_prefix))) {
5643 r_bm, seq_fast,
min,
max, r_seq_num, htype, do_unique_check, do_bm_check, error_prefix));
5645 Py_DECREF(seq_fast);
5653 Py_ssize_t *r_seq_num,
5654 bool do_unique_check,
5656 const char *error_prefix)
5659 r_bm,
seq,
min,
max, r_seq_num,
BM_VERT, do_unique_check, do_bm_check, error_prefix));
5665 Py_ssize_t *r_seq_num,
5666 bool do_unique_check,
5668 const char *error_prefix)
5671 r_bm,
seq,
min,
max, r_seq_num,
BM_EDGE, do_unique_check, do_bm_check, error_prefix));
5677 Py_ssize_t *r_seq_num,
5678 bool do_unique_check,
5680 const char *error_prefix)
5683 r_bm,
seq,
min,
max, r_seq_num,
BM_FACE, do_unique_check, do_bm_check, error_prefix));
5689 Py_ssize_t *r_seq_num,
5690 bool do_unique_check,
5692 const char *error_prefix)
5695 r_bm,
seq,
min,
max, r_seq_num,
BM_LOOP, do_unique_check, do_bm_check, error_prefix));
5701 PyObject *
ret = PyTuple_New(elem_num);
5702 for (i = 0; i < elem_num; i++) {
5710 PyObject *
ret = PyTuple_New(elem_num);
5711 for (i = 0; i < elem_num; i++) {
5719 PyObject *
ret = PyTuple_New(elem_num);
5720 for (i = 0; i < elem_num; i++) {
5729 PyObject *
ret = PyTuple_New(elem_num);
5730 for (i = 0; i < elem_num; i++) {
5739 PyObject *
ret = PyTuple_New(elem_num);
5740 for (i = 0; i < elem_num; i++) {
5758 const char *ret_array[4];
5775 ret[ret_ofs + 1] =
'\0';
5781 static char ret[32];
CustomData interface, see also DNA_customdata_types.h.
General operations, lookup, etc. for blender objects.
Object is a sort of wrapper for general info.
#define BLI_assert_unreachable()
#define POINTER_AS_INT(i)
#define BM_ELEM_SELECT_UV_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)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_iter_init(iter, bm, itype, data)
#define BM_elem_hide_set(bm, ele, hide)
#define BMSelectFlushFlag_Default
#define CD_MASK_BM_ELEM_PYPTR
#define BPY_BM_HFLAG_ALL_STR
#define BPY_BM_HTYPE_NOLOOP
#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)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
#define BaseMath_ReadCallback(_self)
void fill_index_range(MutableSpan< T > span, const T start=0)
const Mesh * mesh_get_eval_deform(Depsgraph *depsgraph, const Scene *scene, Object *ob, const CustomData_MeshMasks *dataMask)
static PyObject * bpy_bmedge_normal_update(BPy_BMEdge *self)
static PyMappingMethods bpy_bmelemseq_as_mapping
PyTypeObject BPy_BMLoopUV_Type
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
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)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
int bpy_bm_uv_layer_offset_or_error(BMesh *bm, const char *error_prefix)
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)
static PyMethodDef bpy_bmloopseq_methods[]
int PyC_FlagSet_ToBitfield(const PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
static PyObject * bpy_bmvertseq_get(BPy_BMesh *self, void *)
PyTypeObject BPy_BMLayerAccessVert_Type
static PyObject * bpy_bmface_calc_center_mean(BPy_BMFace *self)
void BM_mesh_uvselect_mode_flush_ex(BMesh *bm, const short selectmode, const bool flush_down)
static PyObject * bpy_bmloop_calc_tangent(BPy_BMLoop *self)
static PyGetSetDef bpy_bmedge_getseters[]
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
static PyGetSetDef bpy_bmfaceseq_getseters[]
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
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_seq_num, const char htype, const bool do_unique_check, const bool do_bm_check, const char *error_prefix)
static PyObject * bpy_bm_is_valid_get(BPy_BMGeneric *self, void *)
static PyObject * bpy_bmvert_calc_shell_factor(BPy_BMVert *self)
static PyObject * bpy_bmloop_uv_select_vert_set(BPy_BMLoop *self, PyObject *value)
int bpy_bm_check_bm_match_or_error(BMesh *bm_a, BMesh *bm_b, const char *error_prefix)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void * CustomData_bmesh_get(const CustomData *data, void *block, eCustomDataType type)
static int bpy_bmvert_normal_set(BPy_BMVert *self, PyObject *value, void *)
PyTypeObject BPy_BMLoop_Type
static PyObject * bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *args)
static PyObject * bpy_bmesh_uv_select_sync_valid_get(BPy_BMesh *self, void *)
int PyC_ParseBool(PyObject *o, void *p)
static PyObject * bpy_bmloopseq_get(BPy_BMesh *self, void *)
static int bpy_bmface_normal_set(BPy_BMFace *self, PyObject *value, void *)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *)
static PyModuleDef BPy_BM_types_module_def
void BM_face_normal_flip(BMesh *bm, BMFace *f)
static PyObject * bpy_bmvert_normal_get(BPy_BMVert *self, void *)
PyTypeObject BPy_BMVertSeq_Type
BMEdge ** BPy_BMEdge_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_seq_num, bool do_unique_check, bool do_bm_check, const char *error_prefix)
static PyObject * bpy_bm_elem_copy_from(BPy_BMElem *self, BPy_BMElem *value)
static PyObject * bpy_bmesh_normal_update(BPy_BMesh *self)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
PyTypeObject BPy_BMVert_Type
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_vert_kill(BMesh *bm, BMVert *v)
float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, const float fallback)
BMESH EDGE/FACE ANGLE.
static PyObject * bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *args)
static PyMethodDef bpy_bmedge_methods[]
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
const char bm_iter_itype_htype_map[BM_ITYPE_MAX]
static PyObject * bpy_bmface_calc_center_median_weighted(BPy_BMFace *self)
static PyObject * bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t start, Py_ssize_t stop)
bool BM_vert_is_wire(const BMVert *v)
static PyObject * bpy_bmesh_repr(BPy_BMesh *self)
BMVert ** BPy_BMVert_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_seq_num, bool do_unique_check, bool do_bm_check, const char *error_prefix)
PyTypeObject BPy_BMLayerAccessFace_Type
static PyObject * bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
static PyObject * bpy_bmesh_select_history_get(BPy_BMesh *self, void *)
static int bpy_bmvert_co_set(BPy_BMVert *self, PyObject *value, void *)
static PyMethodDef bpy_bmelemseq_methods[]
static PyObject * bpy_bmvert_calc_edge_angle(BPy_BMVert *self, PyObject *args)
static PyGetSetDef bpy_bmvert_getseters[]
BMCustomDataCopyMap CustomData_bmesh_copy_map_calc(const CustomData &src, const CustomData &dst, eCustomDataMask mask_exclude=0)
PyObject * BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_num)
static PyObject * bpy_bmedgeseq_get(BPy_BMesh *self, void *)
static PyMethodDef bpy_bmvert_methods[]
static PyObject * bpy_bmface_calc_tangent_edge(BPy_BMFace *self)
static PyObject * bpy_bmface_calc_tangent_edge_diagonal(BPy_BMFace *self)
PyObject * BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l)
static int bpy_bmelemseq_sort_cmp_by_keys_descending(const void *index1_v, const void *index2_v, void *keys_v)
static PyObject * bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args, PyObject *kw)
PyObject * Vector_CreatePyObject_wrap(float *vec, const int vec_num, PyTypeObject *base_type)
bool BM_edge_is_convex(const BMEdge *e)
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")
void BM_face_calc_tangent_from_edge_diagonal(const BMFace *f, float r_tangent[3])
static PyObject * bpy_bmvert_is_wire_get(BPy_BMVert *self, void *)
static PyObject * bpy_bmesh_uv_select_foreach_set(BPy_BMesh *self, PyObject *args, PyObject *kw)
PyObject * PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag)
static void bpy_bmface_dealloc(BPy_BMElem *self)
PyObject * BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop *const *elem, Py_ssize_t elem_num)
static PyObject * bpy_bmelemseq_index_update(BPy_BMElemSeq *self)
static PyObject * bpy_bmesh_calc_volume(BPy_BMElem *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmloop_repr(BPy_BMLoop *self)
char * BPy_BMElem_StringFromHType(const char htype)
static PyObject * bpy_bmface_calc_tangent_edge_pair(BPy_BMFace *self)
static PyObject * bpy_bmesh_uv_select_flush(BPy_BMesh *self, PyObject *value)
int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype)
static void bpy_bmvert_dealloc(BPy_BMElem *self)
static void bpy_bmesh_dealloc(BPy_BMesh *self)
static PyObject * bpy_bmedge_is_contiguous_get(BPy_BMEdge *self, void *)
static void bpy_bmelemseq_dealloc(BPy_BMElemSeq *self)
float BM_vert_calc_shell_factor(const BMVert *v)
static Py_hash_t bpy_bm_hash(PyObject *self)
static PyGetSetDef bpy_bmloop_getseters[]
PyObject * BPyInit_bmesh_types()
ATTR_WARN_UNUSED_RESULT const BMVert * v
static PyTypeObject * bpy_bm_itype_as_pytype(const char itype)
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
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.
static int bpy_bmface_material_index_set(BPy_BMFace *self, PyObject *value, void *)
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static PyMethodDef bpy_bmface_methods[]
static PyObject * bpy_bmedge_calc_length(BPy_BMEdge *self)
static PyObject * bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args, PyObject *kw)
static PyGetSetDef bpy_bmedgeseq_getseters[]
static int bpy_bmesh_select_history_set(BPy_BMesh *self, PyObject *value, void *)
void BM_mesh_uvselect_set_elem_shared(BMesh *bm, bool select, const int cd_loop_uv_offset, const Span< BMLoop * > loop_verts, const Span< BMLoop * > loop_edges, const Span< BMFace * > faces)
static PyObject * bpy_bmface_calc_center_bounds(BPy_BMFace *self)
static PyObject * bpy_bm_elem_index_get(BPy_BMElem *self, void *)
bool BM_mesh_is_valid(BMesh *bm)
static PyObject * bpy_bmelemseq_elem_get(BPy_BMElem *self, void *itype)
static PyObject * bpy_bmface_calc_tangent_vert_diagonal(BPy_BMFace *self)
PyTypeObject BPy_BMLoopSeq_Type
bool BM_vert_is_boundary(const BMVert *v)
static PyObject * bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, Py_ssize_t keynum)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static PyObject * bpy_bmloop_link_loop_radial_next_get(BPy_BMLoop *self, void *)
static PyMethodDef bpy_bmloop_methods[]
static PyMethodDef bpy_bmfaceseq_methods[]
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
static PyObject * bpy_bmesh_select_mode_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmelem_subscript(BPy_BMElem *self, BPy_BMLayerItem *key)
static void bpy_bmedge_dealloc(BPy_BMElem *self)
void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
static PyObject * bpy_bmfaceseq_get(BPy_BMesh *self, void *)
void BM_vert_normal_update(BMVert *v)
void * BM_iter_at_index(BMesh *bm, const char itype, void *data, int index)
PyObject * BPy_BMLoopSeq_CreatePyObject(BMesh *bm)
PyObject * BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype)
PyObject * BPy_BMEditSel_CreatePyObject(BMesh *bm)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params)
Mesh -> BMesh.
static PyObject * bpy_bmesh_uv_select_sync_to_mesh(BPy_BMesh *self)
void mul_m4_v3(const float M[4][4], float r[3])
static PyObject * bpy_bmface_normal_update(BPy_BMFace *self)
PyTypeObject BPy_BMFace_Type
static PyObject * bpy_bmedge_is_wire_get(BPy_BMEdge *self, void *)
int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
PyTypeObject BPy_BMesh_Type
float BM_loop_calc_face_normal(const BMLoop *l, float r_normal[3])
BM_loop_calc_face_normal.
PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[]
static PyObject * bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObject *kw)
double BM_mesh_calc_volume(BMesh *bm, bool is_signed)
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
PyObject * BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
BMElem.__getitem__() / __setitem__()
PyC_FlagSet bpy_bm_htype_all_flags[]
PyTypeObject BPy_BMLayerCollection_Type
int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *py_value)
float BM_face_calc_area(const BMFace *f)
static int bpy_bmesh_select_mode_set(BPy_BMesh *self, PyObject *value, void *)
static PyObject * bpy_bmloop_calc_normal(BPy_BMLoop *self)
void BM_face_normal_update(BMFace *f)
static PyObject * bpy_bmloop_is_convex_get(BPy_BMLoop *self, void *)
BMesh * BM_mesh_copy(BMesh *bm_old)
void BM_edge_kill(BMesh *bm, BMEdge *e)
void BM_mesh_uvselect_sync_from_mesh_sticky_disabled(BMesh *bm)
static PyObject * bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value)
void DEG_id_tag_update(ID *id, unsigned int flags)
static PyObject * bpy_bmvert_copy_from_face_interp(BPy_BMVert *self, PyObject *args)
PyTypeObject BPy_BMEditSelSeq_Type
static PyObject * bpy_bmloop_face_get(BPy_BMLoop *self, void *)
BMesh const char void * data
static PyObject * bpy_bmface_normal_get(BPy_BMFace *self, void *)
void BM_loop_vert_uvselect_set_noflush(BMesh *bm, BMLoop *l, bool select)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
static PyObject * bpy_bmesh_uv_select_flush_shared(BPy_BMesh *self, PyObject *value)
BLI_INLINE bool BM_edge_is_contiguous(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static PyObject * bpy_bmface_repr(BPy_BMFace *self)
static int bpy_bmfaceseq_active_set(BPy_BMElem *self, PyObject *value, void *)
static PyObject * bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value)
static PyObject * bpy_bmesh_uv_select_foreach_set_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select)
void BM_mesh_uvselect_sync_from_mesh_sticky_location(BMesh *bm, const int cd_loop_uv_offset)
static PyObject * bpy_bmedge_calc_face_angle(BPy_BMEdge *self, PyObject *args)
static PyObject * bpy_bmesh_select_flush_mode(BPy_BMesh *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmloop_link_loop_next_get(BPy_BMLoop *self, void *)
float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback)
BMESH EDGE/FACE ANGLE.
int BM_mesh_elem_count(BMesh *bm, const char htype)
PyTypeObject BPy_BMEdgeSeq_Type
const CustomData_MeshMasks CD_MASK_BMESH
static PyObject * bpy_bmvert_normal_update(BPy_BMVert *self)
static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq *self)
static void bpy_bmloop_dealloc(BPy_BMElem *self)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
static PyObject * bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmedge_is_manifold_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmedge_is_convex_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value)
PyTypeObject BPy_BMFaceSeq_Type
static PyObject * bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
static PyObject * bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args)
PyTypeObject BPy_BMLayerItem_Type
static PyObject * bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value)
void BM_mesh_clear(BMesh *bm)
BMesh Clear Mesh.
static PyObject * bpy_bmesh_free(BPy_BMesh *self)
static PyMethodDef bpy_bmvertseq_methods[]
PyTypeObject BPy_BMVertSkin_Type
PyObject * BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BM_face_calc_tangent_from_vert_diagonal(const BMFace *f, float r_tangent[3])
PyObject * BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v)
static int bpy_bmelemseq_sort_cmp_by_keys_ascending(const void *index1_v, const void *index2_v, void *keys_v)
PyTypeObject BPy_BMIter_Type
static PyObject * bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
PyTypeObject BPy_BMElemSeq_Type
static PyObject * bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args)
void BM_mesh_calc_tessellation(BMesh *bm, MutableSpan< std::array< BMLoop *, 3 > > looptris)
static PyObject * bpy_bmloop_vert_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmelemseq_ensure_lookup_table(BPy_BMElemSeq *self)
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()
void BM_edge_normals_update(BMEdge *e)
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
static PyObject * bpy_bmesh_clear(BPy_BMesh *self)
void BKE_id_free(Main *bmain, void *idv)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
static PyGetSetDef bpy_bmface_getseters[]
static PyObject * bpy_bmface_calc_area(BPy_BMFace *self)
float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback)
BMESH VERT/EDGE ANGLE.
static PyObject * bpy_bmloop_uv_select_edge_set(BPy_BMLoop *self, PyObject *value)
PyObject * BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_num)
float BM_face_calc_perimeter(const BMFace *f)
static PyObject * bpy_bmloop_link_loop_prev_get(BPy_BMLoop *self, void *)
static PyObject * bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
float BM_loop_calc_face_angle(const BMLoop *l)
BMFace * BM_face_exists(BMVert *const *varr, int len)
PyTypeObject BPy_BMLayerAccessLoop_Type
int PyC_Long_AsBool(PyObject *value)
static PyObject * bpy_bmloop_edge_get(BPy_BMLoop *self, void *)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
static PyObject * bpy_bmfaceseq_active_get(BPy_BMElemSeq *self, void *)
static PyMethodDef bpy_bmesh_methods[]
void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, const bool do_vertex)
static PyObject * bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
void * PyC_RNA_AsPointer(PyObject *value, const char *type_name)
PyTypeObject BPy_BMLayerAccessEdge_Type
void BM_vert_interp_from_face(BMesh *bm, BMVert *v_dst, const BMFace *f_src)
PyC_FlagSet bpy_bm_hflag_all_flags[]
PyObject * BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_num)
PyObject * BPy_BMFaceSeq_CreatePyObject(BMesh *bm)
static PyMappingMethods bpy_bm_elem_as_mapping
static PyObject * bpy_bmesh_is_wrapped_get(BPy_BMesh *self, void *)
static PyObject * bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
void BM_face_kill(BMesh *bm, BMFace *f)
static PyObject * bpy_bmloop_link_loop_radial_prev_get(BPy_BMLoop *self, void *)
void BLI_qsort_r(void *a, size_t n, size_t es, BLI_sort_cmp_t cmp, void *thunk)
static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
static PyObject * bpy_bmface_uv_select_set(BPy_BMFace *self, PyObject *value)
static PyGetSetDef bpy_bmvertseq_getseters[]
static PyObject * bpy_bmesh_calc_loop_triangles(BPy_BMElem *self)
static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyObject *value)
int bpy_bm_generic_valid_check_source(BMesh *bm_source, const char *error_prefix, void **args, uint args_tot)
@ ID_RECALC_GEOMETRY_ALL_MODES
void BM_mesh_uvselect_flush_from_verts(BMesh *bm, const bool select)
static PyObject * bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
PyObject * BPy_BMVertSeq_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmface_normal_flip(BPy_BMFace *self)
char * BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
static PyObject * bpy_bmelemseq_iter(BPy_BMElemSeq *self)
static PyObject * bpy_bmface_calc_perimeter(BPy_BMFace *self)
PyTypeObject BPy_BMDeformVert_Type
static int bpy_bmelemseq_contains(BPy_BMElemSeq *self, PyObject *value)
static PyObject * bpy_bmesh_uv_select_sync_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject *kw)
void BM_mesh_uvselect_sync_from_mesh_sticky_vert(BMesh *bm)
PyObject * BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype)
static void bm_dealloc_editmode_warn(BPy_BMesh *self)
Mesh * BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preserve_all_data_layers, bool preserve_origindex, bool ensure_subdivision)
PyObject * BPy_BMesh_CreatePyObject(BMesh *bm, int flag)
static PyGetSetDef bpy_bmesh_getseters[]
static PyObject * bpy_bmedge_calc_face_angle_signed(BPy_BMEdge *self, PyObject *args)
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.
static Py_hash_t bpy_bm_elem_hash(PyObject *self)
void BM_face_calc_tangent_from_edge_pair(const BMFace *f, float r_tangent[3])
static PyObject * bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
static PyC_StringEnumItems bpy_bm_uv_select_sticky_items[]
static PyObject * bpy_bmvert_is_manifold_get(BPy_BMVert *self, void *)
static PyObject * bpy_bmface_material_index_get(BPy_BMFace *self, void *)
void BM_mesh_select_flush_from_verts(BMesh *bm, const bool select)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
PyObject * BPy_BMVert_Array_As_Tuple(BMesh *bm, BMVert **elem, Py_ssize_t elem_num)
static PyObject * bpy_bmvert_is_boundary_get(BPy_BMVert *self, void *)
int PyC_ParseStringEnum(PyObject *o, void *p)
int bpy_bm_check_uv_select_sync_valid(BMesh *bm, const char *error_prefix)
void * BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_seq_num, const char htype, const bool do_unique_check, const bool do_bm_check, const char *error_prefix)
static PyObject * bpy_bmvert_co_get(BPy_BMVert *self, void *)
bool BM_vert_is_manifold(const BMVert *v)
static PyObject * bpy_bmedge_is_boundary_get(BPy_BMEdge *self, void *)
static PyObject * bpy_bmedge_calc_tangent(BPy_BMEdge *self, PyObject *args)
static int bpy_bmesh_uv_select_sync_valid_set(BPy_BMesh *self, PyObject *value, void *)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
static PyObject * bpy_bmvert_repr(BPy_BMVert *self)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
static PyObject * bpy_bmesh_copy(BPy_BMesh *self)
void BM_mesh_uvselect_set_elem_from_mesh(BMesh *bm, const bool select, const BMUVSelectPickParams ¶ms, const VectorList< BMVert * > &verts, const VectorList< BMEdge * > &edges, const VectorList< BMFace * > &faces)
PyObject * BPy_BMIter_CreatePyObject(BMesh *bm)
static PyObject * bpy_bmloop_calc_angle(BPy_BMLoop *self)
void BM_face_uvselect_set(BMesh *bm, BMFace *f, bool select)
PyTypeObject BPy_BMEdge_Type
PyObject * BPy_BMEdgeSeq_CreatePyObject(BMesh *bm)
bool BKE_id_is_in_global_main(ID *id)
static PyObject * bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args, PyObject *kw)
static PyObject * bpy_bmiter_next(BPy_BMIter *self)
BMFace ** BPy_BMFace_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_seq_num, bool do_unique_check, bool do_bm_check, const char *error_prefix)
int PyC_ParseTypeOrNone(PyObject *o, void *p)
static PyObject * bpy_bmedge_repr(BPy_BMEdge *self)
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.
void BM_loop_edge_uvselect_set(BMesh *bm, BMLoop *l, bool select)
BMLoop ** BPy_BMLoop_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_seq_num, bool do_unique_check, bool do_bm_check, const char *error_prefix)
void bpy_bm_generic_invalidate(struct BPy_BMGeneric *)
static PyObject * bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
void BM_mesh_uvselect_flush_shared_only_select(BMesh *bm, const int cd_loop_uv_offset)
void BM_mesh_uvselect_flush_shared_only_deselect(BMesh *bm, const int cd_loop_uv_offset)
static PySequenceMethods bpy_bmelemseq_as_sequence
static PyGetSetDef bpy_bmloopseq_getseters[]
void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx)
void BM_face_calc_tangent_from_edge(const BMFace *f, float r_tangent[3])
void BM_mesh_normals_update(BMesh *bm)
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_mesh_uvselect_sync_to_mesh(BMesh *bm)
static PyObject * bpy_bmesh_uv_select_flush_mode(BPy_BMesh *self, PyObject *args, PyObject *kw)
Mesh * BKE_object_get_evaluated_mesh(const Object *object_eval)
MINLINE float clamp_f(float value, float min, float max)
PyC_FlagSet bpy_bm_scene_vert_edge_face_flags[]
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, BMSelectFlushFlag flag)
Select Mode Flush.
PyTypeObject BPy_BMEditSelIter_Type
static PyMethodDef bpy_bmedgeseq_methods[]
PyObject * BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e)
bool BM_loop_is_convex(const BMLoop *l)
PyObject * BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f)
#define PyC_TYPE_OR_NONE_INIT(py_type, value_p)
header-only compatibility defines.
bool update_shapekey_indices
struct BMLoop * radial_next
struct BMLoop * radial_prev
bool uv_select_sync_valid