Blender  V2.93
DNA_mesh_types.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_ID.h"
27 #include "DNA_customdata_types.h"
28 #include "DNA_defs.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct AnimData;
35 struct BVHCache;
36 struct Ipo;
37 struct Key;
38 struct MCol;
39 struct MEdge;
40 struct MFace;
41 struct MLoop;
42 struct MLoopCol;
43 struct MLoopTri;
44 struct MLoopUV;
45 struct MPoly;
46 struct MVert;
47 struct Material;
48 struct Mesh;
49 struct SubdivCCG;
50 
51 #
52 #
53 typedef struct EditMeshData {
55  const float (*vertexCos)[3];
56 
58  float const (*vertexNos)[3];
59  float const (*polyNos)[3];
61  const float (*polyCos)[3];
63 
69  /* WARNING! swapping between array (ready-to-be-used data) and array_wip
70  * (where data is actually computed)
71  * shall always be protected by same lock as one used for looptris computing. */
73  int len;
74  int len_alloc;
75 };
76 
77 /* not saved in file! */
78 typedef struct Mesh_Runtime {
79  /* Evaluated mesh for objects which do not have effective modifiers.
80  * This mesh is used as a result of modifier stack evaluation.
81  * Since modifier stack evaluation is threaded on object level we need some synchronization. */
82  struct Mesh *mesh_eval;
83  void *eval_mutex;
84 
86  void *batch_cache;
87 
89  void *_pad1;
91  char _pad2[4];
92 
97 
98  struct MLoopTri_Store looptris;
99 
102 
105 
116 
124 
125  char _pad[4];
126 
129 
131 
132 typedef struct Mesh {
135  struct AnimData *adt;
136 
138  struct Ipo *ipo DNA_DEPRECATED;
139  struct Key *key;
140  struct Material **mat;
141  struct MSelect *mselect;
142 
143  /* BMESH ONLY */
144  /*new face structures*/
145  struct MPoly *mpoly;
146  struct MLoop *mloop;
147  struct MLoopUV *mloopuv;
149  /* END BMESH ONLY */
150 
158  struct MFace *mface;
160  struct MTFace *mtface;
162  struct TFace *tface DNA_DEPRECATED;
164  struct MVert *mvert;
166  struct MEdge *medge;
169 
170  /* array of colors for the tessellated faces, must be number of tessellated
171  * faces * 4 in length */
172  struct MCol *mcol;
173  struct Mesh *texcomesh;
174 
175  /* When the object is available, the preferred access method is: BKE_editmesh_from_object(ob) */
178 
179  struct CustomData vdata, edata, fdata;
180 
181  /* BMESH ONLY */
182  struct CustomData pdata, ldata;
183  /* END BMESH ONLY */
184 
186 
187  /* BMESH ONLY */
189  /* END BMESH ONLY */
190 
192  int _pad3;
193 
194  /* the last selected vertex/edge/face are used for the active face however
195  * this means the active face must always be selected, this is to keep track
196  * of the last selected face and is similar to the old active face flag where
197  * the face does not need to be selected, -1 is inactive */
198  int act_face;
199 
200  /* texture space, copied as one block in editobject.c */
201  float loc[3];
202  float size[3];
203 
204  short texflag, flag;
205  float smoothresh;
206 
207  /* customdata flag, for bevel-weight and crease, which are now optional */
208  char cd_flag, _pad;
209 
210  char subdiv DNA_DEPRECATED, subdivr DNA_DEPRECATED;
212  char subsurftype DNA_DEPRECATED;
213  char editflag;
214 
215  short totcol;
216 
220 
221  /* Indicates the symmetry that a mesh has, according to the artist, so that tools can
222  * consistently ensure that this symmetry is maintained. */
223  char symmetry;
224 
225  char _pad1[2];
226 
228  /* Stores the initial Face Set to be rendered white. This way the overlay can be enabled by
229  * default and Face Sets can be used without affecting the color of the mesh. */
231 
232  void *_pad2;
235 
236 /* deprecated by MTFace, only here for file reading */
237 #ifdef DNA_DEPRECATED_ALLOW
238 typedef struct TFace {
240  void *tpage;
241  float uv[4][2];
242  unsigned int col[4];
243  char flag, transp;
244  short mode, tile, unwrap;
245 } TFace;
246 #endif
247 
248 /* **************** MESH ********************* */
249 
251 typedef enum eMeshWrapperType {
256  /* ME_WRAPPER_TYPE_SUBD = 2, */ /* TODO */
258 
259 /* texflag */
260 enum {
263 };
264 
265 /* me->editflag */
266 enum {
268  ME_EDIT_MIRROR_Y = 1 << 1, /* unused so far */
269  ME_EDIT_MIRROR_Z = 1 << 2, /* unused so far */
270 
274 };
275 
276 /* Helper macro to see if vertex group X mirror is on. */
277 #define ME_USING_MIRROR_X_VERTEX_GROUPS(_me) \
278  (((_me)->editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) && ((_me)->symmetry & ME_SYMMETRY_X))
279 
280 /* We cant have both flags enabled at once,
281  * flags defined in DNA_scene_types.h */
282 #define ME_EDIT_PAINT_SEL_MODE(_me) \
283  (((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? \
284  SCE_SELECT_FACE : \
285  ((_me)->editflag & ME_EDIT_PAINT_VERT_SEL) ? SCE_SELECT_VERTEX : 0)
286 
287 /* me->flag */
288 enum {
289  ME_FLAG_UNUSED_0 = 1 << 0, /* cleared */
290  ME_FLAG_UNUSED_1 = 1 << 1, /* cleared */
291  ME_FLAG_DEPRECATED_2 = 1 << 2, /* deprecated */
292  ME_FLAG_UNUSED_3 = 1 << 3, /* cleared */
293  ME_FLAG_UNUSED_4 = 1 << 4, /* cleared */
294  ME_AUTOSMOOTH = 1 << 5,
295  ME_FLAG_UNUSED_6 = 1 << 6, /* cleared */
296  ME_FLAG_UNUSED_7 = 1 << 7, /* cleared */
298  ME_DS_EXPAND = 1 << 9,
305 };
306 
307 /* me->cd_flag */
308 enum {
312 };
313 
314 /* me->remesh_mode */
315 enum {
318 };
319 
320 /* Subsurf Type */
321 enum {
324 };
325 
326 /* me->symmetry */
327 typedef enum eMeshSymmetryType {
328  ME_SYMMETRY_X = 1 << 0,
329  ME_SYMMETRY_Y = 1 << 1,
330  ME_SYMMETRY_Z = 1 << 2,
332 
333 #define MESH_MAX_VERTS 2000000000L
334 
335 #ifdef __cplusplus
336 }
337 #endif
typedef float(TangentPoint)[2]
ID and Library types, which are fundamental for sdna.
eMeshWrapperType
@ ME_WRAPPER_TYPE_MDATA
@ ME_WRAPPER_TYPE_BMESH
@ REMESH_QUAD
@ REMESH_VOXEL
@ ME_CC_SUBSURF
@ ME_SIMPLE_SUBSURF
struct Mesh Mesh
@ ME_CDFLAG_EDGE_CREASE
@ ME_CDFLAG_VERT_BWEIGHT
@ ME_CDFLAG_EDGE_BWEIGHT
@ ME_FLAG_UNUSED_6
@ ME_REMESH_REPROJECT_VOLUME
@ ME_FLAG_UNUSED_4
@ ME_REMESH_REPROJECT_VERTEX_COLORS
@ ME_FLAG_UNUSED_3
@ ME_DS_EXPAND
@ ME_FLAG_UNUSED_7
@ ME_REMESH_REPROJECT_SCULPT_FACE_SETS
@ ME_FLAG_UNUSED_1
@ ME_AUTOSMOOTH
@ ME_REMESH_FIX_POLES
@ ME_FLAG_DEPRECATED_2
@ ME_REMESH_SMOOTH_NORMALS
@ ME_SCULPT_DYNAMIC_TOPOLOGY
@ ME_REMESH_REPROJECT_PAINT_MASK
@ ME_FLAG_UNUSED_0
eMeshSymmetryType
@ ME_SYMMETRY_X
@ ME_SYMMETRY_Y
@ ME_SYMMETRY_Z
@ 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_AUTOSPACE_EVALUATED
@ ME_AUTOSPACE
struct EditMeshData EditMeshData
struct Mesh_Runtime Mesh_Runtime
uint col
static Context * unwrap(GPUContext *ctx)
__int64 int64_t
Definition: stdint.h:92
const float(* polyCos)[3]
const float(* vertexCos)[3]
Definition: DNA_ID.h:273
struct MLoopTri * array
struct MLoopTri * array_wip
int64_t cd_dirty_poly
struct Mesh * mesh_eval
struct EditMeshData * edit_data
int64_t cd_dirty_edge
struct BVHCache * bvh_cache
CustomData_MeshMasks cd_mask_extra
void * batch_cache
struct SubdivCCG * subdiv_ccg
char wrapper_type_finalize
int64_t cd_dirty_loop
int64_t cd_dirty_vert
struct MLoopTri_Store looptris
struct ShrinkwrapBoundaryData * shrinkwrap_data
int subdiv_ccg_tot_level
void * eval_mutex
int _pad3
struct MEdge * medge
struct BMEditMesh * edit_mesh
float remesh_voxel_adaptivity
float smoothresh
struct Mesh * texcomesh
char subdiv DNA_DEPRECATED
struct MTFace * mtface
struct CustomData pdata ldata
char symmetry
struct TFace *tface DNA_DEPRECATED
struct MVert * mvert
struct MLoopCol * mloopcol
struct Ipo *ipo DNA_DEPRECATED
float size[3]
struct AnimData * adt
struct Material ** mat
struct MDeformVert * dvert
float remesh_voxel_size
char _pad
int totedge
void * _pad2
struct MLoopUV * mloopuv
int act_face
char cd_flag
char _pad1[2]
char editflag
int totvert
short flag
struct MLoop * mloop
int totface
Mesh_Runtime runtime
struct CustomData vdata edata fdata
short texflag
int totpoly
short totcol
int face_sets_color_seed
struct MCol * mcol
int attributes_active_index
int face_sets_color_default
int totloop
struct Key * key
int totselect
char remesh_mode
struct MFace * mface
struct MPoly * mpoly
char subsurftype DNA_DEPRECATED
float loc[3]
struct MSelect * mselect