|
Blender V4.3
|
#include "MEM_guardedalloc.h"#include "DNA_modifier_types.h"#include "DNA_object_types.h"#include "BLI_ghash.h"#include "BLI_math_matrix.h"#include "BLI_math_vector.h"#include "BLI_math_vector.hh"#include "BLI_task.hh"#include "BLI_threads.h"#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_object.hh"#include "BKE_subdiv.hh"#include "BKE_subdiv_mesh.hh"#include "BKE_subdiv_modifier.hh"#include "DEG_depsgraph.hh"#include "DEG_depsgraph_query.hh"Go to the source code of this file.
Functions | |
| Mesh * | BKE_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< float3 > | BKE_mesh_wrapper_vert_coords (const Mesh *mesh) |
| Span< float3 > | BKE_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 Mesh * | mesh_wrapper_ensure_subdivision (Mesh *mesh) |
| Mesh * | BKE_mesh_wrapper_ensure_subdivision (Mesh *mesh) |
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.
Definition at line 277 of file mesh_wrapper.cc.
References BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
| void BKE_mesh_wrapper_ensure_mdata | ( | Mesh * | mesh | ) |
Definition at line 91 of file mesh_wrapper.cc.
References BKE_mesh_ensure_default_orig_index_customdata_no_check(), BLI_assert, BMEditMesh::bm, BM_mesh_bm_to_me_for_eval(), blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), blender::threading::isolate_task(), lock, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, Mesh::runtime, and blender::bke::EditMeshData::vert_positions.
Referenced by blender::bke::add_final_mesh_as_geometry_component(), arrayModifier_doArray(), bc_get_mesh_copy(), BKE_modifier_modify_mesh(), BKE_object_data_transfer_ex(), BKE_shrinkwrap_init_tree(), blender::io::alembic::ABCGenericMeshWriter::do_write(), ED_mesh_deform_bind_callback(), blender::bke::editbmesh_build_data(), blender::bke::editbmesh_calc_modifiers(), blender::io::stl::export_frame(), blender::ed::geometry::get_original_geometry_eval_copy(), blender::io::ply::load_plydata(), mesh_new_from_mesh(), mesh_to_volume(), blender::bke::modifier_modify_mesh_and_geometry_set(), modify_mesh(), modify_mesh(), 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 380 of file mesh_wrapper.cc.
References blender::threading::isolate_task(), lock, ME_WRAPPER_TYPE_SUBD, mesh_wrapper_ensure_subdivision(), result, and Mesh::runtime.
Referenced by BKE_object_get_evaluated_mesh_unchecked(), mesh_foreachScreenEdge(), mesh_foreachScreenEdge_clip_bb_segment(), mesh_foreachScreenFace(), mesh_foreachScreenVert(), mesh_new_from_mesh(), and mesh_new_from_mesh_object_with_layers().
Definition at line 303 of file mesh_wrapper.cc.
References BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
Referenced by surfacedeformModifier_do().
Return a contiguous array of face normal values, if available. Otherwise, normals are stored in BMesh faces and this returns null.
Definition at line 161 of file mesh_wrapper.cc.
References BKE_editmesh_cache_ensure_face_normals(), BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
Referenced by DRW_text_edit_mesh_measure_stats().
| Mesh * BKE_mesh_wrapper_from_editmesh | ( | std::shared_ptr< BMEditMesh > | em, |
| const CustomData_MeshMasks * | cd_mask_extra, | ||
| const Mesh * | me_settings ) |
Definition at line 54 of file mesh_wrapper.cc.
References BKE_id_new_nomain(), BKE_mesh_copy_parameters_for_eval(), BKE_mesh_runtime_ensure_edit_data(), ID_ME, ME_WRAPPER_TYPE_BMESH, and mesh.
Referenced by BKE_crazyspace_get_first_deform_matrices_editbmesh(), blender::bke::editbmesh_calc_modifiers(), and blender::ed::geometry::get_original_geometry_eval_copy().
Definition at line 290 of file mesh_wrapper.cc.
References BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
| void BKE_mesh_wrapper_tag_positions_changed | ( | Mesh * | mesh | ) |
Definition at line 175 of file mesh_wrapper.cc.
References ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
Referenced by blender::bke::editbmesh_calc_modifiers().
Return a contiguous array of vertex position values, if available. Otherwise, vertex positions are stored in BMesh vertices and this returns null.
Definition at line 148 of file mesh_wrapper.cc.
References BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
Referenced by BKE_editmesh_vert_coords_when_deformed(), BKE_object_foreach_display_point(), DRW_text_edit_mesh_measure_stats(), EDBM_unified_findnearest_from_raycast(), gizmo_preselect_elem_test_select(), and blender::bke::mesh_get_mapped_verts_coords().
| void BKE_mesh_wrapper_vert_coords_copy | ( | const Mesh * | mesh, |
| blender::MutableSpan< float3 > | positions ) |
Definition at line 192 of file mesh_wrapper.cc.
References BLI_assert_unreachable, bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, copy_v3_v3(), blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, v, and blender::bke::EditMeshData::vert_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] ) |
Definition at line 220 of file mesh_wrapper.cc.
References BLI_assert, BLI_assert_unreachable, bm, BM_ITER_MESH_INDEX, BM_VERTS_OF_MESH, BMVert::co, blender::Array< T, InlineBufferCapacity, Allocator >::is_empty(), ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, ME_WRAPPER_TYPE_SUBD, mul_v3_m4v3(), BMesh::totvert, v, and blender::bke::EditMeshData::vert_positions.
Referenced by surfacedeformModifier_do().
Definition at line 264 of file mesh_wrapper.cc.
References BLI_assert_unreachable, ME_WRAPPER_TYPE_BMESH, ME_WRAPPER_TYPE_MDATA, and ME_WRAPPER_TYPE_SUBD.
Referenced by BKE_editmesh_vert_coords_when_deformed(), EDBM_unified_findnearest_from_raycast(), gizmo_preselect_elem_test_select(), meshdeformModifier_do(), and surfacedeformModifier_do().
Definition at line 322 of file mesh_wrapper.cc.
References BKE_id_free(), BKE_mesh_set_custom_normals(), BKE_subsurf_modifier_subdiv_descriptor_ensure(), CD_CONSTRUCT, CD_NORMAL, Mesh::corner_data, CustomData_add_layer(), CustomData_free_layers(), CustomData_get_layer_for_write(), ELEM, blender::bke::subdiv::Settings::level, ME_WRAPPER_TYPE_SUBD, mesh, blender::bke::subdiv::ToMeshSettings::resolution, SubsurfRuntimeData::resolution, Mesh::runtime, SubsurfRuntimeData::settings, SubsurfRuntimeData::subdiv_cpu, SubsurfRuntimeData::subdiv_gpu, SubsurfRuntimeData::use_loop_normals, blender::bke::subdiv::ToMeshSettings::use_optimal_display, and SubsurfRuntimeData::use_optimal_display.
Referenced by BKE_mesh_wrapper_ensure_subdivision().