Blender V4.3
bmesh_py_utils.cc File Reference
#include <Python.h>
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "../mathutils/mathutils.hh"
#include "bmesh.hh"
#include "bmesh_py_types.hh"
#include "bmesh_py_utils.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_utildefines.hh"

Go to the source code of this file.

Functions

 PyDoc_STRVAR (bpy_bm_utils_vert_collapse_edge_doc, ".. method:: vert_collapse_edge(vert, edge)\n" "\n" " Collapse a vertex into an edge.\n" "\n" " :arg vert: The vert that will be collapsed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edge: The edge to collapse into.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :return: The resulting edge from the collapse operation.\n" " :rtype: :class:`bmesh.types.BMEdge`\n")
 
static PyObject * bpy_bm_utils_vert_collapse_edge (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_vert_collapse_faces_doc, ".. method:: vert_collapse_faces(vert, edge, fac, join_faces)\n" "\n" " Collapses a vertex that has only two manifold edges onto a vertex it shares an " "edge with.\n" "\n" " :arg vert: The vert that will be collapsed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edge: The edge to collapse into.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :arg fac: The factor to use when merging customdata [0 - 1].\n" " :type fac: float\n" " :arg join_faces: When true the faces around the vertex will be joined otherwise " "collapse the vertex by merging the 2 edges this vertex connects to into one.\n" " :type join_faces: bool\n" " :return: The resulting edge from the collapse operation.\n" " :rtype: :class:`bmesh.types.BMEdge`\n")
 
static PyObject * bpy_bm_utils_vert_collapse_faces (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_vert_dissolve_doc, ".. method:: vert_dissolve(vert)\n" "\n" " Dissolve this vertex (will be removed).\n" "\n" " :arg vert: The vert to be dissolved.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :return: True when the vertex dissolve is successful.\n" " :rtype: bool\n")
 
static PyObject * bpy_bm_utils_vert_dissolve (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_vert_splice_doc, ".. method:: vert_splice(vert, vert_target)\n" "\n" " Splice vert into vert_target.\n" "\n" " :arg vert: The vertex to be removed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg vert_target: The vertex to use.\n" " :type vert_target: :class:`bmesh.types.BMVert`\n" "\n" " .. note:: The verts mustn't share an edge or face.\n")
 
static PyObject * bpy_bm_utils_vert_splice (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_vert_separate_doc, ".. method:: vert_separate(vert, edges)\n" "\n" " Separate this vertex at every edge.\n" "\n" " :arg vert: The vert to be separated.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edges: The edges to separated.\n" " :type edges: :class:`bmesh.types.BMEdge`\n" " :return: The newly separated verts (including the vertex passed).\n" " :rtype: tuple[:class:`bmesh.types.BMVert`, ...]\n")
 
static PyObject * bpy_bm_utils_vert_separate (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_edge_split_doc, ".. method:: edge_split(edge, vert, fac)\n" "\n" " Split an edge, return the newly created data.\n" "\n" " :arg edge: The edge to split.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :arg vert: One of the verts on the edge, defines the split direction.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg fac: The point on the edge where the new vert will be created [0 - 1].\n" " :type fac: float\n" " :return: The newly created (edge, vert) pair.\n" " :rtype: tuple[:class:`bmesh.types.BMEdge`, :class:`bmesh.types.BMVert`]\n")
 
static PyObject * bpy_bm_utils_edge_split (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_edge_rotate_doc, ".. method:: edge_rotate(edge, ccw=False)\n" "\n" " Rotate the edge and return the newly created edge.\n" " If rotating the edge fails, None will be returned.\n" "\n" " :arg edge: The edge to rotate.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :arg ccw: When True the edge will be rotated counter clockwise.\n" " :type ccw: bool\n" " :return: The newly rotated edge.\n" " :rtype: :class:`bmesh.types.BMEdge`\n")
 
static PyObject * bpy_bm_utils_edge_rotate (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_face_split_doc, ".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n" "\n" " Face split with optional intermediate points.\n" "\n" " :arg face: The face to cut.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg vert_a: First vertex to cut in the face (face must contain the vert).\n" " :type vert_a: :class:`bmesh.types.BMVert`\n" " :arg vert_b: Second vertex to cut in the face (face must contain the vert).\n" " :type vert_b: :class:`bmesh.types.BMVert`\n" " :arg coords: Optional sequence of 3D points in between *vert_a* and *vert_b*.\n" " :type coords: Sequence[Sequence[float]]\n" " :arg use_exist: .Use an existing edge if it exists (Only used when *coords* argument is " "empty or omitted)\n" " :type use_exist: bool\n" " :arg example: Newly created edge will copy settings from this one.\n" " :type example: :class:`bmesh.types.BMEdge`\n" " :return: The newly created face or None on failure.\n" " :rtype: tuple[:class:`bmesh.types.BMFace`, :class:`bmesh.types.BMLoop`]\n")
 
