Blender V5.0
mesh_wrapper.cc File Reference
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
#include "BLI_task.hh"
#include "BLI_utildefines.h"
#include "BKE_editmesh.hh"
#include "BKE_editmesh_cache.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_modifier.hh"
#include "BKE_subdiv.hh"
#include "BKE_subdiv_mesh.hh"
#include "BKE_subdiv_modifier.hh"

Go to the source code of this file.

Typedefs

using float3

Functions

MeshBKE_mesh_wrapper_from_editmesh (std::shared_ptr< BMEditMesh > em, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings)
void BKE_mesh_wrapper_ensure_mdata (Mesh *mesh)
Mesh Coordinate Access
Span< float3BKE_mesh_wrapper_vert_coords (const Mesh *mesh)
Span< float3BKE_mesh_wrapper_face_normals (Mesh *mesh)
void BKE_mesh_wrapper_tag_positions_changed (Mesh *mesh)
void BKE_mesh_wrapper_vert_coords_copy (const Mesh *mesh, blender::MutableSpan< float3 > positions)
void BKE_mesh_wrapper_vert_coords_copy_with_mat4 (const Mesh *mesh, float(*vert_coords)[3], int vert_coords_len, const float mat[4][4])
Mesh Array Length Access
int BKE_mesh_wrapper_vert_len (const Mesh *mesh)
int BKE_mesh_wrapper_edge_len (const Mesh *mesh)
int BKE_mesh_wrapper_loop_len (const Mesh *mesh)
int BKE_mesh_wrapper_face_len (const Mesh *mesh)
CPU Subdivision Evaluation
static Meshmesh_wrapper_ensure_subdivision (Mesh *mesh)
MeshBKE_mesh_wrapper_ensure_subdivision (Mesh *mesh)
const MeshBKE_mesh_wrapper_ensure_subdivision (const Mesh *mesh)

Detailed Description

The primary purpose of this API is to avoid unnecessary mesh conversion for the final output of a modified mesh.

This API handles the case when the modifier stack outputs a mesh which does not have Mesh data (#Mesh::faces(), corner verts, corner edges, edges, etc). Currently this is used so the resulting mesh can have BMEditMesh data, postponing the converting until it's needed or avoiding conversion entirely which can be an expensive operation. Once converted, the meshes type changes to ME_WRAPPER_TYPE_MDATA, although the edit mesh is not cleared.

This API exposes functions that abstract over the different kinds of internal data, as well as supporting converting the mesh into regular mesh.

Definition in file mesh_wrapper.cc.

Typedef Documentation

◆ float3

Definition at line 619 of file BLI_math_vector_types.hh.

Function Documentation

◆ BKE_mesh_wrapper_edge_len()

int BKE_mesh_wrapper_edge_len ( const Mesh * mesh)

◆ BKE_mesh_wrapper_ensure_mdata()

◆ BKE_mesh_wrapper_ensure_subdivision() [1/2]

const Mesh * BKE_mesh_wrapper_ensure_subdivision ( const Mesh * mesh)

Definition at line 401 of file mesh_wrapper.cc.

References BKE_mesh_wrapper_ensure_subdivision().

◆ BKE_mesh_wrapper_ensure_subdivision() [2/2]

◆ BKE_mesh_wrapper_face_len()

int BKE_mesh_wrapper_face_len ( const Mesh * mesh)

◆ BKE_mesh_wrapper_face_normals()

Span< float3 > BKE_mesh_wrapper_face_normals ( Mesh * mesh)

Return a contiguous array of face normal values, if available. Otherwise, normals are stored in BMesh faces and this returns null.

Definition at line 150 of file mesh_wrapper.cc.

References BKE_editmesh_cache_ensure_face_normals(), BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, and Mesh::runtime.

Referenced by DRW_text_edit_mesh_measure_stats().

◆ BKE_mesh_wrapper_from_editmesh()

◆ BKE_mesh_wrapper_loop_len()

int BKE_mesh_wrapper_loop_len ( const Mesh * mesh)

◆ BKE_mesh_wrapper_tag_positions_changed()

void BKE_mesh_wrapper_tag_positions_changed ( Mesh * mesh)

◆ BKE_mesh_wrapper_vert_coords()

Span< float3 > BKE_mesh_wrapper_vert_coords ( const Mesh * mesh)

◆ BKE_mesh_wrapper_vert_coords_copy()

◆ BKE_mesh_wrapper_vert_coords_copy_with_mat4()

void BKE_mesh_wrapper_vert_coords_copy_with_mat4 ( const Mesh * mesh,
float(*) vert_coords[3],
int vert_coords_len,
const float mat[4][4] )

◆ BKE_mesh_wrapper_vert_len()

◆ mesh_wrapper_ensure_subdivision()