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