Blender
V3.3
|
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_task.hh"
#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 "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_mesh.h"
#include "BKE_subdiv_modifier.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
Go to the source code of this file.
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.cc.
int BKE_mesh_wrapper_edge_len | ( | const Mesh * | me | ) |
Definition at line 265 of file mesh_wrapper.cc.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, Mesh::runtime, BMesh::totedge, Mesh::totedge, and Mesh_Runtime::wrapper_type.
Definition at line 94 of file mesh_wrapper.cc.
References BLI_mutex_lock(), BLI_mutex_unlock(), Mesh_Runtime::eval_mutex, blender::threading::isolate_task(), ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, and Mesh_Runtime::wrapper_type.
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_build_data(), editbmesh_calc_modifiers(), mesh_new_from_mesh(), mesh_to_volume(), modifier_modify_mesh_and_geometry_set(), modifyMesh(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), blender::ed::spreadsheet::spreadsheet_get_display_geometry_set(), and surfacedeformModifier_do().
Definition at line 370 of file mesh_wrapper.cc.
References BLI_mutex_lock(), BLI_mutex_unlock(), Mesh_Runtime::eval_mutex, blender::threading::isolate_task(), ME_WRAPPER_TYPE_SUBD, Mesh_Runtime::mesh_eval, mesh_wrapper_ensure_subdivision(), result, Mesh::runtime, and Mesh_Runtime::wrapper_type.
Referenced by BKE_object_get_evaluated_mesh(), mesh_foreachScreenEdge(), mesh_foreachScreenEdge_clip_bb_segment(), mesh_foreachScreenFace(), mesh_foreachScreenVert(), mesh_new_from_mesh(), and mesh_new_from_mesh_object_with_layers().
Mesh* BKE_mesh_wrapper_from_editmesh | ( | BMEditMesh * | em, |
const CustomData_MeshMasks * | cd_mask_extra, | ||
const Mesh * | me_settings | ||
) |
Definition at line 87 of file mesh_wrapper.cc.
References BKE_mesh_wrapper_from_editmesh_with_coords().
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 49 of file mesh_wrapper.cc.
References BKE_id_new_nomain(), BKE_mesh_copy_parameters_for_eval(), BKE_mesh_runtime_ensure_edit_data(), Mesh_Runtime::cd_mask_extra, Mesh_Runtime::edit_data, Mesh::edit_mesh, ID_ME, Mesh_Runtime::is_original, BMEditMesh::is_shallow_copy, ME_WRAPPER_TYPE_BMESH, MEM_dupallocN, 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 278 of file mesh_wrapper.cc.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, Mesh::runtime, BMesh::totloop, Mesh::totloop, and Mesh_Runtime::wrapper_type.
Definition at line 154 of file mesh_wrapper.cc.
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, ME_WRAPPER_TYPE_SUBD, min, Mesh::runtime, and Mesh_Runtime::wrapper_type.
int BKE_mesh_wrapper_poly_len | ( | const Mesh * | me | ) |
Definition at line 291 of file mesh_wrapper.cc.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, 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 171 of file mesh_wrapper.cc.
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, ME_WRAPPER_TYPE_SUBD, Mesh::mvert, 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 208 of file mesh_wrapper.cc.
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, ME_WRAPPER_TYPE_SUBD, mul_v3_m4v3(), Mesh::mvert, 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 252 of file mesh_wrapper.cc.
References BLI_assert_unreachable, BMEditMesh::bm, Mesh::edit_mesh, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, Mesh::runtime, BMesh::totvert, Mesh::totvert, and Mesh_Runtime::wrapper_type.
Definition at line 310 of file mesh_wrapper.cc.
References BKE_id_free(), BKE_mesh_calc_normals_split(), BKE_mesh_set_custom_normals(), BKE_subdiv_free(), BKE_subdiv_to_mesh(), BKE_subsurf_modifier_subdiv_descriptor_ensure(), BLI_assert, SubsurfRuntimeData::calc_loop_normals, CD_FLAG_TEMPORARY, CD_NORMAL, CustomData_clear_layer_flag(), CustomData_get_layer(), CustomData_set_layer_flag(), float(), if(), Mesh::ldata, SubdivSettings::level, ME_WRAPPER_TYPE_SUBD, Mesh_Runtime::mesh_eval, NULL, SubdivToMeshSettings::resolution, SubsurfRuntimeData::resolution, Mesh::runtime, SubsurfRuntimeData::settings, SubsurfRuntimeData::subdiv, Mesh_Runtime::subsurf_runtime_data, SubsurfRuntimeData::use_loop_normals, SubdivToMeshSettings::use_optimal_display, SubsurfRuntimeData::use_optimal_display, and Mesh_Runtime::wrapper_type.
Referenced by BKE_mesh_wrapper_ensure_subdivision().