Blender V2.61 - r43446

DNA_customdata_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef DNA_CUSTOMDATA_TYPES_H
00033 #define DNA_CUSTOMDATA_TYPES_H
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 #include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */
00040 
00042 typedef struct CustomDataLayer {
00043     int type;       /* type of data in layer */
00044     int offset;     /* in editmode, offset of layer in block */
00045     int flag;       /* general purpose flag */
00046     int active;     /* number of the active layer of this type */
00047     int active_rnd; /* number of the layer to render*/
00048     int active_clone; /* number of the layer to render*/
00049     int active_mask; /* number of the layer to render*/
00050     char pad[4];
00051     char name[64];  /* layer name, MAX_CUSTOMDATA_LAYER_AAME */
00052     void *data;     /* layer data */
00053 } CustomDataLayer;
00054 
00055 #define MAX_CUSTOMDATA_LAYER_NAME 64
00056 
00057 typedef struct CustomDataExternal {
00058     char filename[240]; /* FILE_MAX */
00059 } CustomDataExternal;
00060 
00064 typedef struct CustomData {
00065     CustomDataLayer *layers;      /* CustomDataLayers, ordered by type */
00066     int typemap[32];              /* runtime only! - maps types to indices of first layer of that type,
00067                                    * MUST be >= CD_NUMTYPES, but we cant use a define here.
00068                                    * Correct size is ensured in CustomData_update_typemap assert() */
00069     int totlayer, maxlayer;       /* number of layers, size of layers array */
00070     int totsize, pad;             /* in editmode, total size of all data layers */
00071     void *pool;                   /* Bmesh: Memory pool for allocation of blocks */
00072     CustomDataExternal *external; /* external file storing customdata layers */
00073 } CustomData;
00074 
00075 /* CustomData.type */
00076 #define CD_MVERT        0
00077 #define CD_MSTICKY      1
00078 #define CD_MDEFORMVERT  2
00079 #define CD_MEDGE        3
00080 #define CD_MFACE        4
00081 #define CD_MTFACE       5
00082 #define CD_MCOL         6
00083 #define CD_ORIGINDEX    7
00084 #define CD_NORMAL       8
00085 #define CD_POLYINDEX    9
00086 #define CD_PROP_FLT     10
00087 #define CD_PROP_INT     11
00088 #define CD_PROP_STR     12
00089 #define CD_ORIGSPACE    13 /* for modifier stack face location mapping */
00090 #define CD_ORCO         14
00091 #define CD_MTEXPOLY     15
00092 #define CD_MLOOPUV      16
00093 #define CD_MLOOPCOL     17
00094 #define CD_TANGENT      18
00095 #define CD_MDISPS       19
00096 #define CD_WEIGHT_MCOL  20 /* for displaying weightpaint colors */
00097 #define CD_ID_MCOL      21
00098 #define CD_TEXTURE_MCOL 22
00099 #define CD_CLOTH_ORCO   23
00100 #define CD_RECAST       24
00101 
00102 #ifdef USE_BMESH_FORWARD_COMPAT
00103 
00104 /* BMESH ONLY START */
00105 #define CD_MPOLY        25
00106 #define CD_MLOOP        26
00107 #define CD_SHAPE_KEYINDEX   27
00108 #define CD_SHAPEKEY     28
00109 #define CD_BWEIGHT      29
00110 #define CD_CREASE       30
00111 #define CD_WEIGHT_MLOOPCOL  31
00112 /* BMESH ONLY END */
00113 
00114 #define CD_NUMTYPES     32
00115 
00116 #else
00117 
00118 #define CD_NUMTYPES     25
00119 
00120 #endif
00121 
00122 /* Bits for CustomDataMask */
00123 #define CD_MASK_MVERT       (1 << CD_MVERT)
00124 #define CD_MASK_MSTICKY     (1 << CD_MSTICKY)
00125 #define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
00126 #define CD_MASK_MEDGE       (1 << CD_MEDGE)
00127 #define CD_MASK_MFACE       (1 << CD_MFACE)
00128 #define CD_MASK_MTFACE      (1 << CD_MTFACE)
00129 #define CD_MASK_MCOL        (1 << CD_MCOL)
00130 #define CD_MASK_ORIGINDEX   (1 << CD_ORIGINDEX)
00131 #define CD_MASK_NORMAL      (1 << CD_NORMAL)
00132 #define CD_MASK_POLYINDEX   (1 << CD_POLYINDEX)
00133 #define CD_MASK_PROP_FLT    (1 << CD_PROP_FLT)
00134 #define CD_MASK_PROP_INT    (1 << CD_PROP_INT)
00135 #define CD_MASK_PROP_STR    (1 << CD_PROP_STR)
00136 #define CD_MASK_ORIGSPACE   (1 << CD_ORIGSPACE)
00137 #define CD_MASK_ORCO        (1 << CD_ORCO)
00138 #define CD_MASK_MTEXPOLY    (1 << CD_MTEXPOLY)
00139 #define CD_MASK_MLOOPUV     (1 << CD_MLOOPUV)
00140 #define CD_MASK_MLOOPCOL    (1 << CD_MLOOPCOL)
00141 #define CD_MASK_TANGENT     (1 << CD_TANGENT)
00142 #define CD_MASK_MDISPS      (1 << CD_MDISPS)
00143 #define CD_MASK_WEIGHT_MCOL (1 << CD_WEIGHT_MCOL)
00144 #define CD_MASK_CLOTH_ORCO  (1 << CD_CLOTH_ORCO)
00145 #define CD_MASK_RECAST      (1 << CD_RECAST)
00146 
00147 #ifdef USE_BMESH_FORWARD_COMPAT
00148 
00149 /* BMESH ONLY START */
00150 #define CD_MASK_MPOLY       (1 << CD_MPOLY)
00151 #define CD_MASK_MLOOP       (1 << CD_MLOOP)
00152 #define CD_MASK_SHAPE_KEYINDEX  (1 << CD_SHAPE_KEYINDEX)
00153 #define CD_MASK_SHAPEKEY    (1 << CD_SHAPEKEY)
00154 #define CD_MASK_BWEIGHT     (1 << CD_BWEIGHT)
00155 #define CD_MASK_CREASE      (1 << CD_CREASE)
00156 #define CD_MASK_WEIGHT_MLOOPCOL (1 << CD_WEIGHT_MLOOPCOL)
00157 /* BMESH ONLY END */
00158 
00159 #endif
00160 
00161 /* CustomData.flag */
00162 
00163 /* indicates layer should not be copied by CustomData_from_template or
00164  * CustomData_copy_data */
00165 #define CD_FLAG_NOCOPY    (1<<0)
00166 /* indicates layer should not be freed (for layers backed by external data) */
00167 #define CD_FLAG_NOFREE    (1<<1)
00168 /* indicates the layer is only temporary, also implies no copy */
00169 #define CD_FLAG_TEMPORARY ((1<<2)|CD_FLAG_NOCOPY)
00170 /* indicates the layer is stored in an external file */
00171 #define CD_FLAG_EXTERNAL  (1<<3)
00172 /* indicates external data is read into memory */
00173 #define CD_FLAG_IN_MEMORY (1<<4)
00174 
00175 /* Limits */
00176 #define MAX_MTFACE 8
00177 #define MAX_MCOL   8
00178 
00179 #ifdef __cplusplus
00180 }
00181 #endif
00182 
00183 #endif