4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 #ifndef DNA_CUSTOMDATA_TYPES_H
31 #define DNA_CUSTOMDATA_TYPES_H
33 /* descriptor and storage for a custom data layer */
34 typedef struct CustomDataLayer {
35 int type; /* type of data in layer */
36 int offset; /* in editmode, offset of layer in block */
37 int flag; /* general purpose flag */
38 int active; /* number of the active layer of this type */
39 int active_rnd; /* number of the layer to render*/
40 int active_clone; /* number of the layer to render*/
41 int active_mask; /* number of the layer to render*/
43 char name[32]; /* layer name */
44 void *data; /* layer data */
47 /* structure which stores custom element data associated with mesh elements
48 * (vertices, edges or faces). The custom data is organised into a series of
49 * layers, each with a data type (e.g. MTFace, MDeformVert, etc.). */
50 typedef struct CustomData {
51 CustomDataLayer *layers; /* CustomDataLayers, ordered by type */
52 int totlayer, maxlayer; /* number of layers, size of layers array */
53 int totsize, pad; /* in editmode, total size of all data layers */
54 void *pool; /* for Bmesh: Memory pool for allocation of blocks*/
60 #define CD_MDEFORMVERT 2
65 #define CD_ORIGINDEX 7
68 #define CD_PROP_FLT 10
69 #define CD_PROP_INT 11
70 #define CD_PROP_STR 12
71 #define CD_ORIGSPACE 13 /* for modifier stack face location mapping */
73 #define CD_MTEXPOLY 15
75 #define CD_MLOOPCOL 17
78 #define CD_WEIGHT_MCOL 20 /* for displaying weightpaint colors */
79 #define CD_NUMTYPES 21
81 /* Bits for CustomDataMask */
82 #define CD_MASK_MVERT (1 << CD_MVERT)
83 #define CD_MASK_MSTICKY (1 << CD_MSTICKY)
84 #define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
85 #define CD_MASK_MEDGE (1 << CD_MEDGE)
86 #define CD_MASK_MFACE (1 << CD_MFACE)
87 #define CD_MASK_MTFACE (1 << CD_MTFACE)
88 #define CD_MASK_MCOL (1 << CD_MCOL)
89 #define CD_MASK_ORIGINDEX (1 << CD_ORIGINDEX)
90 #define CD_MASK_NORMAL (1 << CD_NORMAL)
91 #define CD_MASK_FLAGS (1 << CD_FLAGS)
92 #define CD_MASK_PROP_FLT (1 << CD_PROP_FLT)
93 #define CD_MASK_PROP_INT (1 << CD_PROP_INT)
94 #define CD_MASK_PROP_STR (1 << CD_PROP_STR)
95 #define CD_MASK_ORIGSPACE (1 << CD_ORIGSPACE)
96 #define CD_MASK_ORCO (1 << CD_ORCO)
97 #define CD_MASK_MTEXPOLY (1 << CD_MTEXPOLY)
98 #define CD_MASK_MLOOPUV (1 << CD_MLOOPUV)
99 #define CD_MASK_MLOOPCOL (1 << CD_MLOOPCOL)
100 #define CD_MASK_TANGENT (1 << CD_TANGENT)
101 #define CD_MASK_MDISPS (1 << CD_MDISPS)
102 #define CD_MASK_WEIGHT_MCOL (1 << CD_WEIGHT_MCOL)
104 /* derivedmesh wants CustomDataMask for weightpaint too, is not customdata though */
105 #define CD_MASK_WEIGHTPAINT (1 << CD_WEIGHTPAINT)
107 /* CustomData.flag */
109 /* indicates layer should not be copied by CustomData_from_template or
110 * CustomData_copy_data */
111 #define CD_FLAG_NOCOPY (1<<0)
112 /* indicates layer should not be freed (for layers backed by external data) */
113 #define CD_FLAG_NOFREE (1<<1)
114 /* indicates the layer is only temporary, also implies no copy */
115 #define CD_FLAG_TEMPORARY ((1<<2)|CD_FLAG_NOCOPY)