81
81
/* also update rna_property_subtype_unit when you change this */
82
82
typedef enum PropertyUnit {
83
PROP_UNIT_NONE = (0<<16),
84
PROP_UNIT_LENGTH = (1<<16), /* m */
85
PROP_UNIT_AREA = (2<<16), /* m^2 */
86
PROP_UNIT_VOLUME = (3<<16), /* m^3 */
87
PROP_UNIT_MASS = (4<<16), /* kg */
88
PROP_UNIT_ROTATION = (5<<16), /* radians */
89
PROP_UNIT_TIME = (6<<16), /* frame */
90
PROP_UNIT_VELOCITY = (7<<16), /* m/s */
91
PROP_UNIT_ACCELERATION = (8<<16) /* m/(s^2) */
83
PROP_UNIT_NONE = (0 << 16),
84
PROP_UNIT_LENGTH = (1 << 16), /* m */
85
PROP_UNIT_AREA = (2 << 16), /* m^2 */
86
PROP_UNIT_VOLUME = (3 << 16), /* m^3 */
87
PROP_UNIT_MASS = (4 << 16), /* kg */
88
PROP_UNIT_ROTATION = (5 << 16), /* radians */
89
PROP_UNIT_TIME = (6 << 16), /* frame */
90
PROP_UNIT_VELOCITY = (7 << 16), /* m/s */
91
PROP_UNIT_ACCELERATION = (8 << 16) /* m/(s^2) */
94
94
#define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000)
110
110
PROP_FILEPATH = 1,
111
111
PROP_DIRPATH = 2,
112
112
PROP_FILENAME = 3,
113
PROP_BYTESTRING = 4, /* a string which should be represented as bytes
114
* in python, still NULL terminated though. */
115
PROP_TRANSLATE = 5, /* a string which should be translated */
113
PROP_BYTESTRING = 4, /* a string which should be represented as bytes in python, still NULL terminated though. */
114
/* 5 was used by "PROP_TRANSLATE" sub-type, which is now a flag. */
115
PROP_PASSWORD = 6, /* a string which should not be displayed in UI */
118
118
PROP_UNSIGNED = 13,
119
119
PROP_PERCENTAGE = 14,
120
120
PROP_FACTOR = 15,
121
PROP_ANGLE = 16|PROP_UNIT_ROTATION,
122
PROP_TIME = 17|PROP_UNIT_TIME,
123
PROP_DISTANCE = 18|PROP_UNIT_LENGTH,
121
PROP_ANGLE = 16 | PROP_UNIT_ROTATION,
122
PROP_TIME = 17 | PROP_UNIT_TIME,
123
/* distance in 3d space, don't use for pixel distance for eg. */
124
PROP_DISTANCE = 18 | PROP_UNIT_LENGTH,
125
126
/* number arrays */
127
PROP_TRANSLATION = 21|PROP_UNIT_LENGTH,
128
PROP_TRANSLATION = 21 | PROP_UNIT_LENGTH,
128
129
PROP_DIRECTION = 22,
129
PROP_VELOCITY = 23|PROP_UNIT_VELOCITY,
130
PROP_ACCELERATION = 24|PROP_UNIT_ACCELERATION,
130
PROP_VELOCITY = 23 | PROP_UNIT_VELOCITY,
131
PROP_ACCELERATION = 24 | PROP_UNIT_ACCELERATION,
131
132
PROP_MATRIX = 25,
132
PROP_EULER = 26|PROP_UNIT_ROTATION,
133
PROP_EULER = 26 | PROP_UNIT_ROTATION,
133
134
PROP_QUATERNION = 27,
134
135
PROP_AXISANGLE = 28,
136
PROP_XYZ_LENGTH = 29|PROP_UNIT_LENGTH,
137
PROP_COLOR_GAMMA = 30,
137
PROP_XYZ_LENGTH = 29 | PROP_UNIT_LENGTH,
138
PROP_COLOR_GAMMA = 30, /* used for colors which would be color managed before display */
138
139
PROP_COORDS = 31, /* generic array, no units applied, only that x/y/z/w are used (python vec) */
143
144
} PropertySubType;
145
146
/* Make sure enums are updated with thses */
147
/* HIGHEST FLAG IN USE: 1 << 28 */
146
148
typedef enum PropertyFlag {
147
149
/* editable means the property is editable in the user
148
150
* interface, properties are editable by default except
149
151
* for pointers and collections. */
150
PROP_EDITABLE = 1<<0,
152
PROP_EDITABLE = (1 << 0),
152
154
/* this property is editable even if it is lib linked,
153
155
* meaning it will get lost on reload, but it's useful
154
156
* for editing. */
155
PROP_LIB_EXCEPTION = 1<<16,
157
PROP_LIB_EXCEPTION = (1 << 16),
157
159
/* animatable means the property can be driven by some
158
160
* other input, be it animation curves, expressions, ..
159
161
* properties are animatable by default except for pointers
160
162
* and collections */
161
PROP_ANIMATABLE = 1<<1,
163
PROP_ANIMATABLE = (1 << 1),
164
PROP_ICONS_CONSECUTIVE = 1<<12,
166
PROP_ICONS_CONSECUTIVE = (1 << 12),
166
168
/* hidden in the user interface */
169
PROP_HIDDEN = (1 << 19),
168
170
/* do not write in presets */
169
PROP_SKIP_SAVE = 1<<28,
171
PROP_SKIP_SAVE = (1 << 28),
171
173
/* function paramater flags */
172
PROP_REQUIRED = 1<<2,
174
PROP_REQUIRED = (1 << 2),
175
PROP_OUTPUT = (1 << 3),
176
PROP_RNAPTR = (1 << 11),
175
177
/* registering */
176
PROP_REGISTER = 1<<4,
177
PROP_REGISTER_OPTIONAL = (1<<4)|(1<<5),
178
PROP_REGISTER = (1 << 4),
179
PROP_REGISTER_OPTIONAL = (1 << 4) | (1 << 5),
180
PROP_ID_REFCOUNT = 1<<6,
182
PROP_ID_REFCOUNT = (1 << 6),
182
184
/* disallow assigning a variable to its self, eg an object tracking its self
183
185
* only apply this to types that are derived from an ID ()*/
184
PROP_ID_SELF_CHECK = 1<<20,
186
PROP_ID_SELF_CHECK = (1 << 20),
186
188
* - pointers: in the UI and python so unsetting or setting to None won't work
187
189
* - strings: so our internal generated get/length/set functions know to do NULL checks before access [#30865] */
188
PROP_NEVER_NULL = 1<<18,
190
PROP_NEVER_NULL = (1 << 18),
189
191
/* currently only used for UI, this is similar to PROP_NEVER_NULL
190
192
* except that the value may be NULL at times, used for ObData, where an Empty's will be NULL
191
193
* but setting NULL on a mesh object is not possible. So, if its not NULL, setting NULL cant be done! */
192
PROP_NEVER_UNLINK = 1<<25,
194
PROP_NEVER_UNLINK = (1 << 25),
194
196
/* flag contains multiple enums.
195
197
* note: not to be confused with prop->enumbitflags
198
200
* note: these can't be animated so use with care.
200
PROP_ENUM_FLAG = 1<<21,
202
PROP_ENUM_FLAG = (1 << 21),
202
204
/* need context for update function */
203
PROP_CONTEXT_UPDATE = 1<<22,
204
PROP_CONTEXT_PROPERTY_UPDATE = (1<<22)|(1<<27),
205
PROP_CONTEXT_UPDATE = (1 << 22),
206
PROP_CONTEXT_PROPERTY_UPDATE = (1 << 22) | (1 << 27),
206
/* Use for arrays or for any data that should not have a referene kept
208
/* Use for arrays or for any data that should not have a reference kept
207
209
* most common case is functions that return arrays where the array */
208
PROP_THICK_WRAP = 1<<23,
210
PROP_THICK_WRAP = (1 << 23),
210
212
/* Reject values outside limits, use for python api only so far
211
213
* this is for use when silently clamping string length will give
212
214
* bad behavior later. Could also enforce this for INT's and other types.
213
215
* note: currently no support for function arguments or non utf8 paths (filepaths) */
214
PROP_NEVER_CLAMP = 1<<26,
216
PROP_NEVER_CLAMP = (1 << 26),
216
218
/* internal flags */
220
PROP_IDPROPERTY = 1<<10,
221
PROP_RAW_ACCESS = 1<<13,
222
PROP_RAW_ARRAY = 1<<14,
223
PROP_FREE_POINTERS = 1<<15,
224
PROP_DYNAMIC = 1<<17, /* for dynamic arrays, and retvals of type string */
225
PROP_ENUM_NO_CONTEXT = 1<<24 /* for enum that shouldn't be contextual */
219
PROP_BUILTIN = (1 << 7),
220
PROP_EXPORT = (1 << 8),
221
PROP_RUNTIME = (1 << 9),
222
PROP_IDPROPERTY = (1 << 10),
223
PROP_RAW_ACCESS = (1 << 13),
224
PROP_RAW_ARRAY = (1 << 14),
225
PROP_FREE_POINTERS = (1 << 15),
226
PROP_DYNAMIC = (1 << 17), /* for dynamic arrays, and retvals of type string */
227
PROP_ENUM_NO_CONTEXT = (1 << 24) /* for enum that shouldn't be contextual */
228
230
typedef struct CollectionPropertyIterator {
268
270
const char *description;
269
271
} EnumPropertyItem;
271
/* this is a copy of 'PropEnumItemFunc' defined in rna_internal_types.h */
273
/* extended versions with PropertyRNA argument */
274
typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
275
typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
276
typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
277
typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
278
typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
279
typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
280
typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
281
typedef void (*IntArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
282
typedef void (*IntPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax);
283
typedef float (*FloatPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
284
typedef void (*FloatPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float value);
285
typedef void (*FloatArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *values);
286
typedef void (*FloatArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const float *values);
287
typedef void (*FloatPropertyRangeFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax);
288
typedef void (*StringPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, char *value);
289
typedef int (*StringPropertyLengthFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
290
typedef void (*StringPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const char *value);
291
typedef int (*EnumPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
292
typedef void (*EnumPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
293
/* same as PropEnumItemFunc */
272
294
typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, int *free);
274
296
typedef struct PropertyRNA PropertyRNA;