|
Blender V4.3
|
#include "BLI_compiler_attrs.h"#include "BLI_math_vector_types.hh"#include "BLI_span.hh"#include "DNA_customdata_types.h"Go to the source code of this file.
Classes | |
| struct | DerivedMesh |
Enumerations | |
| enum | DerivedMeshType { DM_TYPE_CDDM , DM_TYPE_CCGDM } |
Functions | |
| void | DM_init_funcs (DerivedMesh *dm) |
| void | DM_init (DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges, int numTessFaces, int numLoops, int numPolys) |
| void | DM_from_template (DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type, int numVerts, int numEdges, int numTessFaces, int numLoops, int numPolys) |
| void | DM_release (DerivedMesh *dm) |
| void | DM_set_only_copy (DerivedMesh *dm, const CustomData_MeshMasks *mask) |
| DerivedMesh * | CDDM_from_mesh (Mesh *mesh) |
| void | DM_copy_vert_data (const DerivedMesh *source, DerivedMesh *dest, int source_index, int dest_index, int count) |
| void | DM_interp_vert_data (const DerivedMesh *source, DerivedMesh *dest, int *src_indices, float *weights, int count, int dest_index) |
Custom Data Layer Access Functions | |
| |
| void * | DM_get_vert_data_layer (DerivedMesh *dm, eCustomDataType type) |
| void * | DM_get_edge_data_layer (DerivedMesh *dm, eCustomDataType type) |
| void * | DM_get_poly_data_layer (DerivedMesh *dm, eCustomDataType type) |
| void * | DM_get_loop_data_layer (DerivedMesh *dm, eCustomDataType type) |
Basic design of the DerivedMesh system:
DerivedMesh is a common set of interfaces for mesh systems.
There are three main mesh data structures in Blender: Mesh, CDDerivedMesh and BMesh.
These, and a few others, all implement DerivedMesh interfaces, which contains unified drawing interfaces, a few utility interfaces, and a bunch of read-only interfaces intended mostly for conversion from one format to another.
All Mesh structures in blender make use of CustomData, which is used to store per-element attributes and interpolate them (e.g. UVs, vertex-colors, vertex-groups, etc).
Mesh is the "serialized" structure, used for storing object-mode mesh data and also for saving stuff to disk. Its interfaces are also what DerivedMesh uses to communicate with.
#CDDM is a little mesh library, that uses Mesh data structures in the backend. It's mostly used for modifiers, and has the advantages of not taking much resources.
BMesh is a full-on BREP, used for edit-mode, some modifiers, etc. It's much more capable (if memory-intensive) then CDDM.
DerivedMesh is somewhat hackish. Many places assumes that a DerivedMesh is a CDDM (most of the time by simply copying it and converting it to one). CDDM is the original structure for modifiers, but has since been superseded by BMesh, at least for the foreseeable future.
Definition in file BKE_mesh_legacy_derived_mesh.hh.
| enum DerivedMeshType |
| Enumerator | |
|---|---|
| DM_TYPE_CDDM | |
| DM_TYPE_CCGDM | |
Definition at line 61 of file BKE_mesh_legacy_derived_mesh.hh.
| DerivedMesh * CDDM_from_mesh | ( | Mesh * | mesh | ) |
Definition at line 361 of file mesh_legacy_derived_mesh.cc.
References CD_MASK_MESH, and cdDM_from_mesh_ex().
Referenced by multires_modifier_update_mdisps(), blender::ed::object::multiresbake_create_hiresdm(), blender::ed::object::multiresbake_create_loresdm(), shrinkwrapModifier_deform(), and subsurf_calculate_limit_positions().
| void DM_copy_vert_data | ( | const DerivedMesh * | source, |
| DerivedMesh * | dest, | ||
| int | source_index, | ||
| int | dest_index, | ||
| int | count ) |
Custom data copy functions copy count elements from source_index in source to dest_index in dest these copy all layers for which the CD_FLAG_NOCOPY flag is not set.
Definition at line 198 of file mesh_legacy_derived_mesh.cc.
References count, CustomData_copy_data(), and DerivedMesh::vertData.
Referenced by set_ccgdm_all_geometry().
| void DM_from_template | ( | DerivedMesh * | dm, |
| DerivedMesh * | source, | ||
| DerivedMeshType | type, | ||
| int | numVerts, | ||
| int | numEdges, | ||
| int | numTessFaces, | ||
| int | numLoops, | ||
| int | numPolys ) |
Utility function to initialize a DerivedMesh for the desired number of vertices, edges and faces, with a layer setup copied from source
Definition at line 122 of file mesh_legacy_derived_mesh.cc.
References CD_MASK_DERIVEDMESH, CD_SET_DEFAULT, CustomData_init_layout_from(), DM_init_funcs(), DerivedMesh::edgeData, DerivedMesh::face_offsets, DerivedMesh::faceData, DerivedMesh::loopData, MEM_dupallocN, DerivedMesh::numEdgeData, DerivedMesh::numLoopData, DerivedMesh::numPolyData, DerivedMesh::numTessFaceData, DerivedMesh::numVertData, DerivedMesh::polyData, DerivedMesh::type, and DerivedMesh::vertData.
Referenced by getCCGDerivedMesh().
| void * DM_get_edge_data_layer | ( | DerivedMesh * | dm, |
| eCustomDataType | type ) |
Definition at line 183 of file mesh_legacy_derived_mesh.cc.
References CustomData_get_layer_for_write(), DerivedMesh::edgeData, and DerivedMesh::getNumEdges.
Referenced by ccgDM_get_edge_data_layer(), cdDM_create(), DM_init_funcs(), and set_ccgdm_all_geometry().
| void * DM_get_loop_data_layer | ( | DerivedMesh * | dm, |
| eCustomDataType | type ) |
Definition at line 193 of file mesh_legacy_derived_mesh.cc.
References CustomData_get_layer_for_write(), DerivedMesh::getNumLoops, and DerivedMesh::loopData.
Referenced by DM_init_funcs(), and do_multires_bake().
| void * DM_get_poly_data_layer | ( | DerivedMesh * | dm, |
| eCustomDataType | type ) |
Definition at line 188 of file mesh_legacy_derived_mesh.cc.
References CustomData_get_layer_for_write(), DerivedMesh::getNumPolys, and DerivedMesh::polyData.
Referenced by ccgDM_get_poly_data_layer(), DM_init_funcs(), and set_ccgdm_all_geometry().
| void * DM_get_vert_data_layer | ( | DerivedMesh * | dm, |
| eCustomDataType | type ) |
Definition at line 178 of file mesh_legacy_derived_mesh.cc.
References CustomData_get_layer_for_write(), DerivedMesh::getNumVerts, and DerivedMesh::vertData.
Referenced by ccgDM_get_vert_data_layer(), cdDM_create(), DM_init_funcs(), and set_ccgdm_all_geometry().
| void DM_init | ( | DerivedMesh * | dm, |
| DerivedMeshType | type, | ||
| int | numVerts, | ||
| int | numEdges, | ||
| int | numTessFaces, | ||
| int | numLoops, | ||
| int | numPolys ) |
Utility function to initialize a DerivedMesh for the desired number of vertices, edges and faces (doesn't allocate memory for them, just sets up the custom data layers)>
Definition at line 97 of file mesh_legacy_derived_mesh.cc.
References CD_NUMTYPES, copy_vn_i(), DM_init_funcs(), DerivedMesh::edgeData, DerivedMesh::faceData, DerivedMesh::loopData, DerivedMesh::numEdgeData, DerivedMesh::numLoopData, DerivedMesh::numPolyData, DerivedMesh::numTessFaceData, DerivedMesh::numVertData, DerivedMesh::polyData, DerivedMesh::type, CustomData::typemap, and DerivedMesh::vertData.
Referenced by cdDM_from_mesh_ex().
| void DM_init_funcs | ( | DerivedMesh * | dm | ) |
Utility function to initialize a DerivedMesh's function pointers to the default implementation (for those functions which have a default).
Definition at line 82 of file mesh_legacy_derived_mesh.cc.
References DM_get_edge_data_layer(), DM_get_loop_data_layer(), DM_get_poly_data_layer(), DM_get_vert_data_layer(), dm_getCornerEdgeArray(), dm_getCornerVertArray(), dm_getEdgeArray(), dm_getPolyArray(), dm_getVertArray(), DerivedMesh::getCornerEdgeArray, DerivedMesh::getCornerVertArray, DerivedMesh::getEdgeArray, DerivedMesh::getEdgeDataArray, DerivedMesh::getLoopDataArray, DerivedMesh::getPolyArray, DerivedMesh::getPolyDataArray, DerivedMesh::getVertArray, and DerivedMesh::getVertDataArray.
Referenced by DM_from_template(), and DM_init().
| void DM_interp_vert_data | ( | const DerivedMesh * | source, |
| DerivedMesh * | dest, | ||
| int * | src_indices, | ||
| float * | weights, | ||
| int | count, | ||
| int | dest_index ) |
Interpolates vertex data from the vertices indexed by src_indices in the source mesh using the given weights and stores the result in the vertex indexed by dest_index in the dest mesh.
Definition at line 204 of file mesh_legacy_derived_mesh.cc.
References count, CustomData_interp(), and DerivedMesh::vertData.
Referenced by set_ccgdm_all_geometry().
| void DM_release | ( | DerivedMesh * | dm | ) |
Definition at line 154 of file mesh_legacy_derived_mesh.cc.
References CustomData_free(), DerivedMesh::edgeData, DerivedMesh::face_offsets, DerivedMesh::faceData, DerivedMesh::loopData, MEM_SAFE_FREE, DerivedMesh::numEdgeData, DerivedMesh::numLoopData, DerivedMesh::numPolyData, DerivedMesh::numTessFaceData, DerivedMesh::numVertData, DerivedMesh::polyData, and DerivedMesh::vertData.
Referenced by ccgDM_release(), and cdDM_release().
| void DM_set_only_copy | ( | DerivedMesh * | dm, |
| const CustomData_MeshMasks * | mask ) |
set the CD_FLAG_NOCOPY flag in custom data layers where the mask is zero for the layer type, so only layer types specified by the mask will be copied
Definition at line 164 of file mesh_legacy_derived_mesh.cc.
References CustomData_set_only_copy(), DerivedMesh::edgeData, DerivedMesh::faceData, DerivedMesh::loopData, DerivedMesh::polyData, and DerivedMesh::vertData.
Referenced by multires_modifier_update_mdisps(), blender::ed::object::multiresbake_create_hiresdm(), and blender::ed::object::multiresbake_create_loresdm().