2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file DNA_meshdata_types.h
32 #ifndef __DNA_MESHDATA_TYPES_H__
33 #define __DNA_MESHDATA_TYPES_H__
35 #include "DNA_customdata_types.h"
36 #include "DNA_listBase.h"
41 /*tessellation face, see MLoop/MPoly for the real face data*/
42 typedef struct MFace {
43 unsigned int v1, v2, v3, v4;
45 char edcode, flag; /* we keep edcode, for conversion to edges draw flags in old files */
48 typedef struct MEdge {
54 typedef struct MDeformWeight {
59 typedef struct MDeformVert {
60 struct MDeformWeight *dw;
62 int flag; /* flag only in use for weightpaint now */
65 typedef struct MVert {
71 /* tessellation vertex color data.
72 * at the moment alpha is abused for vertex painting
73 * and not used for transparency, note that red and blue are swapped */
78 /* new face structure, replaces MFace, which is now
79 * only used for storing tessellations.*/
80 typedef struct MPoly {
81 /* offset into loop array and number of loops in the face */
83 int totloop; /* keep signed since we need to subtract when getting the previous loop */
88 /* the e here is because we want to move away from
89 * relying on edge hashes.*/
90 typedef struct MLoop {
91 unsigned int v; /*vertex index*/
92 unsigned int e; /*edge index*/
95 typedef struct MTexPoly {
98 short mode, tile, unwrap;
101 /* can copy from/to MTexPoly/MTFace */
102 #define ME_MTEXFACE_CPY(dst, src) \
104 (dst)->tpage = (src)->tpage; \
105 (dst)->flag = (src)->flag; \
106 (dst)->transp = (src)->transp; \
107 (dst)->mode = (src)->mode; \
108 (dst)->tile = (src)->tile; \
109 (dst)->unwrap = (src)->unwrap; \
112 typedef struct MLoopUV {
118 #define MLOOPUV_EDGESEL 1
119 #define MLOOPUV_VERTSEL 2
120 #define MLOOPUV_PINNED 4
122 /* at the moment alpha is abused for vertex painting
123 * and not used for transparency, note that red and blue are swapped */
124 typedef struct MLoopCol {
128 #define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \
130 MLoopCol *mloopcol__tmp = _mloopcol; \
131 const MCol *mcol__tmp = _mcol; \
132 mloopcol__tmp->r = mcol__tmp->b; \
133 mloopcol__tmp->g = mcol__tmp->g; \
134 mloopcol__tmp->b = mcol__tmp->r; \
135 mloopcol__tmp->a = mcol__tmp->a; \
139 #define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \
141 const MLoopCol *mloopcol__tmp = _mloopcol; \
142 MCol *mcol__tmp = _mcol; \
143 mcol__tmp->b = mloopcol__tmp->r; \
144 mcol__tmp->g = mloopcol__tmp->g; \
145 mcol__tmp->r = mloopcol__tmp->b; \
146 mcol__tmp->a = mloopcol__tmp->a; \
149 typedef struct MSticky {
153 typedef struct MSelect {
155 int type; /* EDITVERT/EDITEDGE/EDITFACE */
158 /*tessellation uv face data*/
159 typedef struct MTFace {
163 short mode, tile, unwrap;
166 /*Custom Data Properties*/
167 typedef struct MFloatProperty {
170 typedef struct MIntProperty {
173 typedef struct MStringProperty {
177 typedef struct OrigSpaceFace {
181 typedef struct OrigSpaceLoop {
185 typedef struct MDisps {
186 /* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
191 /* Used for hiding parts of a multires mesh. Essentially the multires
192 equivalent of MVert.flag's ME_HIDE bit.
194 This is a bitmap, keep in sync with type used in BLI_bitmap.h */
195 unsigned int *hidden;
198 /** Multires structs kept for compatibility with old files **/
199 typedef struct MultiresCol {
202 typedef struct MultiresColFace {
206 typedef struct MultiresFace {
209 char flag, mat_nr, pad[2];
211 typedef struct MultiresEdge {
216 struct MultiresMapNode;
217 typedef struct MultiresLevel {
218 struct MultiresLevel *next, *prev;
221 MultiresColFace *colfaces;
224 unsigned int totvert, totface, totedge, pad;
226 /* Kept for compatibility with even older files */
230 typedef struct Multires {
234 unsigned char level_count, current, newlvl, edgelvl, pinlvl, renderlvl;
235 unsigned char use_col, flag;
237 /* Special level 1 data that cannot be modified from other levels */
246 typedef struct MRecast {
250 typedef struct GridPaintMask {
251 /* The data array contains gridsize*gridsize elements */
254 /* The maximum multires level associated with this grid */
260 /* mvert->flag (1=SELECT) */
261 #define ME_SPHERETEST 2
262 #define ME_VERT_TMP_TAG 4
264 #define ME_VERT_MERGED (1<<6)
265 #define ME_VERT_PBVH_UPDATE (1<<7)
267 /* medge->flag (1=SELECT)*/
268 #define ME_EDGEDRAW (1<<1)
269 #define ME_SEAM (1<<2)
270 #define ME_FGON (1<<3) /* no longer used (now we have ngons), only defined so we can clear it */
271 /* reserve 16 for ME_HIDE */
272 #define ME_EDGERENDER (1<<5)
273 #define ME_LOOSEEDGE (1<<7)
274 /* #define ME_SEAM_LAST (1<<8) */ /* UNUSED */
275 #define ME_SHARP (1<<9) /* only reason this flag remains a 'short' */
277 /* puno = vertexnormal (mface) */
291 #define ME_FACE_SEL 2
292 /* flag ME_HIDE==16 is used here too */
294 #define ME_POLY_LOOP_PREV(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)])
295 #define ME_POLY_LOOP_NEXT(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + 1) % (mp)->totloop)])
303 #define TF_SELECT 1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */
304 #define TF_ACTIVE 2 /* deprecated! */
309 #define TF_HIDE 64 /* unused, same as TF_SELECT */
313 #define TF_ALPHASORT 2
315 #define TF_SHAREDVERT 8
318 #define TF_CONVERTED 32 /* tface converted to material */
320 #define TF_SHAREDCOL 64
321 #define TF_TILES 128 /* deprecated */
322 #define TF_BILLBOARD 256
323 #define TF_TWOSIDE 512
324 #define TF_INVISIBLE 1024
326 #define TF_OBCOL 2048
327 #define TF_BILLBOARD2 4096 /* with Z axis constraint */
328 #define TF_SHADOW 8192
329 #define TF_BMFONT 16384
331 /* mtface->transp, values 1-4 are used as flags in the GL, WARNING, TF_SUB cant work with this */
335 #define TF_CLIP 4 /* clipmap alpha/binary alpha all or nothing! */
337 /* sub is not available in the user interface anymore */
342 #define TF_DEPRECATED1 1
343 #define TF_DEPRECATED2 2
344 #define TF_DEPRECATED3 4
345 #define TF_DEPRECATED4 8