Blender V4.3
DNA_meshdata_types.h File Reference
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  MSelect
 
struct  MFloatProperty
 
struct  MIntProperty
 
struct  MStringProperty
 
struct  MBoolProperty
 
struct  MInt8Property
 
struct  MDeformWeight
 
struct  MDeformVert
 
struct  MVertSkin
 
struct  MLoopCol
 
struct  MPropCol
 
struct  MDisps
 
struct  GridPaintMask
 
struct  OrigSpaceFace
 
struct  OrigSpaceLoop
 
struct  FreestyleEdge
 
struct  FreestyleFace
 
struct  MFace
 
struct  MTFace
 
struct  MCol
 

Typedefs

Custom Data (Generic)

#Mesh::corner_tris() gives access to runtime triangulation data for Mesh, for functionality that doesn't support ngons.

Typical usage includes:

  • Viewport drawing.
  • BVHTree creation.
  • Physics/collision detection.

A mesh's triangulation data, which uses a cache that is lazily calculated from faces, corner vert, and position arrays. In rare cases it is calculated directly too, with #bke::mesh::corner_tris_calc. When the underlying mesh data changes, the array is recalculated from scratch; there is no extra attempt to maintain the validity over time.

Triangles are stored in an array, where triangles from each face are stored sequentially. The triangles order is guaranteed to match the face order where the first triangle will always be from the first face, and the last triangle from the last face. The number of triangles for each polygon is guaranteed to be the corner count - 2, even for degenerate geometry (see #bke::mesh::face_triangles_num).

Storing corner indices (instead of vertex indices) gives more flexibility for accessing mesh data stored per-corner, though it does often add an extra level of indirection. The index of the corresponding face for each triangle is stored in a separate array, accessed with #Mesh::corner_tri_faces().

Examples:

// Access vertex locations.
std::array<float3, 3> tri_positions{
positions[corner_verts[tri[0]]],
positions[corner_verts[tri[1]]],
positions[corner_verts[tri[2]]],
};
// Access UV coordinates (works for all face corner data, vertex colors... etc).
std::array<float2, 3> tri_uvs{
uv_map[tri[0]],
uv_map[tri[1]],
uv_map[tri[2]],
};
// Access all triangles in a given face.
const Span<int3> corner_tris = corner_tris.slice(face_triangles_range(faces, i));
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
Definition BKE_mesh.hh:296

It may also be useful to check whether or not two vertices of a triangle form an edge in the underlying mesh. See #bke::mesh::corner_tri for a utility that does this. Note that a triangle may be in the middle of an ngon and not reference any real edges.

typedef struct MFloatProperty MFloatProperty
 
typedef struct MIntProperty MIntProperty
 
typedef struct MStringProperty MStringProperty
 
typedef struct MBoolProperty MBoolProperty
 
typedef struct MInt8Property MInt8Property
 
Custom Data (Loop)
typedef struct MLoopCol MLoopCol
 
typedef struct MPropCol MPropCol
 
typedef struct MDisps MDisps
 
typedef struct GridPaintMask GridPaintMask
 
Custom Data (Original Space for Poly, Face)
typedef struct OrigSpaceFace OrigSpaceFace
 
typedef struct OrigSpaceLoop OrigSpaceLoop
 

Ordered Selection Storage

enum  { ME_VSEL = 0 , ME_ESEL = 1 , ME_FSEL = 2 }
 
typedef struct MSelect MSelect
 

Custom Data (Vertex)

enum  eMVertSkinFlag { MVERT_SKIN_ROOT = 1 , MVERT_SKIN_LOOSE = 2 }
 
typedef struct MDeformWeight MDeformWeight
 
typedef struct MDeformVert MDeformVert
 
typedef struct MVertSkin MVertSkin
 
typedef enum eMVertSkinFlag eMVertSkinFlag
 

Custom Data (FreeStyle for Edge, Face)

enum  { FREESTYLE_EDGE_MARK = 1 }
 
enum  { FREESTYLE_FACE_MARK = 1 }
 
typedef struct FreestyleEdge FreestyleEdge
 
typedef struct FreestyleFace FreestyleFace
 

Deprecated Structs

enum  {
  ME_V1V2 = (1 << 0) , ME_V2V3 = (1 << 1) , ME_V3V1 = (1 << 2) , ME_V3V4 = ME_V3V1 ,
  ME_V4V1 = (1 << 3)
}
 
typedef struct MFace MFace
 
typedef struct MTFace MTFace
 
typedef struct MCol MCol
 

Typedef Documentation

◆ eMVertSkinFlag

◆ FreestyleEdge

typedef struct FreestyleEdge FreestyleEdge

◆ FreestyleFace

typedef struct FreestyleFace FreestyleFace

◆ GridPaintMask

typedef struct GridPaintMask GridPaintMask

Multi-Resolution grid loop data.

◆ MBoolProperty

typedef struct MBoolProperty MBoolProperty

◆ MCol

typedef struct MCol MCol

Tessellation vertex color data.

Note
The red and blue are swapped for historical reasons.

◆ MDeformVert

typedef struct MDeformVert MDeformVert

Stores all of an element's vertex groups, and their weight values.

◆ MDeformWeight

typedef struct MDeformWeight MDeformWeight

Vertex group index and weight for MDeformVert.dw

◆ MDisps

typedef struct MDisps MDisps

Multi-Resolution loop data.

◆ MFace

typedef struct MFace MFace

Used in Blender pre 2.63, See #Mesh::corner_verts(), #Mesh::faces() for face data stored in the blend file. Use for reading old files and in a handful of cases which should be removed eventually.

◆ MFloatProperty

typedef struct MFloatProperty MFloatProperty

Custom Data Properties

◆ MInt8Property

typedef struct MInt8Property MInt8Property

◆ MIntProperty

typedef struct MIntProperty MIntProperty

◆ MLoopCol

typedef struct MLoopCol MLoopCol
Note
While alpha is not currently in the 3D Viewport, this may eventually be added back, keep this value set to 255.

◆ MPropCol

typedef struct MPropCol MPropCol

◆ MSelect

typedef struct MSelect MSelect

Optionally store the order of selected elements. This won't always be set since only some selection operations have an order.

Typically accessed from Mesh.mselect

◆ MStringProperty

typedef struct MStringProperty MStringProperty

Byte string, no encoding implied. May not be null terminated.

◆ MTFace

typedef struct MTFace MTFace

Tessellation uv face data.

◆ MVertSkin

typedef struct MVertSkin MVertSkin

◆ OrigSpaceFace

typedef struct OrigSpaceFace OrigSpaceFace

Original space within a face (similar to UV coordinates), however they are used to determine the original position in a face.

Unlike UVs these are not user editable and always start out using a fixed 0-1 range. Currently only used for particle placement.

◆ OrigSpaceLoop

typedef struct OrigSpaceLoop OrigSpaceLoop

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

MSelect.type

Enumerator
ME_VSEL 
ME_ESEL 
ME_FSEL 

Definition at line 31 of file DNA_meshdata_types.h.

◆ anonymous enum

anonymous enum

FreestyleEdge.flag

Enumerator
FREESTYLE_EDGE_MARK 

Definition at line 264 of file DNA_meshdata_types.h.

◆ anonymous enum

anonymous enum

FreestyleFace.flag

Enumerator
FREESTYLE_FACE_MARK 

Definition at line 273 of file DNA_meshdata_types.h.

◆ anonymous enum

anonymous enum

MFace.edcode

Enumerator
ME_V1V2 
ME_V2V3 
ME_V3V1 
ME_V3V4 
ME_V4V1 

Definition at line 410 of file DNA_meshdata_types.h.

◆ eMVertSkinFlag

Enumerator
MVERT_SKIN_ROOT 

Marks a vertex as the edge-graph root, used for calculating rotations for all connected edges (recursively). Also used to choose a root when generating an armature.

MVERT_SKIN_LOOSE 

Marks a branch vertex (vertex with more than two connected edges), so that its neighbors are directly hulled together, rather than the default of generating intermediate frames.

Definition at line 166 of file DNA_meshdata_types.h.