Blender V5.0
bmesh_mesh_convert.hh File Reference
#include "BLI_string_ref.hh"
#include "bmesh.hh"

Go to the source code of this file.

Classes

struct  BMeshFromMeshParams
struct  BMeshToMeshParams

Functions

bool BM_attribute_stored_in_bmesh_builtin (blender::StringRef name)
void BM_mesh_bm_from_me (BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params) ATTR_NONNULL(1
 Mesh -> BMesh.
void BM_mesh_bm_to_me (struct Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params) ATTR_NONNULL(2
void void BM_mesh_bm_to_me_for_eval (BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *cd_mask_extra)
void BM_mesh_bm_to_me_compact (BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *mask, bool add_mesh_attributes)

Function Documentation

◆ BM_attribute_stored_in_bmesh_builtin()

bool BM_attribute_stored_in_bmesh_builtin ( blender::StringRef name)
Returns
Whether attributes with the given name are stored in special flags or fields in BMesh rather than in the regular custom data blocks.

Definition at line 118 of file bmesh_mesh_convert.cc.

References ELEM, and name.

Referenced by CustomData_shallow_copy_remove_non_bmesh_attributes(), blender::ed::sculpt_paint::dyntopo::dyntopo_supports_layer(), and mesh_attribute_valid().

◆ BM_mesh_bm_from_me()

void BM_mesh_bm_from_me ( BMesh * bm,
const Mesh * mesh,
const BMeshFromMeshParams * params )

Mesh -> BMesh.

Parameters
bmThe mesh to write into, while this is typically a newly created BMesh, merging into existing data is supported. Note the custom-data layout isn't used. If more comprehensive merging is needed we should move this into a separate function since this should be kept fast for edit-mode switching and storing undo steps.
Warning
This function doesn't calculate face normals.

References bm, and params.

◆ BM_mesh_bm_to_me()

void BM_mesh_bm_to_me ( struct Main * bmain,
BMesh * bm,
Mesh * mesh,
const BMeshToMeshParams * params )
Parameters
bmainMay be NULL in case calc_object_remap parameter option is not set.

References bm, mask(), and params.

◆ BM_mesh_bm_to_me_compact()

void BM_mesh_bm_to_me_compact ( BMesh & bm,
Mesh & mesh,
const CustomData_MeshMasks * mask,
bool add_mesh_attributes )

A version of BM_mesh_bm_to_me_for_eval but copying data layers and Mesh attributes is optional. It also allows shape-keys but don't re-assigns shape-key indices.

Parameters
maskCustom data masks to control which layers are copied. If nullptr, no layer data is copied.
add_mesh_attributesIf true, adds mesh attributes during the conversion.

Definition at line 1647 of file bmesh_mesh_convert.cc.

References Mesh::act_face, assert_bmesh_has_no_mesh_only_attributes(), BKE_mesh_runtime_clear_geometry(), BLI_assert, bm, BM_EDGE, blender::bm_edge_table_build(), BM_elem_index_get, BM_FACE, blender::bm_face_loop_table_build(), BM_LOOP, blender::bm_to_mesh_edges(), blender::bm_to_mesh_faces(), blender::bm_to_mesh_loops(), blender::bm_to_mesh_verts(), BM_VERT, blender::bm_vert_table_build(), CD_CONSTRUCT, CD_FLAG_NOCOPY, CD_PROP_FLOAT2, blender::bke::Corner, Mesh::corner_data, Mesh::corners_num, CustomData_has_layer(), CustomData_merge_layout(), blender::bke::Edge, Mesh::edge_data, Mesh::edges_num, blender::bke::Face, Mesh::face_data, Mesh::faces_num, blender::bke::SpanAttributeWriter< T >::finish(), Mesh::flag, i, blender::bke::MutableAttributeAccessor::lookup_or_add_for_write_only_span(), mask(), ME_FLAG_UV_SELECT_SYNC_VALID, blender::threading::parallel_invoke(), blender::bke::Point, blender::Array< T, InlineBufferCapacity, Allocator >::reinitialize(), Mesh::runtime, blender::bke::SpanAttributeWriter< T >::span, Mesh::totface_legacy, Mesh::vert_data, and Mesh::verts_num.

Referenced by BM_mesh_bm_to_me_for_eval(), and blender::ed::transform::create_mesh().

◆ BM_mesh_bm_to_me_for_eval()

void void BM_mesh_bm_to_me_for_eval ( BMesh & bm,
Mesh & mesh,
const CustomData_MeshMasks * cd_mask_extra )

A version of BM_mesh_bm_to_me intended for getting the mesh to pass to the modifier stack for evaluation, instead of mode switching (where we make sure all data is kept and do expensive lookups to maintain shape keys).

Key differences:

  • Don't support merging with existing mesh.
  • Ignore shape-keys.
  • Ignore vertex-parents.
  • Ignore selection history.
  • Uses CD_MASK_DERIVEDMESH instead of CD_MASK_MESH.
Note
Was cddm_from_bmesh_ex in 2.7x, removed MFace support.

Definition at line 1844 of file bmesh_mesh_convert.cc.

References bm, BM_mesh_bm_to_me_compact(), CD_MASK_DERIVEDMESH, CD_MASK_SHAPEKEY, CustomData_MeshMasks_update(), and mask().

Referenced by BKE_mesh_from_bmesh_for_eval_nomain(), BKE_mesh_wrapper_ensure_mdata(), and blender::ed::spreadsheet::geometry_display_data_get().