static PyObject * bpy_bm_utils_face_split (PyObject *, PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (bpy_bm_utils_face_split_edgenet_doc, ".. method:: face_split_edgenet(face, edgenet)\n" "\n" " Splits a face into any number of regions defined by an edgenet.\n" "\n" " :arg face: The face to split.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg face: The face to split.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg edgenet: Sequence of edges.\n" " :type edgenet: Sequence[:class:`bmesh.types.BMEdge`]\n" " :return: The newly created faces.\n" " :rtype: tuple[:class:`bmesh.types.BMFace`, ...]\n" "\n" " .. note::\n" "\n" " Regions defined by edges need to connect to the face, otherwise they're " "ignored as loose edges.\n")
 
static PyObject * bpy_bm_utils_face_split_edgenet (PyObject *, PyObject *args, PyObject *kw)
 
 PyDoc_STRVAR (bpy_bm_utils_face_join_doc, ".. method:: face_join(faces, remove=True)\n" "\n" " Joins a sequence of faces.\n" "\n" " :arg faces: Sequence of faces.\n" " :type faces: :class:`bmesh.types.BMFace`\n" " :arg remove: Remove the edges and vertices between the faces.\n" " :type remove: bool\n" " :return: The newly created face or None on failure.\n" " :rtype: :class:`bmesh.types.BMFace`\n")
 
static PyObject * bpy_bm_utils_face_join (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_face_vert_separate_doc, ".. method:: face_vert_separate(face, vert)\n" "\n" " Rip a vertex in a face away and add a new vertex.\n" "\n" " :arg face: The face to separate.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg vert: A vertex in the face to separate.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :return vert: The newly created vertex or None on failure.\n" " :rtype vert: :class:`bmesh.types.BMVert`\n" "\n" " .. note::\n" "\n" " This is the same as loop_separate, and has only been added for convenience.\n")
 
static PyObject * bpy_bm_utils_face_vert_separate (PyObject *, PyObject *args)
 
 PyDoc_STRVAR (bpy_bm_utils_face_flip_doc, ".. method:: face_flip(faces)\n" "\n" " Flip the faces direction.\n" "\n" " :arg face: Face to flip.\n" " :type face: :class:`bmesh.types.BMFace`\n")
 
static PyObject * bpy_bm_utils_face_flip (PyObject *, BPy_BMFace *value)
 
 PyDoc_STRVAR (bpy_bm_utils_loop_separate_doc, ".. method:: loop_separate(loop)\n" "\n" " Rip a vertex in a face away and add a new vertex.\n" "\n" " :arg loop: The loop to separate.\n" " :type loop: :class:`bmesh.types.BMLoop`\n" " :return vert: The newly created vertex or None on failure.\n" " :rtype vert: :class:`bmesh.types.BMVert`\n")
 
static PyObject * bpy_bm_utils_loop_separate (PyObject *, BPy_BMLoop *value)
 
 PyDoc_STRVAR (BPy_BM_utils_doc, "This module provides access to blenders bmesh data structures.")
 
PyObject * BPyInit_bmesh_utils ()
 

Variables

static PyMethodDef BPy_BM_utils_methods []
 
static PyModuleDef BPy_BM_utils_module_def
 

Detailed Description

This file defines the 'bmesh.utils' module. Utility functions for operating on 'bmesh.types'

Definition in file bmesh_py_utils.cc.

Function Documentation

◆ bpy_bm_utils_edge_rotate()

static PyObject * bpy_bm_utils_edge_rotate ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_edge_split()

static PyObject * bpy_bm_utils_edge_split ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_face_flip()

static PyObject * bpy_bm_utils_face_flip ( PyObject * ,
BPy_BMFace * value )
static

Definition at line 730 of file bmesh_py_utils.cc.

References BM_face_normal_flip(), BPY_BM_CHECK_OBJ, and BPy_BMFace_Check.

◆ bpy_bm_utils_face_join()

static PyObject * bpy_bm_utils_face_join ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_face_split()

◆ bpy_bm_utils_face_split_edgenet()

◆ bpy_bm_utils_face_vert_separate()

static PyObject * bpy_bm_utils_face_vert_separate ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_loop_separate()

static PyObject * bpy_bm_utils_loop_separate ( PyObject * ,
BPy_BMLoop * value )
static

◆ bpy_bm_utils_vert_collapse_edge()

static PyObject * bpy_bm_utils_vert_collapse_edge ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_vert_collapse_faces()

static PyObject * bpy_bm_utils_vert_collapse_faces ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_vert_dissolve()

static PyObject * bpy_bm_utils_vert_dissolve ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_vert_separate()

static PyObject * bpy_bm_utils_vert_separate ( PyObject * ,
PyObject * args )
static

◆ bpy_bm_utils_vert_splice()

static PyObject * bpy_bm_utils_vert_splice ( PyObject * ,
PyObject * args )
static

◆ BPyInit_bmesh_utils()

PyObject * BPyInit_bmesh_utils ( )

Definition at line 860 of file bmesh_py_utils.cc.

References BPy_BM_utils_module_def.

Referenced by BPyInit_bmesh().

◆ PyDoc_STRVAR() [1/14]

PyDoc_STRVAR ( BPy_BM_utils_doc ,
"This module provides access to blenders bmesh data structures."  )

◆ PyDoc_STRVAR() [2/14]

PyDoc_STRVAR ( bpy_bm_utils_edge_rotate_doc ,
".. method:: edge_rotate(edge, ccw=False)\n" "\n" " Rotate the edge and return the newly created edge.\n" " If rotating the edge fails,
None will be returned.\n" "\n" " :arg edge:The edge to rotate.\n" " :type edge::class:`bmesh.types.BMEdge`\n" " :arg ccw:When True the edge will be rotated counter clockwise.\n" " :type ccw:bool\n" " :return:The newly rotated edge.\n" " :rtype::class:`bmesh.types.BMEdge`\n"  )

◆ PyDoc_STRVAR() [3/14]

PyDoc_STRVAR ( bpy_bm_utils_edge_split_doc ,
".. method:: edge_split(edge, vert, fac)\n" "\n" " Split an edge,
return the newly created data.\n" "\n" " :arg edge:The edge to split.\n" " :type edge::class:`bmesh.types.BMEdge`\n" " :arg vert:One of the verts on the edge,
defines the split direction.\n" " :type vert::class:`bmesh.types.BMVert`\n" " :arg fac:The point on the edge where the new vert will be created .\n" " :type fac:float\n" " :return:The newly created(edge, vert) pair.\n" " :rtype:tuple\n" [0 - 1][:class:`bmesh.types.BMEdge`, :class:`bmesh.types.BMVert`] )

◆ PyDoc_STRVAR() [4/14]

PyDoc_STRVAR ( bpy_bm_utils_face_flip_doc ,
".. method:: face_flip(faces)\n" "\n" " Flip the faces direction.\n" "\n" " :arg face: Face to flip.\n" " :type face: :class:`bmesh.types.BMFace`\n"  )

◆ PyDoc_STRVAR() [5/14]

PyDoc_STRVAR ( bpy_bm_utils_face_join_doc ,
".. method:: face_join(faces, remove=True)\n" "\n" " Joins a sequence of faces.\n" "\n" " :arg faces: Sequence of faces.\n" " :type faces: :class:`bmesh.types.BMFace`\n" " :arg remove: Remove the edges and vertices between the faces.\n" " :type remove: bool\n" " :return: The newly created face or None on failure.\n" " :rtype: :class:`bmesh.types.BMFace`\n"  )

◆ PyDoc_STRVAR() [6/14]

PyDoc_STRVAR ( bpy_bm_utils_face_split_doc ,
".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n" "\n" " Face split with optional intermediate points.\n" "\n" " :arg face: The face to cut.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg vert_a: First vertex to cut in the face (face must contain the vert).\n" " :type vert_a: :class:`bmesh.types.BMVert`\n" " :arg vert_b: Second vertex to cut in the face (face must contain the vert).\n" " :type vert_b: :class:`bmesh.types.BMVert`\n" " :arg coords: Optional sequence of 3D points in between *vert_a* and *vert_b*.\n" " :type coords: Sequence]\n" " :arg use_exist: .Use an existing edge if it exists (Only used when *coords* argument is " "empty or omitted)\n" " :type use_exist: bool\n" " :arg example: Newly created edge will copy settings from this one.\n" " :type example: :class:`bmesh.types.BMEdge`\n" " :return: The newly created face or None on failure.\n" " :rtype: tuple\n" [Sequence[float][:class:`bmesh.types.BMFace`, :class:`bmesh.types.BMLoop`] )

◆ PyDoc_STRVAR() [7/14]

PyDoc_STRVAR ( bpy_bm_utils_face_split_edgenet_doc ,
".. method:: face_split_edgenet(face, edgenet)\n" "\n" " Splits a face into any number of regions defined by an edgenet.\n" "\n" " :arg face: The face to split.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg face: The face to split.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg edgenet: Sequence of edges.\n" " :type edgenet: Sequence\n" " :return: The newly created faces.\n" " :rtype: tuple\n" "\n" " .. note::\n" "\n" " Regions defined by edges need to connect to the face[:class:`bmesh.types.BMEdge`][:class:`bmesh.types.BMFace`,...],
otherwise they 're " "ignored as loose edges.\n"  )

◆ PyDoc_STRVAR() [8/14]

PyDoc_STRVAR ( bpy_bm_utils_face_vert_separate_doc ,
".. method:: face_vert_separate(face, vert)\n" "\n" " Rip a vertex in a face away and add a new vertex.\n" "\n" " :arg face: The face to separate.\n" " :type face: :class:`bmesh.types.BMFace`\n" " :arg vert: A vertex in the face to separate.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :return vert: The newly created vertex or None on failure.\n" " :rtype vert: :class:`bmesh.types.BMVert`\n" "\n" " .. note::\n" "\n" " This is the same as loop_separate,
and has only been added for convenience.\n"  )

◆ PyDoc_STRVAR() [9/14]

PyDoc_STRVAR ( bpy_bm_utils_loop_separate_doc ,
".. method:: loop_separate(loop)\n" "\n" " Rip a vertex in a face away and add a new vertex.\n" "\n" " :arg loop: The loop to separate.\n" " :type loop: :class:`bmesh.types.BMLoop`\n" " :return vert: The newly created vertex or None on failure.\n" " :rtype vert: :class:`bmesh.types.BMVert`\n"  )

◆ PyDoc_STRVAR() [10/14]

PyDoc_STRVAR ( bpy_bm_utils_vert_collapse_edge_doc ,
".. method:: vert_collapse_edge(vert, edge)\n" "\n" " Collapse a vertex into an edge.\n" "\n" " :arg vert: The vert that will be collapsed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edge: The edge to collapse into.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :return: The resulting edge from the collapse operation.\n" " :rtype: :class:`bmesh.types.BMEdge`\n"  )

◆ PyDoc_STRVAR() [11/14]

PyDoc_STRVAR ( bpy_bm_utils_vert_collapse_faces_doc ,
".. method:: vert_collapse_faces(vert, edge, fac, join_faces)\n" "\n" " Collapses a vertex that has only two manifold edges onto a vertex it shares an " "edge with.\n" "\n" " :arg vert: The vert that will be collapsed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edge: The edge to collapse into.\n" " :type edge: :class:`bmesh.types.BMEdge`\n" " :arg fac: The factor to use when merging customdata .\n" " :type fac: float\n" " :arg join_faces: When true the faces around the vertex will be joined otherwise " "collapse the vertex by merging the 2 edges this vertex connects to into one.\n" " :type join_faces: bool\n" " :return: The resulting edge from the collapse operation.\n" " :rtype: :class:`bmesh.types.BMEdge`\n" [0 - 1] )

◆ PyDoc_STRVAR() [12/14]

PyDoc_STRVAR ( bpy_bm_utils_vert_dissolve_doc ,
".. method:: vert_dissolve(vert)\n" "\n" " Dissolve this vertex (will be removed).\n" "\n" " :arg vert: The vert to be dissolved.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :return: True when the vertex dissolve is successful.\n" " :rtype: bool\n"  )

◆ PyDoc_STRVAR() [13/14]

PyDoc_STRVAR ( bpy_bm_utils_vert_separate_doc ,
".. method:: vert_separate(vert, edges)\n" "\n" " Separate this vertex at every edge.\n" "\n" " :arg vert: The vert to be separated.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg edges: The edges to separated.\n" " :type edges: :class:`bmesh.types.BMEdge`\n" " :return: The newly separated verts (including the vertex passed).\n" " :rtype: tuple\n" [:class:`bmesh.types.BMVert`,...] )

◆ PyDoc_STRVAR() [14/14]

PyDoc_STRVAR ( bpy_bm_utils_vert_splice_doc ,
".. method:: vert_splice(vert, vert_target)\n" "\n" " Splice vert into vert_target.\n" "\n" " :arg vert: The vertex to be removed.\n" " :type vert: :class:`bmesh.types.BMVert`\n" " :arg vert_target: The vertex to use.\n" " :type vert_target: :class:`bmesh.types.BMVert`\n" "\n" " .. note:: The verts mustn't share an edge or face.\n"  )

Variable Documentation

◆ BPy_BM_utils_methods

PyMethodDef BPy_BM_utils_methods[]
static

Definition at line 790 of file bmesh_py_utils.cc.

◆ BPy_BM_utils_module_def

PyModuleDef BPy_BM_utils_module_def
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"bmesh.utils",
BPy_BM_utils_doc,
0,
nullptr,
nullptr,
nullptr,
nullptr,
}
static PyMethodDef BPy_BM_utils_methods[]

Definition at line 848 of file bmesh_py_utils.cc.

Referenced by BPyInit_bmesh_utils().