|
Blender
V2.93
|
#include "MEM_guardedalloc.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_types.h"#include "BLI_ghash.h"#include "BLI_math.h"#include "BLI_threads.h"#include "BLI_utildefines.h"#include "BKE_editmesh.h"#include "BKE_editmesh_cache.h"#include "BKE_lib_id.h"#include "BKE_mesh.h"#include "BKE_mesh_runtime.h"#include "BKE_mesh_wrapper.h"#include "DEG_depsgraph.h"Go to the source code of this file.
Functions | |
| Mesh * | BKE_mesh_wrapper_from_editmesh_with_coords (BMEditMesh *em, const CustomData_MeshMasks *cd_mask_extra, const float(*vert_coords)[3], const Mesh *me_settings) |
| Mesh * | BKE_mesh_wrapper_from_editmesh (BMEditMesh *em, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings) |
| void | BKE_mesh_wrapper_ensure_mdata (Mesh *me) |
| bool | BKE_mesh_wrapper_minmax (const Mesh *me, float min[3], float max[3]) |
Mesh Coordinate Access | |
| void | BKE_mesh_wrapper_vert_coords_copy (const Mesh *me, float(*vert_coords)[3], int vert_coords_len) |
| void | BKE_mesh_wrapper_vert_coords_copy_with_mat4 (const Mesh *me, 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 *me) |
| int | BKE_mesh_wrapper_edge_len (const Mesh *me) |
| int | BKE_mesh_wrapper_loop_len (const Mesh *me) |
| int | BKE_mesh_wrapper_poly_len (const Mesh *me) |
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 (MPoly, MLoop, MEdge, MVert). 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.c.
| int BKE_mesh_wrapper_edge_len | ( | const Mesh * | me | ) |
Definition at line 250 of file mesh_wrapper.c.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, BMesh::totedge, Mesh::totedge, and Mesh_Runtime::wrapper_type.
| void BKE_mesh_wrapper_ensure_mdata | ( | Mesh * | me | ) |
Definition at line 98 of file mesh_wrapper.c.
References BKE_mesh_vert_coords_apply(), BKE_mesh_wrapper_deferred_finalize(), BLI_assert, BLI_mutex_lock(), BLI_mutex_unlock(), BMEditMesh::bm, BM_mesh_bm_to_me_for_eval(), Mesh_Runtime::cd_mask_extra, Mesh_Runtime::edit_data, Mesh::edit_mesh, Mesh_Runtime::eval_mutex, Mesh_Runtime::is_original, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, NULL, Mesh::runtime, Mesh::totedge, Mesh::totloop, Mesh::totpoly, Mesh::totvert, EditMeshData::vertexCos, Mesh_Runtime::wrapper_type, and Mesh_Runtime::wrapper_type_finalize.
Referenced by blender::bke::add_final_mesh_as_geometry_component(), BKE_modifier_modify_mesh(), BKE_object_data_transfer_ex(), BKE_shrinkwrap_init_tree(), deformVertsEM(), ED_mesh_deform_bind_callback(), editbmesh_calc_modifiers(), blender::ed::spreadsheet::get_display_geometry_set(), mesh_new_from_mesh(), modifier_modify_mesh_and_geometry_set(), modifyMesh(), modifyVolume(), and surfacedeformModifier_do().
| Mesh* BKE_mesh_wrapper_from_editmesh | ( | BMEditMesh * | em, |
| const CustomData_MeshMasks * | cd_mask_extra, | ||
| const Mesh * | me_settings | ||
| ) |
Definition at line 91 of file mesh_wrapper.c.
References BKE_mesh_wrapper_from_editmesh_with_coords(), and NULL.
| Mesh* BKE_mesh_wrapper_from_editmesh_with_coords | ( | BMEditMesh * | em, |
| const CustomData_MeshMasks * | cd_mask_extra, | ||
| const float(*) | vert_coords[3], | ||
| const Mesh * | me_settings | ||
| ) |
Definition at line 55 of file mesh_wrapper.c.
References BKE_id_new_nomain(), BKE_mesh_copy_settings(), BKE_mesh_runtime_ensure_edit_data(), Mesh_Runtime::cd_mask_extra, Mesh_Runtime::edit_data, Mesh::edit_mesh, ID_ME, Mesh_Runtime::is_original, ME_WRAPPER_TYPE_BMESH, MEM_dupallocN, NULL, Mesh::runtime, Mesh::totedge, Mesh::totloop, Mesh::totpoly, Mesh::totvert, EditMeshData::vertexCos, and Mesh_Runtime::wrapper_type.
Referenced by BKE_mesh_wrapper_from_editmesh().
| int BKE_mesh_wrapper_loop_len | ( | const Mesh * | me | ) |
Definition at line 262 of file mesh_wrapper.c.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, BMesh::totloop, Mesh::totloop, and Mesh_Runtime::wrapper_type.
Definition at line 143 of file mesh_wrapper.c.
References BKE_editmesh_cache_calc_minmax(), BKE_mesh_minmax(), BLI_assert_unreachable, Mesh_Runtime::edit_data, Mesh::edit_mesh, max, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, min, Mesh::runtime, and Mesh_Runtime::wrapper_type.
| int BKE_mesh_wrapper_poly_len | ( | const Mesh * | me | ) |
Definition at line 274 of file mesh_wrapper.c.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, BMesh::totface, Mesh::totpoly, and Mesh_Runtime::wrapper_type.
| void BKE_mesh_wrapper_vert_coords_copy | ( | const Mesh * | me, |
| float(*) | vert_coords[3], | ||
| int | vert_coords_len | ||
| ) |
Definition at line 159 of file mesh_wrapper.c.
References BLI_assert, BLI_assert_unreachable, BMEditMesh::bm, bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, copy_v3_v3(), Mesh_Runtime::edit_data, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::mvert, NULL, Mesh::runtime, v, EditMeshData::vertexCos, and Mesh_Runtime::wrapper_type.
| void BKE_mesh_wrapper_vert_coords_copy_with_mat4 | ( | const Mesh * | me, |
| float(*) | vert_coords[3], | ||
| int | vert_coords_len, | ||
| const float | mat[4][4] | ||
| ) |
Definition at line 195 of file mesh_wrapper.c.
References BLI_assert, BLI_assert_unreachable, BMEditMesh::bm, bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, Mesh_Runtime::edit_data, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, mul_v3_m4v3(), Mesh::mvert, NULL, Mesh::runtime, BMesh::totvert, Mesh::totvert, v, EditMeshData::vertexCos, and Mesh_Runtime::wrapper_type.
| int BKE_mesh_wrapper_vert_len | ( | const Mesh * | me | ) |
Definition at line 238 of file mesh_wrapper.c.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, BMesh::totvert, Mesh::totvert, and Mesh_Runtime::wrapper_type.