|
Blender V5.0
|
#include <algorithm>#include <climits>#include <cstring>#include "CLG_log.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "BLI_map.hh"#include "BLI_math_base.h"#include "BLI_math_vector.h"#include "BLI_ordered_edge.hh"#include "BLI_sort.hh"#include "BLI_sys_types.h"#include "BLI_utildefines.h"#include "BKE_attribute.hh"#include "BKE_customdata.hh"#include "BKE_deform.hh"#include "BKE_mesh.hh"#include "BKE_mesh_runtime.hh"#include "DEG_depsgraph.hh"#include "MEM_guardedalloc.h"Go to the source code of this file.
Classes | |
| union | EdgeUUID |
| struct | SortFaceLegacy |
| struct | SortFace |
Macros | |
| #define | INVALID_CORNER_EDGE_MARKER 4294967295u |
| #define | REMOVE_EDGE_TAG(_me) |
| #define | IS_REMOVED_EDGE(_me) |
| #define | REMOVE_CORNER_TAG(corner) |
| #define | REMOVE_FACE_TAG(_mf) |
| #define | CHECK_FACE_VERT_INDEX(a, b) |
| #define | CHECK_FACE_EDGE(a, b) |
Typedefs | |
| using | float3 |
Functions | |
Mesh Stripping (removing invalid data) | |
| void | strip_loose_faces_corners (Mesh *mesh, blender::BitSpan faces_to_remove) |
| void | mesh_strip_edges (Mesh *mesh) |
Internal functions | |
| static void | edge_store_assign (uint32_t verts[2], const uint32_t v1, const uint32_t v2) |
| static void | edge_store_from_mface_quad (EdgeUUID es[4], const MFace *mf) |
| static void | edge_store_from_mface_tri (EdgeUUID es[4], const MFace *mf) |
| static bool | search_legacy_face_cmp (const SortFaceLegacy &sfa, const SortFaceLegacy &sfb) |
| static bool | search_face_cmp (const SortFace &sp1, const SortFace &sp2) |
| static bool | search_face_corner_cmp (const SortFace &sp1, const SortFace &sp2) |
Variables | |
| static CLG_LogRef | LOG = {"geom.mesh"} |
Mesh Validation | |
| #define | PRINT_MSG(...) |
| #define | PRINT_ERR(...) |
| bool | BKE_mesh_validate_arrays (Mesh *mesh, float(*vert_positions)[3], uint verts_num, blender::int2 *edges, uint edges_num, MFace *legacy_faces, uint legacy_faces_num, const int *corner_verts, int *corner_edges, uint corners_num, const int *face_offsets, uint faces_num, MDeformVert *dverts, const bool do_verbose, const bool do_fixes, bool *r_changed) |
| static bool | mesh_validate_customdata (CustomData *data, eCustomDataMask mask, const uint totitems, const bool do_verbose, const bool do_fixes, bool *r_change) |
| bool | BKE_mesh_validate_all_customdata (CustomData *vert_data, const uint verts_num, CustomData *edge_data, const uint edges_num, CustomData *corner_data, const uint corners_num, CustomData *face_data, const uint faces_num, const bool check_meshmask, const bool do_verbose, const bool do_fixes, bool *r_change) |
| bool | BKE_mesh_validate (Mesh *mesh, const bool do_verbose, const bool cddata_check_mask) |
| bool | BKE_mesh_is_valid (Mesh *mesh) |
| bool | BKE_mesh_validate_material_indices (Mesh *mesh) |
| #define CHECK_FACE_EDGE | ( | a, | |
| b ) |
Referenced by BKE_mesh_validate_arrays().
| #define CHECK_FACE_VERT_INDEX | ( | a, | |
| b ) |
Referenced by BKE_mesh_validate_arrays().
| #define INVALID_CORNER_EDGE_MARKER 4294967295u |
Definition at line 41 of file mesh_validate.cc.
Referenced by mesh_strip_edges(), and strip_loose_faces_corners().
| #define IS_REMOVED_EDGE | ( | _me | ) |
Referenced by BKE_mesh_validate_arrays().
| #define PRINT_ERR | ( | ... | ) |
Definition at line 154 of file mesh_validate.cc.
Referenced by BKE_mesh_validate_all_customdata(), BKE_mesh_validate_arrays(), and mesh_validate_customdata().
| #define PRINT_MSG | ( | ... | ) |
Definition at line 148 of file mesh_validate.cc.
Referenced by BKE_mesh_validate_arrays(), and mesh_validate_customdata().
| #define REMOVE_CORNER_TAG | ( | corner | ) |
Referenced by BKE_mesh_validate_arrays().
| #define REMOVE_EDGE_TAG | ( | _me | ) |
Referenced by BKE_mesh_validate_arrays().
| #define REMOVE_FACE_TAG | ( | _mf | ) |
Referenced by BKE_mesh_validate_arrays().
| using blender::float3 |
Definition at line 619 of file BLI_math_vector_types.hh.
| bool BKE_mesh_is_valid | ( | Mesh * | mesh | ) |
Checks if a Mesh is valid without any modification. This is always verbose.
Definition at line 1078 of file mesh_validate.cc.
References BKE_mesh_validate_all_customdata(), BKE_mesh_validate_arrays(), BLI_assert, CD_MDEFORMVERT, CD_MFACE, CustomData_get_layer_for_write(), blender::MutableSpan< T >::data(), blender::Span< T >::data(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Referenced by blender::bke::mesh_calc_edges(), and blender::geometry::mesh_triangulate().
| bool BKE_mesh_validate | ( | Mesh * | mesh, |
| bool | do_verbose, | ||
| bool | cddata_check_mask ) |
Validates and corrects a Mesh.
Definition at line 1023 of file mesh_validate.cc.
References BKE_mesh_runtime_clear_cache(), BKE_mesh_validate_all_customdata(), BKE_mesh_validate_arrays(), CD_MDEFORMVERT, CD_MFACE, CLOG_INFO, CustomData_get_layer_for_write(), blender::MutableSpan< T >::data(), blender::Span< T >::data(), DEG_id_tag_update(), ID_RECALC_GEOMETRY_ALL_MODES, LOG, blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Referenced by blender::io::ply::convert_ply_to_mesh(), blender::io::obj::MeshFromGeometry::create_mesh(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), blender::io::fbx::import_meshes(), blender::io::alembic::read_mpolys(), blender::io::stl::read_stl_file(), blender::io::alembic::AbcMeshReader::readObjectData(), and blender::io::alembic::AbcSubDReader::readObjectData().
| bool BKE_mesh_validate_all_customdata | ( | CustomData * | vert_data, |
| uint | verts_num, | ||
| CustomData * | edge_data, | ||
| uint | edges_num, | ||
| CustomData * | corner_data, | ||
| uint | corners_num, | ||
| CustomData * | face_data, | ||
| uint | faces_num, | ||
| bool | check_meshmask, | ||
| bool | do_verbose, | ||
| bool | do_fixes, | ||
| bool * | r_change ) |
Definition at line 970 of file mesh_validate.cc.
References CD_MASK_MESH, CD_PROP_FLOAT2, CustomData_get_clone_layer(), CustomData_get_stencil_layer(), CustomData_number_of_layers(), CustomData_set_layer_clone(), CustomData_set_layer_stencil(), mask(), MAX_MTFACE, mesh_validate_customdata(), and PRINT_ERR.
Referenced by BKE_mesh_is_valid(), BKE_mesh_runtime_is_valid(), and BKE_mesh_validate().
| bool BKE_mesh_validate_arrays | ( | Mesh * | mesh, |
| float(*) | vert_positions[3], | ||
| unsigned int | verts_num, | ||
| blender::int2 * | edges, | ||
| unsigned int | edges_num, | ||
| MFace * | legacy_faces, | ||
| unsigned int | legacy_faces_num, | ||
| const int * | corner_verts, | ||
| int * | corner_edges, | ||
| unsigned int | corners_num, | ||
| const int * | face_offsets, | ||
| unsigned int | faces_num, | ||
| MDeformVert * | dverts, | ||
| bool | do_verbose, | ||
| bool | do_fixes, | ||
| bool * | r_change ) |
Validate the mesh, do_fixes requires mesh to be non-null.
Definition at line 163 of file mesh_validate.cc.
References Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), b, Array< T, InlineBufferCapacity, Allocator >::begin(), BKE_defvert_remove_group(), BKE_mesh_strip_loose_faces(), BLI_assert, CHECK_FACE_EDGE, CHECK_FACE_VERT_INDEX, CLAMP, BitVector< InlineBufferCapacity, Allocator >::clear_and_shrink(), Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::contains(), SortFace::corner_start, Array< T, InlineBufferCapacity, Allocator >::data(), MDeformWeight::def_nr, MDeformVert::dw, edge_store_from_mface_quad(), edge_store_from_mface_tri(), Array< T, InlineBufferCapacity, Allocator >::end(), SortFaceLegacy::es, faces, blender::bke::AttributeWriter< T >::finish(), i, MSelect::index, SortFace::index, SortFaceLegacy::index, SortFace::invalid, IS_REMOVED_EDGE, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), ME_ESEL, ME_FSEL, ME_VSEL, MEM_freeN(), blender::bke::mesh_calc_edges(), mesh_strip_edges(), SortFace::numverts, blender::parallel_sort(), PRINT_ERR, PRINT_MSG, REMOVE_CORNER_TAG, REMOVE_EDGE_TAG, REMOVE_FACE_TAG, Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::reserve(), search_face_cmp(), search_face_corner_cmp(), search_legacy_face_cmp(), Array< T, InlineBufferCapacity, Allocator >::size(), strip_loose_faces_corners(), MSelect::type, v, MFace::v1, MFace::v2, v2, MFace::v3, MFace::v4, blender::bke::AttributeWriter< T >::varray, SortFace::verts, verts, MDeformWeight::weight, and zero_v3().
Referenced by BKE_mesh_is_valid(), BKE_mesh_runtime_is_valid(), BKE_mesh_validate(), and blo_do_versions_290().
| bool BKE_mesh_validate_material_indices | ( | Mesh * | mesh | ) |
Check all material indices of faces are valid, invalid ones are set to 0.
Definition at line 1131 of file mesh_validate.cc.
References DEG_id_tag_update(), blender::bke::AttributeWriter< T >::finish(), i, ID_RECALC_GEOMETRY_ALL_MODES, max_ii(), and blender::bke::AttributeWriter< T >::varray.
|
static |
Definition at line 72 of file mesh_validate.cc.
Referenced by edge_store_from_mface_quad(), and edge_store_from_mface_tri().
Definition at line 84 of file mesh_validate.cc.
References edge_store_assign(), MFace::v1, MFace::v2, MFace::v3, MFace::v4, and verts.
Referenced by BKE_mesh_validate_arrays().
Definition at line 92 of file mesh_validate.cc.
References edge_store_assign(), UINT_MAX, MFace::v1, MFace::v2, MFace::v3, EdgeUUID::verts, and verts.
Referenced by BKE_mesh_validate_arrays().
| void mesh_strip_edges | ( | Mesh * | mesh | ) |
Definition at line 1240 of file mesh_validate.cc.
References b, CustomData_copy_data(), CustomData_ensure_layers_are_mutable(), CustomData_free_elem(), blender::MutableSpan< T >::data(), e, i, blender::MutableSpan< T >::index_range(), INVALID_CORNER_EDGE_MARKER, MEM_freeN(), and MEM_malloc_arrayN().
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 870 of file mesh_validate.cc.
References CustomDataLayer::active, CustomDataLayer::active_clone, CustomDataLayer::active_mask, CustomDataLayer::active_rnd, ARRAY_SIZE, BLI_assert, CD_TYPE_AS_MASK(), CustomData_free_layer(), CustomData_layer_validate(), CustomData_layertype_is_singleton(), CustomData_number_of_layers(), data, i, mask(), PRINT_ERR, PRINT_MSG, and CustomDataLayer::type.
Referenced by BKE_mesh_validate_all_customdata().
Definition at line 114 of file mesh_validate.cc.
References SortFace::invalid, SortFace::numverts, and SortFace::verts.
Referenced by BKE_mesh_validate_arrays().
Definition at line 132 of file mesh_validate.cc.
References SortFace::corner_start, and SortFace::invalid.
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 100 of file mesh_validate.cc.
References EdgeUUID::edval, and SortFaceLegacy::es.
Referenced by BKE_mesh_validate_arrays().
| void strip_loose_faces_corners | ( | Mesh * | mesh, |
| blender::BitSpan | faces_to_remove ) |
Definition at line 1162 of file mesh_validate.cc.
References b, BLI_assert, blender::MutableSpan< T >::contains(), CustomData_copy_data(), CustomData_ensure_layers_are_mutable(), CustomData_free_elem(), i, INVALID_CORNER_EDGE_MARKER, MEM_freeN(), MEM_malloc_arrayN(), size(), and blender::MutableSpan< T >::slice().
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 43 of file mesh_validate.cc.