The BMesh data structure
Calculate mesh volume based on face normals.
Parameters: | signed (bool) – when signed is true, negative values may be returned. |
---|---|
Returns: | The volume of the mesh. |
Return type: | float |
Clear all mesh data.
Explicitly free the BMesh data from memory, causing exceptions on further access.
Note
The BMesh is freed automatically, typically when the script finishes executing. However in some cases its hard to predict when this will be and its useful to explicitly free the data.
Initialize this bmesh from existing mesh datablock.
Parameters: |
|
---|
Initialize this bmesh from existing object datablock (currently only meshes are supported).
Parameters: |
|
---|
Update mesh normals.
Flush selection, independent of the current selection mode.
Parameters: | select (boolean) – flush selection or de-selected elements. |
---|
flush selection based on the current mode current BMesh.select_mode.
Writes this BMesh data into an existing Mesh datablock.
Parameters: | mesh (Mesh) – The mesh data to write into. |
---|
Transform the mesh (optionally filtering flagged data only).
Parameters: |
|
---|
True when this element is valid (hasn’t been removed).
Type : | boolean |
---|
True when this mesh is owned by blender (typically the editmode BMesh).
Type : | boolean |
---|
Sequence of selected items (the last is displayed as active).
Type : | BMEditSelSeq |
---|
The selection mode, values can be {‘VERT’, ‘EDGE’, ‘FACE’}, can’t be assigned an empty set.
Type : | set |
---|
The BMesh vertex type
Return a multiplier calculated based on the sharpness of the vertex. Where a flat surface gives 1.0, and higher values sharper edges. This is used to maintain shell thickness when offsetting verts along their normals.
Returns: | offset multiplier |
---|---|
Return type: | float |
Return the angle between this verts 2 connected edges.
Returns: | Angle between edges in radians. |
---|---|
Return type: | float |
Copy values from another element of matching type.
Interpolate the customdata from a face onto this loop (the loops vert should overlap the face).
Parameters: | face (BMFace) – The face to interpolate data from. |
---|
Interpolate the customdata from a vert between 2 other verts.
Parameters: | vert_pair (BMVert) – The vert to interpolate data from. |
---|
Set the hide state. This is different from the hide attribute because it updates the selection and hide state of associated geometry.
Parameters: | hide (boolean) – Hidden or visible. |
---|
Update vertex normal.
Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.
Parameters: | select (boolean) – Select or de-select. |
---|
Note
Currently this only flushes down, so selecting a face will select all its vertices but de-selecting a vertex won’t de-select all the faces that use it, before finishing with a mesh typically flushing is still needed.
The coordinates for this vertex as a 3D, wrapped vector.
Type : | mathutils.Vector |
---|
Hidden state of this element.
Type : | boolean |
---|
Index of this element.
Type : | int |
---|
Note
This value is not necessarily valid, while editing the mesh it can become dirty.
It’s also possible to assign any number to this attribute for a scripts internal logic.
To ensure the value is up to date - see BMElemSeq.index_update.
True when this vertex is manifold (read-only).
Type : | boolean |
---|
True when this element is valid (hasn’t been removed).
Type : | boolean |
---|
True when this vertex is not connected to any faces (read-only).
Type : | boolean |
---|
The normal for this vertex as a 3D, wrapped vector.
Type : | mathutils.Vector |
---|
Selected state of this element.
Type : | boolean |
---|
Generic attribute scripts can use for own logic
Type : | boolean |
---|
The BMesh edge connecting 2 verts
Returns: | The angle between 2 connected faces in radians. |
---|---|
Return type: | float |
Returns: | The angle between 2 connected faces in radians (negative for concave join). |
---|---|
Return type: | float |
Returns: | The length between both verts. |
---|---|
Return type: | float |
Return the tangent at this edge relative to a face (pointing inward into the face). This uses the face normal for calculation.
Parameters: | loop (BMLoop) – The loop used for tangent calculation. |
---|---|
Returns: | a normalized vector. |
Return type: | mathutils.Vector |
Copy values from another element of matching type.
Set the hide state. This is different from the hide attribute because it updates the selection and hide state of associated geometry.
Parameters: | hide (boolean) – Hidden or visible. |
---|
Update edges vertex normals.
Return the other vertex on this edge or None if the vertex is not used by this edge.
Parameters: | vert (BMVert) – a vert in this edge. |
---|---|
Returns: | The edges other vert. |
Return type: | BMVert or None |
Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.
Parameters: | select (boolean) – Select or de-select. |
---|
Note
Currently this only flushes down, so selecting a face will select all its vertices but de-selecting a vertex won’t de-select all the faces that use it, before finishing with a mesh typically flushing is still needed.
Hidden state of this element.
Type : | boolean |
---|
Index of this element.
Type : | int |
---|
Note
This value is not necessarily valid, while editing the mesh it can become dirty.
It’s also possible to assign any number to this attribute for a scripts internal logic.
To ensure the value is up to date - see BMElemSeq.index_update.
True when this edge is at the boundary of a face (read-only).
Type : | boolean |
---|
True when this edge is manifold, between two faces with the same winding (read-only).
Type : | boolean |
---|
True when this edge joins 2 convex faces, depends on a valid face normal (read-only).
Type : | boolean |
---|
True when this edge is manifold (read-only).
Type : | boolean |
---|
True when this element is valid (hasn’t been removed).
Type : | boolean |
---|
True when this edge is not connected to any faces (read-only).
Type : | boolean |
---|
Seam for UV unwrapping.
Type : | boolean |
---|
Selected state of this element.
Type : | boolean |
---|
Smooth state of this element.
Type : | boolean |
---|
Generic attribute scripts can use for own logic
Type : | boolean |
---|
The BMesh face with 3 or more sides
Return the area of the face.
Returns: | Return the area of the face. |
---|---|
Return type: | float |
Return bounds center of the face.
Returns: | a 3D vector. |
---|---|
Return type: | mathutils.Vector |
Return median center of the face.
Returns: | a 3D vector. |
---|---|
Return type: | mathutils.Vector |
Return median center of the face weighted by edge lengths.
Returns: | a 3D vector. |
---|---|
Return type: | mathutils.Vector |
Return the perimeter of the face.
Returns: | Return the perimeter of the face. |
---|---|
Return type: | float |
Make a copy of this face.
Parameters: |
|
---|---|
Returns: | The newly created face. |
Return type: |
Copy values from another element of matching type.
Interpolate the customdata from another face onto this one (faces should overlap).
Parameters: |
|
---|
Set the hide state. This is different from the hide attribute because it updates the selection and hide state of associated geometry.
Parameters: | hide (boolean) – Hidden or visible. |
---|
Reverses winding of a face, which flips its normal.
Update faces normal.
Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.
Parameters: | select (boolean) – Select or de-select. |
---|
Note
Currently this only flushes down, so selecting a face will select all its vertices but de-selecting a vertex won’t de-select all the faces that use it, before finishing with a mesh typically flushing is still needed.
Hidden state of this element.
Type : | boolean |
---|
Index of this element.
Type : | int |
---|
Note
This value is not necessarily valid, while editing the mesh it can become dirty.
It’s also possible to assign any number to this attribute for a scripts internal logic.
To ensure the value is up to date - see BMElemSeq.index_update.
True when this element is valid (hasn’t been removed).
Type : | boolean |
---|
The faces material index.
Type : | int |
---|
The normal for this face as a 3D, wrapped vector.
Type : | mathutils.Vector |
---|
Selected state of this element.
Type : | boolean |
---|
Smooth state of this element.
Type : | boolean |
---|
Generic attribute scripts can use for own logic
Type : | boolean |
---|
This is normally accessed from BMFace.loops where each face corner represents a corner of a face.
Return the angle at this loops corner of the face. This is calculated so sharper corners give lower angles.
Returns: | The angle in radians. |
---|---|
Return type: | float |
Return normal at this loops corner of the face. Falls back to the face normal for straight lines.
Returns: | a normalized vector. |
---|---|
Return type: | mathutils.Vector |
Return the tangent at this loops corner of the face (pointing inward into the face). Falls back to the face normal for straight lines.
Returns: | a normalized vector. |
---|---|
Return type: | mathutils.Vector |
Copy values from another element of matching type.
Interpolate the customdata from a face onto this loop (the loops vert should overlap the face).
Parameters: |
|
---|
Index of this element.
Type : | int |
---|
Note
This value is not necessarily valid, while editing the mesh it can become dirty.
It’s also possible to assign any number to this attribute for a scripts internal logic.
To ensure the value is up to date - see BMElemSeq.index_update.
True when this loop is at the convex corner of a face, depends on a valid face normal (read-only).
Type : | boolean |
---|
True when this element is valid (hasn’t been removed).
Type : | boolean |
---|
Generic attribute scripts can use for own logic
Type : | boolean |
---|
General sequence type used for accessing any sequence of BMVert, BMEdge, BMFace, BMLoop.
When accessed via BMesh.verts, BMesh.edges, BMesh.faces there are also functions to create/remomove items.
Initialize the index values of this sequence.
This is the equivalent of looping over all elements and assigning the index values.
for index, ele in enumerate(sequence):
ele.index = index
Note
Running this on sequences besides BMesh.verts, BMesh.edges, BMesh.faces works but wont result in each element having a valid index, insted its order in the sequence will be set.
Initialize the index values of this sequence.
This is the equivalent of looping over all elements and assigning the index values.
for index, ele in enumerate(sequence):
ele.index = index
Note
Running this on sequences besides BMesh.verts, BMesh.edges, BMesh.faces works but wont result in each element having a valid index, insted its order in the sequence will be set.
Create a new vertex.
Parameters: |
|
---|---|
Returns: | The newly created edge. |
Return type: |
Remove a vert.
Sort the elements of this sequence, using an optional custom sort key. Indices of elements are not changed, BMElemeSeq.index_update() can be used for that.
Parameters: |
|
---|
Note
When the ‘key’ argument is not provided, the elements are reordered following their current index value. In particular this can be used by setting indices manually before calling this method.
custom-data layers (read-only).
Type : | BMLayerAccessVert |
---|
Return a edge which uses the verts passed.
Parameters: |
|
---|---|
Returns: | The edge found or None |
Return type: |
Initialize the index values of this sequence.
This is the equivalent of looping over all elements and assigning the index values.
for index, ele in enumerate(sequence):
ele.index = index
Note
Running this on sequences besides BMesh.verts, BMesh.edges, BMesh.faces works but wont result in each element having a valid index, insted its order in the sequence will be set.
Create a new edge from a given pair of verts.
Parameters: | |
---|---|
Returns: | The newly created edge. |
Return type: |
Remove a edge.
Sort the elements of this sequence, using an optional custom sort key. Indices of elements are not changed, BMElemeSeq.index_update() can be used for that.
Parameters: |
|
---|
Note
When the ‘key’ argument is not provided, the elements are reordered following their current index value. In particular this can be used by setting indices manually before calling this method.
custom-data layers (read-only).
Type : | BMLayerAccessEdge |
---|
Return a face which uses the verts passed.
Parameters: |
|
---|---|
Returns: | The face found or None |
Return type: |
Initialize the index values of this sequence.
This is the equivalent of looping over all elements and assigning the index values.
for index, ele in enumerate(sequence):
ele.index = index
Note
Running this on sequences besides BMesh.verts, BMesh.edges, BMesh.faces works but wont result in each element having a valid index, insted its order in the sequence will be set.
Create a new face from a given set of verts.
Parameters: | |
---|---|
Returns: | The newly created face. |
Return type: |
Remove a face.
Sort the elements of this sequence, using an optional custom sort key. Indices of elements are not changed, BMElemeSeq.index_update() can be used for that.
Parameters: |
|
---|
Note
When the ‘key’ argument is not provided, the elements are reordered following their current index value. In particular this can be used by setting indices manually before calling this method.
custom-data layers (read-only).
Type : | BMLayerAccessFace |
---|
custom-data layers (read-only).
Type : | BMLayerAccessLoop |
---|
Add an element to the selection history (no action taken if its already added).
Empties the selection history.
Remove an element from the selection history.
Ensures all elements in the selection history are selected.
Exposes custom-data layer attributes.
Bevel weight float in [0 - 1].
Type : | BMLayerCollection |
---|
Vertex deform weight BMDeformVert (TODO).
type: BMLayerCollection
Generic float custom-data layer.
type: BMLayerCollection
Generic int custom-data layer.
type: BMLayerCollection
Vertex shapekey absolute location (as a 3D Vector).
Type : | BMLayerCollection |
---|
Generic string custom-data layer (exposed as bytes, 255 max length).
type: BMLayerCollection
Exposes custom-data layer attributes.
Bevel weight float in [0 - 1].
Type : | BMLayerCollection |
---|
Edge crease for subsurf - float in [0 - 1].
Type : | BMLayerCollection |
---|
Generic float custom-data layer.
type: BMLayerCollection
Accessor for Freestyle edge layer.
type: BMLayerCollection
Generic int custom-data layer.
type: BMLayerCollection
Generic string custom-data layer (exposed as bytes, 255 max length).
type: BMLayerCollection
Exposes custom-data layer attributes.
Generic float custom-data layer.
type: BMLayerCollection
Accessor for Freestyle face layer.
type: BMLayerCollection
Generic int custom-data layer.
type: BMLayerCollection
Generic string custom-data layer (exposed as bytes, 255 max length).
type: BMLayerCollection
Accessor for BMTexPoly layer (TODO).
type: BMLayerCollection
Exposes custom-data layer attributes.
Accessor for vertex color layer.
type: BMLayerCollection
Generic float custom-data layer.
type: BMLayerCollection
Generic int custom-data layer.
type: BMLayerCollection
Generic string custom-data layer (exposed as bytes, 255 max length).
type: BMLayerCollection
Accessor for BMLoopUV UV (as a 2D Vector).
type: BMLayerCollection
Gives access to a collection of custom-data layers of the same type and behaves like python dictionaries, except for the ability to do list like index access.
Returns the value of the layer matching the key or default when not found (matches pythons dictionary function of the same name).
Parameters: |
|
---|
Return the values of collection (matching pythons dict.values() functionality).
Returns: | the members of this collection. |
---|---|
Return type: | list |
Return the identifiers of collection members (matching pythons dict.keys() functionality).
Returns: | the identifiers for each member of this collection. |
---|---|
Return type: | list of strings |
Create a new layer
Parameters: | name (string) – Optional name argument (will be made unique). |
---|---|
Returns: | The newly created layer. |
Return type: | BMLayerItem |
Remove a layer
Parameters: | layer (BMLayerItem) – The layer to remove. |
---|
Return the identifiers of collection members (matching pythons dict.items() functionality).
Returns: | (key, value) pairs for each member of this collection. |
---|---|
Return type: | list of tuples |
Create a new layer or return an existing active layer
Returns: | The newly verified layer. |
---|---|
Return type: | BMLayerItem |
The active layer of this type (read-only).
Type : | BMLayerItem |
---|
Exposes a single custom data layer, their main purpose is for use as item accessors to custom-data when used with vert/edge/face/loop data.
Return a copy of the layer
Parameters: |
|
---|
The layers unique name (read-only).
Type : | string |
---|
UV pin state.
Type : | boolean |
---|
UV select state.
Type : | boolean |
---|
UV edge select state.
Type : | boolean |
---|
Loops UV (as a 2D Vector).
Type : | mathutils.Vector |
---|
Clears all weights.
Returns the deform weight matching the key or default when not found (matches pythons dictionary function of the same name).
Parameters: |
|
---|
Return the weights of the deform vertex (matching pythons dict.values() functionality).
Returns: | The weights that influence this vertex |
---|---|
Return type: | list of floats |
Return the group indices used by this vertex (matching pythons dict.keys() functionality).
Returns: | the deform group this vertex uses |
---|---|
Return type: | list of ints |
Return (group, weight) pairs for this vertex (matching pythons dict.items() functionality).
Returns: | (key, value) pairs for each deform weight of this vertex. |
---|---|
Return type: | list of tuples |