~diresu/blender/blender-command-port

« back to all changes in this revision

Viewing changes to source/blender/makesdna/DNA_ID.h

  • Committer: theeth
  • Date: 2008-10-14 16:52:04 UTC
  • Revision ID: vcs-imports@canonical.com-20081014165204-r32w2gm6s0osvdhn
copy back trunk

Show diffs side-by-side

added added

removed removed

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