dpx saving would fail if there was no float buffer, which is a problem
[plumiferos.git] / source / blender / makesdna / DNA_ID.h
blobe73006fb8473877b4ffea913a636761c0650bf97
1 /**
2 * blenlib/DNA_ID.h (mar-2001 nzc)
4 * ID and Library types, which are fundamental for sdna,
6 * $Id: DNA_ID.h 10574 2007-04-24 14:52:35Z ton $
8 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version. The Blender
14 * Foundation also sells licenses for use in proprietary software under
15 * the Blender License. See http://www.blender.org/BL/ for information
16 * about this.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
28 * All rights reserved.
30 * The Original Code is: all of this file.
32 * Contributor(s): none yet.
34 * ***** END GPL/BL DUAL LICENSE BLOCK *****
36 #ifndef DNA_ID_H
37 #define DNA_ID_H
39 #include "DNA_listBase.h"
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 struct Library;
46 struct FileData;
47 struct ID;
49 typedef struct IDPropertyData {
50 void *pointer;
51 ListBase group;
52 int val, pad;
53 } IDPropertyData;
55 typedef struct IDProperty {
56 struct IDProperty *next, *prev;
57 char name[32];
58 char type, subtype;
59 short flag;
60 int saved; /*saved is used to indicate if this struct has been saved yet.
61 seemed like a good idea as a pad var was needed anyway :)*/
62 IDPropertyData data; /* note, alignment for 64 bits */
63 int len; /* array length, also (this is important!) string length + 1.
64 the idea is to be able to reuse array realloc functions on strings.*/
65 /*totallen is total length of allocated array/string, including a buffer.
66 Note that the buffering is mild; the code comes from python's list implementation.*/
67 int totallen; /*strings and arrays are both buffered, though the buffer isn't
68 saved.*/
69 } IDProperty;
71 #define MAX_IDPROP_NAME 32
72 #define DEFAULT_ALLOC_FOR_NULL_STRINGS 64
74 /*->type*/
75 #define IDP_STRING 0
76 #define IDP_INT 1
77 #define IDP_FLOAT 2
78 #define IDP_ARRAY 5
79 #define IDP_GROUP 6
80 /*the ID link property type hasn't been implemented yet, this will require
81 some cleanup of blenkernel, most likely.*/
82 #define IDP_ID 7
84 /*add any future new id property types here.*/
86 /* watch it: Sequence has identical beginning. */
87 /**
88 * ID is the first thing included in all serializable types. It
89 * provides a common handle to place all data in double-linked lists.
90 * */
92 /* There's a nasty circular dependency here.... void* to the rescue! I
93 * really wonder why this is needed. */
94 typedef struct ID {
95 void *next, *prev;
96 struct ID *newid;
97 struct Library *lib;
98 char name[24];
99 short us;
101 * LIB_... flags report on status of the datablock this ID belongs
102 * to.
104 short flag;
105 int icon_id;
106 IDProperty *properties;
107 } ID;
110 * For each library file used, a Library struct is added to Main
111 * WARNING: readfile.c, expand_doit() reads this struct without DNA check!
113 typedef struct Library {
114 ID id;
115 ID *idblock;
116 struct FileData *filedata;
117 char name[240]; /* reveiled in the UI, can store relative path */
118 char filename[240]; /* expanded name, not relative, used while reading */
119 int tot, pad; /* tot, idblock and filedata are only fo read and write */
120 struct Library *parent; /* for outliner, showing dependency */
121 } Library;
124 * Defines for working with IDs.
126 * The tags represent types! This is a dirty way of enabling RTTI. The
127 * sig_byte end endian defines aren't really used much.
131 #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
132 /* big endian */
133 #define MAKE_ID2(c, d) ( (c)<<8 | (d) )
134 #define MOST_SIG_BYTE 0
135 #define BBIG_ENDIAN
136 #else
137 /* little endian */
138 #define MAKE_ID2(c, d) ( (d)<<8 | (c) )
139 #define MOST_SIG_BYTE 1
140 #define BLITTLE_ENDIAN
141 #endif
143 /* ID from database */
144 #define ID_SCE MAKE_ID2('S', 'C')
145 #define ID_LI MAKE_ID2('L', 'I')
146 #define ID_OB MAKE_ID2('O', 'B')
147 #define ID_ME MAKE_ID2('M', 'E')
148 #define ID_CU MAKE_ID2('C', 'U')
149 #define ID_MB MAKE_ID2('M', 'B')
150 #define ID_MA MAKE_ID2('M', 'A')
151 #define ID_TE MAKE_ID2('T', 'E')
152 #define ID_IM MAKE_ID2('I', 'M')
153 #define ID_IK MAKE_ID2('I', 'K')
154 #define ID_WV MAKE_ID2('W', 'V')
155 #define ID_LT MAKE_ID2('L', 'T')
156 #define ID_SE MAKE_ID2('S', 'E')
157 #define ID_LF MAKE_ID2('L', 'F')
158 #define ID_LA MAKE_ID2('L', 'A')
159 #define ID_CA MAKE_ID2('C', 'A')
160 #define ID_IP MAKE_ID2('I', 'P')
161 #define ID_KE MAKE_ID2('K', 'E')
162 #define ID_WO MAKE_ID2('W', 'O')
163 #define ID_SCR MAKE_ID2('S', 'R')
164 #define ID_VF MAKE_ID2('V', 'F')
165 #define ID_TXT MAKE_ID2('T', 'X')
166 #define ID_SO MAKE_ID2('S', 'O')
167 #define ID_GR MAKE_ID2('G', 'R')
168 #define ID_ID MAKE_ID2('I', 'D')
169 #define ID_AR MAKE_ID2('A', 'R')
170 #define ID_AC MAKE_ID2('A', 'C')
171 #define ID_SCRIPT MAKE_ID2('P', 'Y')
172 #define ID_NT MAKE_ID2('N', 'T')
173 #define ID_BR MAKE_ID2('B', 'R')
175 /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
176 #define ID_SEQ MAKE_ID2('S', 'Q')
177 /* constraint */
178 #define ID_CO MAKE_ID2('C', 'O')
179 /* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
180 #define ID_PO MAKE_ID2('A', 'C')
181 /* used in outliner... */
182 #define ID_NLA MAKE_ID2('N', 'L')
183 /* fluidsim Ipo */
184 #define ID_FLUIDSIM MAKE_ID2('F', 'S')
187 /*#ifdef WITH_VERSE*/
188 #define ID_VS MAKE_ID2('V', 'S') /* fake id for VerseSession, needed for outliner */
189 #define ID_VN MAKE_ID2('V', 'N') /* fake id for VerseNode, needed for outliner */
190 #define ID_MS MAKE_ID2('M', 'S') /* fake id for VerseServer root entry, needed for outliner */
191 #define ID_SS MAKE_ID2('S', 'S') /* fake id for VerseServer entry, needed for ountliner */
192 /*#endif*/
195 /* id->flag: set frist 8 bits always at zero while reading */
196 #define LIB_LOCAL 0
197 #define LIB_EXTERN 1
198 #define LIB_INDIRECT 2
199 #define LIB_TEST 8
200 #define LIB_TESTEXT 9
201 #define LIB_TESTIND 10
202 #define LIB_READ 16
203 #define LIB_NEEDLINK 32
205 #define LIB_NEW 256
206 #define LIB_FAKEUSER 512
207 /* free test flag */
208 #define LIB_DOIT 1024
209 /* */
210 #define LIB_APPEND_TAG 2048
212 #ifdef __cplusplus
214 #endif
216 #endif