|
Blender V4.3
|
#include <algorithm>#include <climits>#include <cstdio>#include <cstring>#include "CLG_log.h"#include "DNA_mesh_types.h"#include "DNA_meshdata_types.h"#include "DNA_object_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 "BLI_vector_set.hh"#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) (_me[0] == _me[1]) |
| #define | REMOVE_CORNER_TAG(corner) |
| #define | REMOVE_FACE_TAG(_mf) |
| #define | CHECK_FACE_VERT_INDEX(a, b) |
| #define | CHECK_FACE_EDGE(a, b) |
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 = {"bke.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) |
Referenced by BKE_mesh_validate_arrays().
Referenced by BKE_mesh_validate_arrays().
| #define INVALID_CORNER_EDGE_MARKER 4294967295u |
Definition at line 44 of file mesh_validate.cc.
Referenced by mesh_strip_edges(), and strip_loose_faces_corners().
| #define IS_REMOVED_EDGE | ( | _me | ) | (_me[0] == _me[1]) |
Referenced by BKE_mesh_validate_arrays().
| #define PRINT_ERR | ( | ... | ) |
Definition at line 157 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 151 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().
| bool BKE_mesh_is_valid | ( | Mesh * | mesh | ) |
Checks if a Mesh is valid without any modification. This is always verbose.
Definition at line 1081 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(), is_valid, and blender::Span< T >::size().
| bool BKE_mesh_validate | ( | Mesh * | mesh, |
| bool | do_verbose, | ||
| bool | cddata_check_mask ) |
Validates and corrects a Mesh.
Definition at line 1026 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, and blender::Span< T >::size().
Referenced by blender::io::ply::convert_ply_to_mesh(), blender::io::obj::MeshFromGeometry::create_mesh(), MeshImporter::create_mesh_object(), Freestyle::BlenderStrokeRenderer::GenerateStrokeMesh(), 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 973 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(), is_valid, 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 166 of file mesh_validate.cc.
References b, blender::Array< T, InlineBufferCapacity, Allocator >::begin(), BKE_defvert_remove_group(), BKE_mesh_strip_loose_faces(), BLI_assert, CHECK_FACE_EDGE, CHECK_FACE_VERT_INDEX, CLAMP, SortFace::corner_start, blender::Array< T, InlineBufferCapacity, Allocator >::data(), MDeformWeight::def_nr, MDeformVert::dw, edge_store_from_mface_quad(), edge_store_from_mface_tri(), blender::Array< T, InlineBufferCapacity, Allocator >::end(), SortFaceLegacy::es, faces, blender::bke::AttributeWriter< T >::finish(), MSelect::index, SortFace::index, SortFaceLegacy::index, SortFace::invalid, IS_REMOVED_EDGE, is_valid, ME_ESEL, ME_FSEL, ME_VSEL, MEM_freeN(), mesh_strip_edges(), SortFace::numverts, blender::parallel_sort(), PRINT_ERR, PRINT_MSG, REMOVE_CORNER_TAG, REMOVE_EDGE_TAG, REMOVE_FACE_TAG, search_face_cmp(), search_face_corner_cmp(), search_legacy_face_cmp(), blender::Array< T, InlineBufferCapacity, Allocator >::size(), strip_loose_faces_corners(), MDeformVert::totweight, 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 1134 of file mesh_validate.cc.
References DEG_id_tag_update(), blender::bke::AttributeWriter< T >::finish(), ID_RECALC_GEOMETRY_ALL_MODES, is_valid, max_ii(), and blender::bke::AttributeWriter< T >::varray.
Definition at line 75 of file mesh_validate.cc.
Referenced by edge_store_from_mface_quad(), and edge_store_from_mface_tri().
Definition at line 87 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 95 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 1239 of file mesh_validate.cc.
References b, CustomData_copy_data(), CustomData_free_elem(), e, blender::MutableSpan< T >::index_range(), INVALID_CORNER_EDGE_MARKER, MEM_freeN(), and MEM_mallocN.
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 873 of file mesh_validate.cc.
References ARRAY_SIZE, BLI_assert, CD_TYPE_AS_MASK, CustomData_free_layer(), CustomData_layer_validate(), CustomData_layertype_is_singleton(), CustomData_number_of_layers(), is_valid, PRINT_ERR, and PRINT_MSG.
Referenced by BKE_mesh_validate_all_customdata().
Definition at line 117 of file mesh_validate.cc.
References SortFace::invalid, SortFace::numverts, and SortFace::verts.
Referenced by BKE_mesh_validate_arrays().
Definition at line 135 of file mesh_validate.cc.
References SortFace::corner_start, and SortFace::invalid.
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 103 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 1165 of file mesh_validate.cc.
References blender::MutableSpan< T >::as_span(), b, BLI_assert, CustomData_copy_data(), CustomData_free_elem(), INVALID_CORNER_EDGE_MARKER, MEM_freeN(), MEM_mallocN, size(), and blender::MutableSpan< T >::slice().
Referenced by BKE_mesh_validate_arrays().
|
static |
Definition at line 46 of file mesh_validate.cc.
Referenced by BKE_mesh_validate().