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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
/**
* $Id$
*
* ***** BEGIN GPL 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.
*
* 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.
*
* Contributor(s): Blender Foundation (2008).
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef RNA_TYPES
#define RNA_TYPES
#ifdef __cplusplus
extern "C" {
#endif
struct ParameterList;
struct FunctionRNA;
struct PropertyRNA;
struct StructRNA;
struct BlenderRNA;
struct IDProperty;
struct bContext;
struct ReportList;
/* Pointer
*
* RNA pointers are not a single C pointer but include the type,
* and a pointer to the ID struct that owns the struct, since
* in some cases this information is needed to correctly get/set
* the properties and validate them. */
typedef struct PointerRNA {
struct {
void *data;
} id;
struct StructRNA *type;
void *data;
} PointerRNA;
typedef struct PropertyPointerRNA {
PointerRNA ptr;
struct PropertyRNA *prop;
} PropertyPointerRNA;
/* Property */
typedef enum PropertyType {
PROP_BOOLEAN = 0,
PROP_INT = 1,
PROP_FLOAT = 2,
PROP_STRING = 3,
PROP_ENUM = 4,
PROP_POINTER = 5,
PROP_COLLECTION = 6
} PropertyType;
/* also update rna_property_subtype_unit when you change this */
typedef enum PropertyUnit {
PROP_UNIT_NONE = (0<<16),
PROP_UNIT_LENGTH = (1<<16), /* m */
PROP_UNIT_AREA = (2<<16), /* m^2 */
PROP_UNIT_VOLUME = (3<<16), /* m^3 */
PROP_UNIT_MASS = (4<<16), /* kg */
PROP_UNIT_ROTATION = (5<<16), /* rad */
PROP_UNIT_TIME = (6<<16), /* frame */
PROP_UNIT_VELOCITY = (7<<16), /* m/s */
PROP_UNIT_ACCELERATION = (8<<16) /* m/(s^2) */
} PropertyUnit;
#define RNA_SUBTYPE_UNIT(subtype) (subtype & 0x00FF0000)
#define RNA_SUBTYPE_UNIT_VALUE(subtype) (subtype>>16)
/* also update rna_property_subtypename when you change this */
typedef enum PropertySubType {
PROP_NONE = 0,
/* strings */
PROP_FILEPATH = 1,
PROP_DIRPATH = 2,
PROP_FILENAME = 3,
/* numbers */
PROP_UNSIGNED = 13,
PROP_PERCENTAGE = 14,
PROP_FACTOR = 15,
PROP_ANGLE = 16|PROP_UNIT_ROTATION,
PROP_TIME = 17|PROP_UNIT_TIME,
PROP_DISTANCE = 18|PROP_UNIT_LENGTH,
/* number arrays */
PROP_COLOR = 20,
PROP_TRANSLATION = 21|PROP_UNIT_LENGTH,
PROP_DIRECTION = 22,
PROP_VELOCITY = 23|PROP_UNIT_VELOCITY,
PROP_ACCELERATION = 24|PROP_UNIT_ACCELERATION,
PROP_MATRIX = 25,
PROP_EULER = 26|PROP_UNIT_ROTATION,
PROP_QUATERNION = 27,
PROP_AXISANGLE = 28,
PROP_XYZ = 29,
PROP_RGB = 30,
/* booleans */
PROP_LAYER = 40,
PROP_LAYER_MEMBER = 41
} PropertySubType;
typedef enum PropertyFlag {
/* editable means the property is editable in the user
* interface, properties are editable by default except
* for pointers and collections. */
PROP_EDITABLE = 1,
/* this property is editable even if it is lib linked,
* meaning it will get lost on reload, but it's useful
* for editing. */
PROP_LIB_EXCEPTION = 65536,
/* animateable means the property can be driven by some
* other input, be it animation curves, expressions, ..
* properties are animateable by default except for pointers
* and collections */
PROP_ANIMATEABLE = 2,
/* icon */
PROP_ICONS_CONSECUTIVE = 4096,
/* function paramater flags */
PROP_REQUIRED = 4,
PROP_RETURN = 8,
PROP_RNAPTR = 2048,
/* registering */
PROP_REGISTER = 16,
PROP_REGISTER_OPTIONAL = 16|32,
/* pointers */
PROP_ID_REFCOUNT = 64,
PROP_NEVER_NULL = 262144,
/* internal flags */
PROP_BUILTIN = 128,
PROP_EXPORT = 256,
PROP_RUNTIME = 512,
PROP_IDPROPERTY = 1024,
PROP_RAW_ACCESS = 8192,
PROP_RAW_ARRAY = 16384,
PROP_FREE_POINTERS = 32768,
PROP_DYNAMIC = 131072 /* for dynamic arrays, and retvals of type string */
} PropertyFlag;
typedef struct CollectionPropertyIterator {
/* internal */
PointerRNA parent;
PointerRNA builtin_parent;
struct PropertyRNA *prop;
void *internal;
int idprop;
int level;
/* external */
int valid;
PointerRNA ptr;
} CollectionPropertyIterator;
typedef struct CollectionPointerLink {
struct CollectionPointerLink *next, *prev;
PointerRNA ptr;
} CollectionPointerLink;
typedef enum RawPropertyType {
PROP_RAW_INT, // XXX - abused for types that are not set, eg. MFace.verts, needs fixing.
PROP_RAW_SHORT,
PROP_RAW_CHAR,
PROP_RAW_DOUBLE,
PROP_RAW_FLOAT
} RawPropertyType;
typedef struct RawArray {
void *array;
RawPropertyType type;
int len;
int stride;
} RawArray;
typedef struct EnumPropertyItem {
int value;
const char *identifier;
int icon;
const char *name;
const char *description;
} EnumPropertyItem;
typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, int *free);
typedef struct PropertyRNA PropertyRNA;
/* Parameter List */
typedef struct ParameterList {
/* storage for parameters */
void *data;
/* store the parameter count */
int tot;
/* function passed at creation time */
struct FunctionRNA *func;
} ParameterList;
typedef struct ParameterIterator {
struct ParameterList *parms;
PointerRNA funcptr;
void *data;
int size, offset;
PropertyRNA *parm;
int valid;
} ParameterIterator;
/* Function */
typedef enum FunctionFlag {
FUNC_NO_SELF = 1, /* for static functions */
FUNC_USE_CONTEXT = 2,
FUNC_USE_REPORTS = 4,
/* registering */
FUNC_REGISTER = 8,
FUNC_REGISTER_OPTIONAL = 8|16,
/* internal flags */
FUNC_BUILTIN = 128,
FUNC_EXPORT = 256,
FUNC_RUNTIME = 512,
FUNC_FREE_POINTERS = 1024
} FunctionFlag;
typedef void (*CallFunc)(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, ParameterList *parms);
typedef struct FunctionRNA FunctionRNA;
/* Struct */
typedef enum StructFlag {
/* indicates that this struct is an ID struct, and to use refcounting */
STRUCT_ID = 1,
STRUCT_ID_REFCOUNT = 2,
/* internal flags */
STRUCT_RUNTIME = 4,
STRUCT_GENERATED = 8,
STRUCT_FREE_POINTERS = 16
} StructFlag;
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
typedef int (*StructCallbackFunc)(struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list);
typedef void (*StructFreeFunc)(void *data);
typedef struct StructRNA *(*StructRegisterFunc)(const struct bContext *C, struct ReportList *reports, void *data,
const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
typedef void (*StructUnregisterFunc)(const struct bContext *C, struct StructRNA *type);
typedef struct StructRNA StructRNA;
/* Blender RNA
*
* Root RNA data structure that lists all struct types. */
typedef struct BlenderRNA BlenderRNA;
/* Extending
*
* This struct must be embedded in *Type structs in
* order to make then definable through RNA. */
typedef struct ExtensionRNA {
void *data;
StructRNA *srna;
int (*call)(PointerRNA *, FunctionRNA *, ParameterList *);
void (*free)(void *data);
} ExtensionRNA;
#ifdef __cplusplus
}
#endif
#endif /* RNA_TYPES */
|