Blender  V2.93
DNA_customdata_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 
26 #pragma once
27 
28 #include "DNA_defs.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
35 typedef struct CustomDataLayer {
37  int type;
39  int offset;
41  int flag;
43  int active;
51  int uid;
53  char name[64];
55  void *data;
57 
58 #define MAX_CUSTOMDATA_LAYER_NAME 64
59 
60 typedef struct CustomDataExternal {
62  char filename[1024];
64 
70 typedef struct CustomData {
78  int typemap[51];
82  int totsize;
84  struct BLI_mempool *pool;
88 
89 /* CustomData.type */
90 typedef enum CustomDataType {
91  /* Used by GLSL attributes in the cases when we need a delayed CD type
92  * assignment (in the cases when we don't know in advance which layer
93  * we are addressing).
94  */
96 
97  CD_MVERT = 0,
98 #ifdef DNA_DEPRECATED_ALLOW
99  CD_MSTICKY = 1, /* DEPRECATED */
100 #endif
102  CD_MEDGE = 3,
103  CD_MFACE = 4,
105  CD_MCOL = 6,
108  CD_FACEMAP = 9, /* exclusive face group, each face can only be part of one */
112  CD_ORIGSPACE = 13, /* for modifier stack face location mapping */
113  CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */
114 #ifdef DNA_DEPRECATED_ALLOW
115  CD_MTEXPOLY = 15, /* deprecated */
116 #endif
120  CD_MDISPS = 19,
121  CD_PREVIEW_MCOL = 20, /* for displaying weightpaint colors */
122  /* CD_ID_MCOL = 21, */
123  /* CD_TEXTURE_MLOOPCOL = 22, */ /* UNUSED */
125  /* CD_RECAST = 24, */ /* UNUSED */
126 
127  /* BMESH ONLY START */
128  CD_MPOLY = 25,
129  CD_MLOOP = 26,
133  CD_CREASE = 30,
137  /* BMESH ONLY END */
138 
148 
149  /* CD_LOCATION = 43, */ /* UNUSED */
150  /* CD_RADIUS = 44, */ /* UNUSED */
153 
157 
159 
162 
163 /* Bits for CustomDataMask */
164 #define CD_MASK_MVERT (1 << CD_MVERT)
165 // #define CD_MASK_MSTICKY (1 << CD_MSTICKY) /* DEPRECATED */
166 #define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
167 #define CD_MASK_MEDGE (1 << CD_MEDGE)
168 #define CD_MASK_MFACE (1 << CD_MFACE)
169 #define CD_MASK_MTFACE (1 << CD_MTFACE)
170 #define CD_MASK_MCOL (1 << CD_MCOL)
171 #define CD_MASK_ORIGINDEX (1 << CD_ORIGINDEX)
172 #define CD_MASK_NORMAL (1 << CD_NORMAL)
173 #define CD_MASK_FACEMAP (1 << CD_FACEMAP)
174 #define CD_MASK_PROP_FLOAT (1 << CD_PROP_FLOAT)
175 #define CD_MASK_PROP_INT32 (1 << CD_PROP_INT32)
176 #define CD_MASK_PROP_STRING (1 << CD_PROP_STRING)
177 #define CD_MASK_ORIGSPACE (1 << CD_ORIGSPACE)
178 #define CD_MASK_ORCO (1 << CD_ORCO)
179 // #define CD_MASK_MTEXPOLY (1 << CD_MTEXPOLY) /* DEPRECATED */
180 #define CD_MASK_MLOOPUV (1 << CD_MLOOPUV)
181 #define CD_MASK_MLOOPCOL (1 << CD_MLOOPCOL)
182 #define CD_MASK_TANGENT (1 << CD_TANGENT)
183 #define CD_MASK_MDISPS (1 << CD_MDISPS)
184 #define CD_MASK_PREVIEW_MCOL (1 << CD_PREVIEW_MCOL)
185 #define CD_MASK_CLOTH_ORCO (1 << CD_CLOTH_ORCO)
186 // #define CD_MASK_RECAST (1 << CD_RECAST) /* DEPRECATED */
187 
188 /* BMESH ONLY START */
189 #define CD_MASK_MPOLY (1 << CD_MPOLY)
190 #define CD_MASK_MLOOP (1 << CD_MLOOP)
191 #define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX)
192 #define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY)
193 #define CD_MASK_BWEIGHT (1 << CD_BWEIGHT)
194 #define CD_MASK_CREASE (1 << CD_CREASE)
195 #define CD_MASK_ORIGSPACE_MLOOP (1LL << CD_ORIGSPACE_MLOOP)
196 #define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL)
197 #define CD_MASK_BM_ELEM_PYPTR (1LL << CD_BM_ELEM_PYPTR)
198 /* BMESH ONLY END */
199 
200 #define CD_MASK_PAINT_MASK (1LL << CD_PAINT_MASK)
201 #define CD_MASK_GRID_PAINT_MASK (1LL << CD_GRID_PAINT_MASK)
202 #define CD_MASK_MVERT_SKIN (1LL << CD_MVERT_SKIN)
203 #define CD_MASK_FREESTYLE_EDGE (1LL << CD_FREESTYLE_EDGE)
204 #define CD_MASK_FREESTYLE_FACE (1LL << CD_FREESTYLE_FACE)
205 #define CD_MASK_MLOOPTANGENT (1LL << CD_MLOOPTANGENT)
206 #define CD_MASK_TESSLOOPNORMAL (1LL << CD_TESSLOOPNORMAL)
207 #define CD_MASK_CUSTOMLOOPNORMAL (1LL << CD_CUSTOMLOOPNORMAL)
208 #define CD_MASK_SCULPT_FACE_SETS (1LL << CD_SCULPT_FACE_SETS)
209 #define CD_MASK_PROP_COLOR (1ULL << CD_PROP_COLOR)
210 #define CD_MASK_PROP_FLOAT3 (1ULL << CD_PROP_FLOAT3)
211 #define CD_MASK_PROP_FLOAT2 (1ULL << CD_PROP_FLOAT2)
212 #define CD_MASK_PROP_BOOL (1ULL << CD_PROP_BOOL)
213 
215 #define CD_MASK_MULTIRES_GRIDS (CD_MASK_MDISPS | CD_GRID_PAINT_MASK)
216 
217 /* All data layers. */
218 #define CD_MASK_ALL (~0LL)
219 
220 /* All generic attributes. */
221 #define CD_MASK_PROP_ALL \
222  (CD_MASK_PROP_FLOAT | CD_MASK_PROP_FLOAT2 | CD_MASK_PROP_FLOAT3 | CD_MASK_PROP_INT32 | \
223  CD_MASK_PROP_COLOR | CD_MASK_PROP_STRING | CD_MASK_MLOOPCOL | CD_MASK_PROP_BOOL)
224 
225 typedef struct CustomData_MeshMasks {
232 
233 /* CustomData.flag */
234 enum {
235  /* Indicates layer should not be copied by CustomData_from_template or CustomData_copy_data */
236  CD_FLAG_NOCOPY = (1 << 0),
237  /* Indicates layer should not be freed (for layers backed by external data) */
238  CD_FLAG_NOFREE = (1 << 1),
239  /* Indicates the layer is only temporary, also implies no copy */
241  /* Indicates the layer is stored in an external file */
242  CD_FLAG_EXTERNAL = (1 << 3),
243  /* Indicates external data is read into memory */
244  CD_FLAG_IN_MEMORY = (1 << 4),
245 };
246 
247 /* Limits */
248 #define MAX_MTFACE 8
249 #define MAX_MCOL 8
250 
251 #define DYNTOPO_NODE_NONE -1
252 
253 #define CD_TEMP_CHUNK_SIZE 128
254 
255 #ifdef __cplusplus
256 }
257 #endif
struct CustomDataLayer CustomDataLayer
struct CustomDataExternal CustomDataExternal
CustomDataType
@ CD_FACEMAP
@ CD_MLOOPTANGENT
@ CD_PAINT_MASK
@ CD_MVERT_SKIN
@ CD_PROP_FLOAT
@ CD_CUSTOMLOOPNORMAL
@ CD_TESSLOOPNORMAL
@ CD_PROP_FLOAT3
@ CD_PREVIEW_MCOL
@ CD_MDEFORMVERT
@ CD_ORIGINDEX
@ CD_PROP_COLOR
@ CD_NUMTYPES
@ CD_BM_ELEM_PYPTR
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_ORIGSPACE_MLOOP
@ CD_PROP_BOOL
@ CD_MLOOPCOL
@ CD_HAIRCURVE
@ CD_ORIGSPACE
@ CD_SCULPT_FACE_SETS
@ CD_FREESTYLE_EDGE
@ CD_SHAPEKEY
@ CD_FREESTYLE_FACE
@ CD_GRID_PAINT_MASK
@ CD_CLOTH_ORCO
@ CD_PREVIEW_MLOOPCOL
@ CD_MVERT
@ CD_PROP_STRING
@ CD_HAIRMAPPING
@ CD_BWEIGHT
@ CD_MLOOPUV
@ CD_AUTO_FROM_NAME
@ CD_TANGENT
@ CD_SHAPE_KEYINDEX
struct CustomData_MeshMasks CustomData_MeshMasks
struct CustomData CustomData
@ CD_FLAG_NOCOPY
@ CD_FLAG_IN_MEMORY
@ CD_FLAG_TEMPORARY
@ CD_FLAG_NOFREE
@ CD_FLAG_EXTERNAL
unsigned __int64 uint64_t
Definition: stdint.h:93
struct BLI_mempool * pool
CustomDataLayer * layers
CustomDataExternal * external