Blender V2.61 - r43446
|
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 00033 #ifndef DNA_ID_H 00034 #define DNA_ID_H 00035 00036 #include "DNA_listBase.h" 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 struct Library; 00043 struct FileData; 00044 struct ID; 00045 00046 typedef struct IDPropertyData { 00047 void *pointer; 00048 ListBase group; 00049 int val, val2; /*note, we actually fit a double into these two ints*/ 00050 } IDPropertyData; 00051 00052 typedef struct IDProperty { 00053 struct IDProperty *next, *prev; 00054 char type, subtype; 00055 short flag; 00056 char name[64]; /* MAX_IDPROP_NAME */ 00057 int saved; /*saved is used to indicate if this struct has been saved yet. 00058 seemed like a good idea as a pad var was needed anyway :)*/ 00059 IDPropertyData data; /* note, alignment for 64 bits */ 00060 int len; /* array length, also (this is important!) string length + 1. 00061 * the idea is to be able to reuse array realloc functions on strings.*/ 00062 /* totallen is total length of allocated array/string, including a buffer. 00063 * Note that the buffering is mild; the code comes from python's list implementation.*/ 00064 int totallen; /*strings and arrays are both buffered, though the buffer isn't 00065 saved.*/ 00066 } IDProperty; 00067 00068 #define MAX_IDPROP_NAME 64 00069 #define DEFAULT_ALLOC_FOR_NULL_STRINGS 64 00070 00071 /*->type*/ 00072 #define IDP_STRING 0 00073 #define IDP_INT 1 00074 #define IDP_FLOAT 2 00075 #define IDP_ARRAY 5 00076 #define IDP_GROUP 6 00077 /* the ID link property type hasn't been implemented yet, this will require 00078 * some cleanup of blenkernel, most likely.*/ 00079 #define IDP_ID 7 00080 #define IDP_DOUBLE 8 00081 #define IDP_IDPARRAY 9 00082 #define IDP_NUMTYPES 10 00083 00084 /*->subtype */ 00085 00086 /* IDP_STRING */ 00087 #define IDP_STRING_SUB_UTF8 0 /* default */ 00088 #define IDP_STRING_SUB_BYTE 1 /* arbitrary byte array, _not_ null terminated */ 00089 /*->flag*/ 00090 #define IDP_FLAG_GHOST (1<<7) /* this means the propery is set but RNA will return 00091 * false when checking 'RNA_property_is_set', 00092 * currently this is a runtime flag */ 00093 00094 00095 /* add any future new id property types here.*/ 00096 00097 /* watch it: Sequence has identical beginning. */ 00103 /* 2 characters for ID code and 64 for actual name */ 00104 #define MAX_ID_NAME 66 00105 00106 /* There's a nasty circular dependency here.... void* to the rescue! I 00107 * really wonder why this is needed. */ 00108 typedef struct ID { 00109 void *next, *prev; 00110 struct ID *newid; 00111 struct Library *lib; 00112 char name[66]; 00113 short pad, us; 00118 short flag; 00119 int icon_id, pad2; 00120 IDProperty *properties; 00121 } ID; 00122 00127 typedef struct Library { 00128 ID id; 00129 ID *idblock; 00130 struct FileData *filedata; 00131 char name[240]; /* path name used for reading, can be relative and edited in the outliner */ 00132 char filepath[240]; /* absolute filepath, this is only for convenience, 00133 * 'name' is the real path used on file read but in 00134 * some cases its useful to access the absolute one, 00135 * This is set on file read. 00136 * Use BKE_library_filepath_set() rather than 00137 * setting 'name' directly and it will be kepk in 00138 * sync - campbell */ 00139 int tot, pad; /* tot, idblock and filedata are only fo read and write */ 00140 struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */ 00141 } Library; 00142 00143 enum eIconSizes { 00144 ICON_SIZE_ICON, 00145 ICON_SIZE_PREVIEW 00146 }; 00147 #define NUM_ICON_SIZES (ICON_SIZE_PREVIEW + 1) 00148 00149 typedef struct PreviewImage { 00150 /* All values of 2 are really NUM_ICON_SIZES */ 00151 unsigned int w[2]; 00152 unsigned int h[2]; 00153 short changed[2]; 00154 short changed_timestamp[2]; 00155 unsigned int * rect[2]; 00156 } PreviewImage; 00157 00166 #ifdef __BIG_ENDIAN__ 00167 /* big endian */ 00168 # define MAKE_ID2(c, d) ( (c)<<8 | (d) ) 00169 # define MOST_SIG_BYTE 0 00170 # define BBIG_ENDIAN 00171 #else 00172 /* little endian */ 00173 # define MAKE_ID2(c, d) ( (d)<<8 | (c) ) 00174 # define MOST_SIG_BYTE 1 00175 # define BLITTLE_ENDIAN 00176 #endif 00177 00178 /* ID from database */ 00179 #define ID_SCE MAKE_ID2('S', 'C') /* Scene */ 00180 #define ID_LI MAKE_ID2('L', 'I') /* Library */ 00181 #define ID_OB MAKE_ID2('O', 'B') /* Object */ 00182 #define ID_ME MAKE_ID2('M', 'E') /* Mesh */ 00183 #define ID_CU MAKE_ID2('C', 'U') /* Curve */ 00184 #define ID_MB MAKE_ID2('M', 'B') /* MetaBall */ 00185 #define ID_MA MAKE_ID2('M', 'A') /* Material */ 00186 #define ID_TE MAKE_ID2('T', 'E') /* Texture */ 00187 #define ID_IM MAKE_ID2('I', 'M') /* Image */ 00188 #define ID_LT MAKE_ID2('L', 'T') /* Lattice */ 00189 #define ID_LA MAKE_ID2('L', 'A') /* Lamp */ 00190 #define ID_CA MAKE_ID2('C', 'A') /* Camera */ 00191 #define ID_IP MAKE_ID2('I', 'P') /* Ipo (depreciated, replaced by FCurves) */ 00192 #define ID_KE MAKE_ID2('K', 'E') /* Key (shape key) */ 00193 #define ID_WO MAKE_ID2('W', 'O') /* World */ 00194 #define ID_SCR MAKE_ID2('S', 'R') /* Screen */ 00195 #define ID_SCRN MAKE_ID2('S', 'N') /* (depreciated?) */ 00196 #define ID_VF MAKE_ID2('V', 'F') /* VectorFont */ 00197 #define ID_TXT MAKE_ID2('T', 'X') /* Text */ 00198 #define ID_SPK MAKE_ID2('S', 'K') /* Speaker */ 00199 #define ID_SO MAKE_ID2('S', 'O') /* Sound */ 00200 #define ID_GR MAKE_ID2('G', 'R') /* Group */ 00201 #define ID_ID MAKE_ID2('I', 'D') /* (internal use only) */ 00202 #define ID_AR MAKE_ID2('A', 'R') /* Armature */ 00203 #define ID_AC MAKE_ID2('A', 'C') /* Action */ 00204 #define ID_SCRIPT MAKE_ID2('P', 'Y') /* Script (depreciated) */ 00205 #define ID_NT MAKE_ID2('N', 'T') /* NodeTree */ 00206 #define ID_BR MAKE_ID2('B', 'R') /* Brush */ 00207 #define ID_PA MAKE_ID2('P', 'A') /* ParticleSettings */ 00208 #define ID_GD MAKE_ID2('G', 'D') /* GreasePencil */ 00209 #define ID_WM MAKE_ID2('W', 'M') /* WindowManager */ 00210 #define ID_MC MAKE_ID2('M', 'C') /* MovieClip */ 00211 00212 /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ 00213 #define ID_SEQ MAKE_ID2('S', 'Q') 00214 /* constraint */ 00215 #define ID_CO MAKE_ID2('C', 'O') 00216 /* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */ 00217 #define ID_PO MAKE_ID2('A', 'C') 00218 /* used in outliner... */ 00219 #define ID_NLA MAKE_ID2('N', 'L') 00220 /* fluidsim Ipo */ 00221 #define ID_FLUIDSIM MAKE_ID2('F', 'S') 00222 00223 #define ID_REAL_USERS(id) (((ID *)id)->us - ((((ID *)id)->flag & LIB_FAKEUSER) ? 1:0)) 00224 00225 #define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM)) 00226 00227 #define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name) 00228 00229 #ifdef GS 00230 #undef GS 00231 #endif 00232 #define GS(a) (*((short *)(a))) 00233 00234 /* id->flag: set frist 8 bits always at zero while reading */ 00235 #define LIB_LOCAL 0 00236 #define LIB_EXTERN 1 00237 #define LIB_INDIRECT 2 00238 #define LIB_TEST 8 00239 #define LIB_TESTEXT (LIB_TEST | LIB_EXTERN) 00240 #define LIB_TESTIND (LIB_TEST | LIB_INDIRECT) 00241 #define LIB_READ 16 00242 #define LIB_NEEDLINK 32 00243 00244 #define LIB_NEW 256 00245 #define LIB_FAKEUSER 512 00246 /* free test flag */ 00247 #define LIB_DOIT 1024 00248 /* tag existing data before linking so we know what is new */ 00249 #define LIB_PRE_EXISTING 2048 00250 /* runtime */ 00251 #define LIB_ID_RECALC 4096 00252 #define LIB_ID_RECALC_DATA 8192 00253 00254 #ifdef __cplusplus 00255 } 00256 #endif 00257 00258 #endif 00259