Blender V5.0
DNA_mesh_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_attribute_types.h"
14#include "DNA_defs.h"
16
18#ifdef __cplusplus
19
20# include <optional>
21
24# include "BLI_vector_set.hh"
25
26namespace blender {
27template<typename T> struct Bounds;
28namespace offset_indices {
29template<typename T> struct GroupedSpan;
30template<typename T> class OffsetIndices;
31} // namespace offset_indices
34template<typename T> class MutableSpan;
35template<typename T> class Span;
36namespace bke {
37struct BVHTreeFromMesh;
38struct MeshRuntime;
41struct LooseVertCache;
42struct LooseEdgeCache;
43enum class MeshNormalDomain : int8_t;
44} // namespace bke
45} // namespace blender
47#else
49#endif
50
51struct AnimData;
52struct Key;
53struct MCol;
54struct MEdge;
55struct MFace;
56struct Material;
57
58typedef struct Mesh {
59#ifdef __cplusplus
62 static constexpr ID_Type id_type = ID_ME;
63#endif
64
67 struct AnimData *adt;
68
69 struct Key *key;
70
76 struct Material **mat;
77
86
94
100
105
113
121
130
133
144
151
156
160 uint16_t flag;
161
162 float smoothresh_legacy DNA_DEPRECATED;
163
167
169 /* Stores the initial Face Set to be rendered white. This way the overlay can be enabled by
170 * default and Face Sets can be used without affecting the color of the mesh. */
172
177
188
194
197
199 short totcol;
200
206 char cd_flag DNA_DEPRECATED;
207 char subdiv DNA_DEPRECATED;
208 char subdivr DNA_DEPRECATED;
209 char subsurftype DNA_DEPRECATED;
210
212 struct MPoly *mpoly DNA_DEPRECATED;
214 struct MLoop *mloop DNA_DEPRECATED;
215
217 struct MVert *mvert DNA_DEPRECATED;
219 struct MEdge *medge DNA_DEPRECATED;
223 struct MTFace *mtface DNA_DEPRECATED;
225 struct TFace *tface DNA_DEPRECATED;
227 struct MCol *mcol DNA_DEPRECATED;
229 struct MFace *mface DNA_DEPRECATED;
230
238 /* Deprecated size of #fdata. */
240
241 char _pad1;
243
251#ifdef __cplusplus
255 blender::Span<blender::float3> vert_positions() const;
257 blender::MutableSpan<blender::float3> vert_positions_for_write();
264 blender::Span<blender::int2> edges() const;
266 blender::MutableSpan<blender::int2> edges_for_write();
278 blender::Span<int> face_offsets() const;
280 blender::MutableSpan<int> face_offsets_for_write();
281
291 blender::Span<int> corner_verts() const;
293 blender::MutableSpan<int> corner_verts_for_write();
294
300 blender::Span<int> corner_edges() const;
302 blender::MutableSpan<int> corner_edges_for_write();
303
305 blender::bke::MutableAttributeAccessor attributes_for_write();
306
313 blender::MutableSpan<MDeformVert> deform_verts_for_write();
314
318 blender::Span<blender::int3> corner_tris() const;
319
323 blender::Span<int> corner_tri_faces() const;
324
328 std::optional<blender::Bounds<blender::float3>> bounds_min_max() const;
329
331 void bounds_set_eager(const blender::Bounds<blender::float3> &bounds);
332
334 std::optional<int> material_index_max() const;
335
337 const blender::VectorSet<int> &material_indices_used() const;
338
342 blender::Span<int> corner_to_face_map() const;
346 blender::OffsetIndices<int> vert_to_face_map_offsets() const;
350 blender::GroupedSpan<int> vert_to_corner_map() const;
354 blender::GroupedSpan<int> vert_to_face_map() const;
355
359 const blender::bke::LooseEdgeCache &loose_edges() const;
363 const blender::bke::LooseVertCache &loose_verts() const;
367 const blender::bke::LooseVertCache &verts_no_face() const;
376 bool no_overlapping_topology() const;
377
385 void tag_loose_edges_none() const;
393 void tag_loose_verts_none() const;
395 void tag_overlapping_none();
396
410 blender::bke::MeshNormalDomain normals_domain(const bool support_sharp_face = false) const;
414 blender::Span<blender::float3> face_normals() const;
415 blender::Span<blender::float3> face_normals_true() const;
420 blender::Span<blender::float3> vert_normals() const;
421 blender::Span<blender::float3> vert_normals_true() const;
431 blender::Span<blender::float3> corner_normals() const;
432
433 blender::bke::BVHTreeFromMesh bvh_verts() const;
434 blender::bke::BVHTreeFromMesh bvh_edges() const;
435 blender::bke::BVHTreeFromMesh bvh_legacy_faces() const;
436 blender::bke::BVHTreeFromMesh bvh_corner_tris() const;
437 blender::bke::BVHTreeFromMesh bvh_corner_tris_no_hidden() const;
438 blender::bke::BVHTreeFromMesh bvh_loose_verts() const;
439 blender::bke::BVHTreeFromMesh bvh_loose_edges() const;
440 blender::bke::BVHTreeFromMesh bvh_loose_no_hidden_verts() const;
441 blender::bke::BVHTreeFromMesh bvh_loose_no_hidden_edges() const;
442
443 void count_memory(blender::MemoryCounter &memory) const;
444
446 void tag_positions_changed();
448 void tag_positions_changed_uniformly();
450 void tag_positions_changed_no_normals();
452 void tag_sharpness_changed();
454 void tag_custom_normals_changed();
456 void tag_face_winding_changed();
458 void tag_edges_split();
460 void tag_topology_changed();
462 void tag_visibility_changed();
464 void tag_material_index_changed();
465#endif
467
468/* deprecated by MTFace, only here for file reading */
469#ifdef DNA_DEPRECATED_ALLOW
470typedef struct TFace {
472
473
474 void *tpage;
475 float uv[4][2];
476 unsigned int col[4];
477 char flag, transp;
478 short mode, tile, unwrap;
479} TFace;
480#endif
481
482/* **************** MESH ********************* */
483
485enum {
488};
489
491enum {
493 ME_EDIT_MIRROR_Y = 1 << 1, /* unused so far */
494 ME_EDIT_MIRROR_Z = 1 << 2, /* unused so far */
495
499};
500
501/* Helper macro to see if vertex group X mirror is on. */
502#define ME_USING_MIRROR_X_VERTEX_GROUPS(_me) \
503 (((_me)->editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) && ((_me)->symmetry & ME_SYMMETRY_X))
504
505/* We can't have both flags enabled at once,
506 * flags defined in DNA_scene_types.h */
507#define ME_EDIT_PAINT_SEL_MODE(_me) \
508 (((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? SCE_SELECT_FACE : \
509 ((_me)->editflag & ME_EDIT_PAINT_VERT_SEL) ? SCE_SELECT_VERTEX : \
510 0)
511
513enum {
514 ME_FLAG_UNUSED_0 = 1 << 0, /* cleared */
515 ME_FLAG_UNUSED_1 = 1 << 1, /* cleared */
516 ME_FLAG_DEPRECATED_2 = 1 << 2, /* deprecated */
522 ME_FLAG_UNUSED_4 = 1 << 4, /* cleared */
523 ME_AUTOSMOOTH_LEGACY = 1 << 5, /* deprecated */
524 ME_FLAG_UNUSED_6 = 1 << 6, /* cleared */
525 ME_FLAG_UNUSED_7 = 1 << 7, /* cleared */
527 ME_DS_EXPAND = 1 << 9,
535 ME_FLAG_UNUSED_8 = 1 << 12, /* deprecated */
538 ME_FLAG_UNUSED_9 = 1 << 15, /* deprecated */
539};
540
541#ifdef DNA_DEPRECATED_ALLOW
543enum {
544 ME_CDFLAG_VERT_BWEIGHT = 1 << 0,
545 ME_CDFLAG_EDGE_BWEIGHT = 1 << 1,
546 ME_CDFLAG_EDGE_CREASE = 1 << 2,
547 ME_CDFLAG_VERT_CREASE = 1 << 3,
548};
549#endif
550
552enum {
555};
556
562
569
570#define MESH_MAX_VERTS 2000000000L
ID and Library types, which are fundamental for SDNA.
ID_Type
@ ID_ME
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:66
@ ME_EDIT_MIRROR_VERTEX_GROUPS
@ ME_EDIT_PAINT_VERT_SEL
@ ME_EDIT_PAINT_FACE_SEL
@ ME_EDIT_MIRROR_Z
@ ME_EDIT_MIRROR_Y
@ ME_EDIT_MIRROR_TOPO
@ ME_TEXSPACE_FLAG_AUTO
@ ME_TEXSPACE_FLAG_AUTO_EVALUATED
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ ME_REMESH_REPROJECT_ATTRIBUTES
@ ME_FLAG_UNUSED_6
@ ME_REMESH_REPROJECT_VOLUME
@ ME_FLAG_UNUSED_9
@ ME_FLAG_UNUSED_4
@ ME_FLAG_UV_SELECT_SYNC_VALID
@ ME_DS_EXPAND
@ ME_FLAG_UNUSED_7
@ ME_FLAG_UNUSED_8
@ ME_FLAG_UNUSED_1
@ ME_REMESH_FIX_POLES
@ ME_FLAG_DEPRECATED_2
@ ME_AUTOSMOOTH_LEGACY
@ ME_SCULPT_DYNAMIC_TOPOLOGY
@ ME_FLAG_UNUSED_0
@ ME_NO_OVERLAPPING_TOPOLOGY
MeshSubdivType
@ ME_CC_SUBSURF
@ ME_SIMPLE_SUBSURF
@ REMESH_QUAD
@ REMESH_VOXEL
struct MeshRuntimeHandle MeshRuntimeHandle
static void deform_verts(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh, blender::MutableSpan< blender::float3 > positions)
BoundBox bounds
AttributeSet attributes
uint col
const ccl_global KernelWorkTile * tile
static char faces[256]
VKBatch * unwrap(Batch *batch)
Definition vk_batch.hh:31
Definition DNA_ID.h:414
float texspace_size[3]
float remesh_voxel_adaptivity
struct Mesh * texcomesh
int corners_num
CustomData edge_data
struct AttributeStorage attribute_storage
char symmetry
char texspace_flag
int edges_num
MeshRuntimeHandle * runtime
struct AnimData * adt
uint16_t flag
struct Material ** mat
char * active_uv_map_attribute
Mesh(const NodeType *node_type_, Type geom_type_)
CustomData corner_data
int8_t radial_symmetry[3]
float remesh_voxel_size
CustomData face_data
char _pad1
int act_face
char * default_color_attribute
ListBase vertex_group_names
int * face_offset_indices
char editflag
float smoothresh_legacy DNA_DEPRECATED
CustomData vert_data
short totcol
int face_sets_color_seed
int attributes_active_index
int vertex_group_active_index
int face_sets_color_default
struct Key * key
int totselect
CustomData fdata_legacy
char remesh_mode
int totface_legacy
char * default_uv_map_attribute
float texspace_location[3]
int faces_num
struct MSelect * mselect
int verts_num
char * active_color_attribute
uint8_t flag
Definition wm_window.cc:145