1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 */ 16 17 /** \file 18 * \ingroup RNA 19 */ 20 21 #ifndef __RNA_TYPES_H__ 22 #define __RNA_TYPES_H__ 23 24 #include "../blenlib/BLI_sys_types.h" 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 struct BlenderRNA; 31 struct FunctionRNA; 32 struct ID; 33 struct Main; 34 struct ParameterList; 35 struct PropertyRNA; 36 struct ReportList; 37 struct StructRNA; 38 struct bContext; 39 40 /** 41 * Pointer 42 * 43 * RNA pointers are not a single C pointer but include the type, 44 * and a pointer to the ID struct that owns the struct, since 45 * in some cases this information is needed to correctly get/set 46 * the properties and validate them. */ 47 48 typedef struct PointerRNA { 49 struct ID *owner_id; 50 struct StructRNA *type; 51 void *data; 52 } PointerRNA; 53 54 typedef struct PropertyPointerRNA { 55 PointerRNA ptr; 56 struct PropertyRNA *prop; 57 } PropertyPointerRNA; 58 59 /** 60 * Stored result of a RNA path lookup (as used by anim-system) 61 */ 62 typedef struct PathResolvedRNA { 63 struct PointerRNA ptr; 64 struct PropertyRNA *prop; 65 /** -1 for non-array access. */ 66 int prop_index; 67 } PathResolvedRNA; 68 69 /* Property */ 70 71 typedef enum PropertyType { 72 PROP_BOOLEAN = 0, 73 PROP_INT = 1, 74 PROP_FLOAT = 2, 75 PROP_STRING = 3, 76 PROP_ENUM = 4, 77 PROP_POINTER = 5, 78 PROP_COLLECTION = 6, 79 } PropertyType; 80 81 /* also update rna_property_subtype_unit when you change this */ 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) */ 92 PROP_UNIT_CAMERA = (9 << 16), /* mm */ 93 PROP_UNIT_POWER = (10 << 16), /* W */ 94 PROP_UNIT_TEMPERATURE = (11 << 16), /* C */ 95 } PropertyUnit; 96 97 #define RNA_SUBTYPE_UNIT(subtype) ((subtype)&0x00FF0000) 98 #define RNA_SUBTYPE_VALUE(subtype) ((subtype) & ~0x00FF0000) 99 #define RNA_SUBTYPE_UNIT_VALUE(subtype) ((subtype) >> 16) 100 101 #define RNA_ENUM_BITFLAG_SIZE 32 102 103 #define RNA_TRANSLATION_PREC_DEFAULT 5 104 105 #define RNA_STACK_ARRAY 32 106 107 /** 108 * \note Also update enums in bpy_props.c and rna_rna.c when adding items here. 109 * Watch it: these values are written to files as part of node socket button subtypes! 110 */ 111 typedef enum PropertySubType { 112 PROP_NONE = 0, 113 114 /* strings */ 115 PROP_FILEPATH = 1, 116 PROP_DIRPATH = 2, 117 PROP_FILENAME = 3, 118 /** A string which should be represented as bytes in python, NULL terminated though. */ 119 PROP_BYTESTRING = 4, 120 /* 5 was used by "PROP_TRANSLATE" sub-type, which is now a flag. */ 121 /** A string which should not be displayed in UI. */ 122 PROP_PASSWORD = 6, 123 124 /* numbers */ 125 /** A dimension in pixel units, possibly before DPI scaling (so value may not be the final pixel 126 * value but the one to apply DPI scale to). */ 127 PROP_PIXEL = 12, 128 PROP_UNSIGNED = 13, 129 PROP_PERCENTAGE = 14, 130 PROP_FACTOR = 15, 131 PROP_ANGLE = 16 | PROP_UNIT_ROTATION, 132 PROP_TIME = 17 | PROP_UNIT_TIME, 133 /** Distance in 3d space, don't use for pixel distance for eg. */ 134 PROP_DISTANCE = 18 | PROP_UNIT_LENGTH, 135 PROP_DISTANCE_CAMERA = 19 | PROP_UNIT_CAMERA, 136 137 /* number arrays */ 138 PROP_COLOR = 20, 139 PROP_TRANSLATION = 21 | PROP_UNIT_LENGTH, 140 PROP_DIRECTION = 22, 141 PROP_VELOCITY = 23 | PROP_UNIT_VELOCITY, 142 PROP_ACCELERATION = 24 | PROP_UNIT_ACCELERATION, 143 PROP_MATRIX = 25, 144 PROP_EULER = 26 | PROP_UNIT_ROTATION, 145 PROP_QUATERNION = 27, 146 PROP_AXISANGLE = 28, 147 PROP_XYZ = 29, 148 PROP_XYZ_LENGTH = 29 | PROP_UNIT_LENGTH, 149 /** Used for colors which would be color managed before display. */ 150 PROP_COLOR_GAMMA = 30, 151 /** Generic array, no units applied, only that x/y/z/w are used (Python vector). */ 152 PROP_COORDS = 31, 153 154 /* booleans */ 155 PROP_LAYER = 40, 156 PROP_LAYER_MEMBER = 41, 157 158 /** Light */ 159 PROP_POWER = 42 | PROP_UNIT_POWER, 160 161 /* temperature */ 162 PROP_TEMPERATURE = 43 | PROP_UNIT_TEMPERATURE, 163 } PropertySubType; 164 165 /* Make sure enums are updated with these */ 166 /* HIGHEST FLAG IN USE: 1 << 31 167 * FREE FLAGS: 2, 9, 11, 13, 14, 15, 30 */ 168 typedef enum PropertyFlag { 169 /** 170 * Editable means the property is editable in the user 171 * interface, properties are editable by default except 172 * for pointers and collections. 173 */ 174 PROP_EDITABLE = (1 << 0), 175 /** 176 * This property is editable even if it is lib linked, 177 * meaning it will get lost on reload, but it's useful 178 * for editing. 179 */ 180 PROP_LIB_EXCEPTION = (1 << 16), 181 /** 182 * Animatable means the property can be driven by some 183 * other input, be it animation curves, expressions, .. 184 * properties are animatable by default except for pointers 185 * and collections. 186 */ 187 PROP_ANIMATABLE = (1 << 1), 188 /** 189 * This flag means when the property's widget is in 'text-edit' mode, it will be updated 190 * after every typed char, instead of waiting final validation. Used e.g. for text search-box. 191 * It will also cause UI_BUT_VALUE_CLEAR to be set for text buttons. We could add an own flag 192 * for search/filter properties, but this works just fine for now. 193 */ 194 PROP_TEXTEDIT_UPDATE = (1u << 31), 195 196 /* icon */ 197 PROP_ICONS_CONSECUTIVE = (1 << 12), 198 PROP_ICONS_REVERSE = (1 << 8), 199 200 /** Hidden in the user interface. */ 201 PROP_HIDDEN = (1 << 19), 202 /** Do not write in presets. */ 203 PROP_SKIP_SAVE = (1 << 28), 204 205 /* numbers */ 206 207 /** Each value is related proportionally (object scale, image size). */ 208 PROP_PROPORTIONAL = (1 << 26), 209 210 /* pointers */ 211 PROP_ID_REFCOUNT = (1 << 6), 212 213 /** 214 * Disallow assigning a variable to its self, eg an object tracking its self 215 * only apply this to types that are derived from an ID (). 216 */ 217 PROP_ID_SELF_CHECK = (1 << 20), 218 /** 219 * Use for... 220 * - pointers: in the UI and python so unsetting or setting to None won't work. 221 * - strings: so our internal generated get/length/set 222 * functions know to do NULL checks before access T30865. 223 */ 224 PROP_NEVER_NULL = (1 << 18), 225 /** 226 * Currently only used for UI, this is similar to PROP_NEVER_NULL 227 * except that the value may be NULL at times, used for ObData, where an Empty's will be NULL 228 * but setting NULL on a mesh object is not possible. 229 * So, if its not NULL, setting NULL cant be done! 230 */ 231 PROP_NEVER_UNLINK = (1 << 25), 232 233 /** 234 * Pointers to data that is not owned by the struct. 235 * Typical example: Bone.parent, Bone.child, etc., and nearly all ID pointers. 236 * This is crucial information for processes that walk the whole data of an ID e.g. 237 * (like library override). 238 * Note that all ID pointers are enforced to this by default, 239 * this probably will need to be rechecked (see ugly infamous NodeTrees of mat/tex/scene/etc.). 240 */ 241 PROP_PTR_NO_OWNERSHIP = (1 << 7), 242 243 /** 244 * flag contains multiple enums. 245 * note: not to be confused with prop->enumbitflags 246 * this exposes the flag as multiple options in python and the UI. 247 * 248 * \note These can't be animated so use with care. 249 */ 250 PROP_ENUM_FLAG = (1 << 21), 251 252 /* need context for update function */ 253 PROP_CONTEXT_UPDATE = (1 << 22), 254 PROP_CONTEXT_PROPERTY_UPDATE = PROP_CONTEXT_UPDATE | (1 << 27), 255 256 /* registering */ 257 PROP_REGISTER = (1 << 4), 258 PROP_REGISTER_OPTIONAL = PROP_REGISTER | (1 << 5), 259 260 /** 261 * Use for allocated function return values of arrays or strings 262 * for any data that should not have a reference kept. 263 * 264 * It can be used for properties which are dynamically allocated too. 265 * 266 * \note Currently dynamic sized thick wrapped data isn't supported. 267 * This would be a useful addition and avoid a fixed maximum sized as in done at the moment. 268 */ 269 PROP_THICK_WRAP = (1 << 23), 270 271 /** This is an IDProperty, not a DNA one. */ 272 PROP_IDPROPERTY = (1 << 10), 273 /** For dynamic arrays, and retvals of type string. */ 274 PROP_DYNAMIC = (1 << 17), 275 /** For enum that shouldn't be contextual */ 276 PROP_ENUM_NO_CONTEXT = (1 << 24), 277 /** For enums not to be translated (e.g. viewlayers' names in nodes). */ 278 PROP_ENUM_NO_TRANSLATE = (1 << 29), 279 280 /** 281 * Don't do dependency graph tag from a property update callback. 282 * Use this for properties which defines interface state, for example, 283 * properties which denotes whether modifier panel is collapsed or not. 284 */ 285 PROP_NO_DEG_UPDATE = (1 << 30), 286 } PropertyFlag; 287 288 /** 289 * Flags related to comparing and overriding RNA properties. 290 * Make sure enums are updated with these. 291 * 292 * FREE FLAGS: 2, 3, 4, 5, 6, 7, 8, 9, 12 and above. 293 */ 294 typedef enum PropertyOverrideFlag { 295 /** Means the property can be overridden by a local 'proxy' of some linked datablock. */ 296 PROPOVERRIDE_OVERRIDABLE_LIBRARY = (1 << 0), 297 298 /** 299 * Forbid usage of this property in comparison (& hence override) code. 300 * Useful e.g. for collections of data like mesh's geometry, particles, etc. 301 * Also for runtime data that should never be considered as part of actual Blend data (e.g. 302 * depsgraph from ViewLayers...). 303 */ 304 PROPOVERRIDE_NO_COMPARISON = (1 << 1), 305 306 /** 307 * Means the property can be fully ignored by override process. 308 * Unlike NO_COMPARISON, it can still be used by diffing code, but no override operation will be 309 * created for it, and no attempt to restore the data from linked reference either. 310 * 311 * WARNING: This flag should be used with a lot of caution, as it completely by-passes override 312 * system. It is currently only used for ID's names, since we cannot prevent local override to 313 * get a different name from the linked reference, and ID names are 'rna name property' (i.e. are 314 * used in overrides of collections of IDs). See also `BKE_lib_override_library_update()` where 315 * we deal manually with the value of that property at DNA level. */ 316 PROPOVERRIDE_IGNORE = (1 << 2), 317 318 /*** Collections-related ***/ 319 320 /** The property supports insertion (collections only). */ 321 PROPOVERRIDE_LIBRARY_INSERTION = (1 << 10), 322 323 /** Only use indices to compare items in the property, never names (collections only). 324 * 325 * Useful when nameprop of the items is generated from other data 326 * (e.g. name of material slots is actually name of assigned material). 327 */ 328 PROPOVERRIDE_NO_PROP_NAME = (1 << 11), 329 } PropertyOverrideFlag; 330 331 /** 332 * Function parameters flags. 333 * \warning 16bits only. 334 */ 335 typedef enum ParameterFlag { 336 PARM_REQUIRED = (1 << 0), 337 PARM_OUTPUT = (1 << 1), 338 PARM_RNAPTR = (1 << 2), 339 /** 340 * This allows for non-breaking API updates, 341 * when adding non-critical new parameter to a callback function. 342 * This way, old py code defining funcs without that parameter would still work. 343 * WARNING: any parameter after the first PYFUNC_OPTIONAL one will be considered as optional! 344 * \note only for input parameters! 345 */ 346 PARM_PYFUNC_OPTIONAL = (1 << 3), 347 } ParameterFlag; 348 349 struct CollectionPropertyIterator; 350 struct Link; 351 typedef int (*IteratorSkipFunc)(struct CollectionPropertyIterator *iter, void *data); 352 353 typedef struct ListBaseIterator { 354 struct Link *link; 355 int flag; 356 IteratorSkipFunc skip; 357 } ListBaseIterator; 358 359 typedef struct ArrayIterator { 360 char *ptr; 361 /** Past the last valid pointer, only for comparisons, ignores skipped values. */ 362 char *endptr; 363 /** Will be freed if set. */ 364 void *free_ptr; 365 int itemsize; 366 367 /** 368 * Array length with no skip functions applied, 369 * take care not to compare against index from animsys or Python indices. 370 */ 371 int length; 372 373 /** 374 * Optional skip function, 375 * when set the array as viewed by rna can contain only a subset of the members. 376 * this changes indices so quick array index lookups are not possible when skip function is used. 377 */ 378 IteratorSkipFunc skip; 379 } ArrayIterator; 380 381 typedef struct CountIterator { 382 void *ptr; 383 int item; 384 } CountIterator; 385 386 typedef struct CollectionPropertyIterator { 387 /* internal */ 388 PointerRNA parent; 389 PointerRNA builtin_parent; 390 struct PropertyRNA *prop; 391 union { 392 ArrayIterator array; 393 ListBaseIterator listbase; 394 CountIterator count; 395 void *custom; 396 } internal; 397 int idprop; 398 int level; 399 400 /* external */ 401 PointerRNA ptr; 402 int valid; 403 } CollectionPropertyIterator; 404 405 typedef struct CollectionPointerLink { 406 struct CollectionPointerLink *next, *prev; 407 PointerRNA ptr; 408 } CollectionPointerLink; 409 410 /** Copy of ListBase for RNA. */ 411 typedef struct CollectionListBase { 412 struct CollectionPointerLink *first, *last; 413 } CollectionListBase; 414 415 typedef enum RawPropertyType { 416 PROP_RAW_UNSET = -1, 417 PROP_RAW_INT, /* XXX - abused for types that are not set, eg. MFace.verts, needs fixing. */ 418 PROP_RAW_SHORT, 419 PROP_RAW_CHAR, 420 PROP_RAW_BOOLEAN, 421 PROP_RAW_DOUBLE, 422 PROP_RAW_FLOAT, 423 } RawPropertyType; 424 425 typedef struct RawArray { 426 void *array; 427 RawPropertyType type; 428 int len; 429 int stride; 430 } RawArray; 431 432 /** 433 * This struct is are typically defined in arrays which define an *enum* for RNA, 434 * which is used by the RNA API both for user-interface and the Python API. 435 */ 436 typedef struct EnumPropertyItem { 437 /** The internal value of the enum, not exposed to users. */ 438 int value; 439 /** 440 * Note that identifiers must be unique within the array, 441 * by convention they're upper case with underscores for separators. 442 * - An empty string is used to define menu separators. 443 * - NULL denotes the end of the array of items. 444 */ 445 const char *identifier; 446 /** Optional icon, typically 'ICON_NONE' */ 447 int icon; 448 /** Name displayed in the interface. */ 449 const char *name; 450 /** Longer description used in the interface. */ 451 const char *description; 452 } EnumPropertyItem; 453 454 /* extended versions with PropertyRNA argument */ 455 typedef bool (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); 456 typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, 457 struct PropertyRNA *prop, 458 bool value); 459 typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, 460 struct PropertyRNA *prop, 461 bool *values); 462 typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, 463 struct PropertyRNA *prop, 464 const bool *values); 465 typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); 466 typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); 467 typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, 468 struct PropertyRNA *prop, 469 int *values); 470 typedef void (*IntArrayPropertySetFunc)(struct PointerRNA *ptr, 471 struct PropertyRNA *prop, 472 const int *values); 473 typedef void (*IntPropertyRangeFunc)(struct PointerRNA *ptr, 474 struct PropertyRNA *prop, 475 int *min, 476 int *max, 477 int *softmin, 478 int *softmax); 479 typedef float (*FloatPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); 480 typedef void (*FloatPropertySetFunc)(struct PointerRNA *ptr, 481 struct PropertyRNA *prop, 482 float value); 483 typedef void (*FloatArrayPropertyGetFunc)(struct PointerRNA *ptr, 484 struct PropertyRNA *prop, 485 float *values); 486 typedef void (*FloatArrayPropertySetFunc)(struct PointerRNA *ptr, 487 struct PropertyRNA *prop, 488 const float *values); 489 typedef void (*FloatPropertyRangeFunc)(struct PointerRNA *ptr, 490 struct PropertyRNA *prop, 491 float *min, 492 float *max, 493 float *softmin, 494 float *softmax); 495 typedef void (*StringPropertyGetFunc)(struct PointerRNA *ptr, 496 struct PropertyRNA *prop, 497 char *value); 498 typedef int (*StringPropertyLengthFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); 499 typedef void (*StringPropertySetFunc)(struct PointerRNA *ptr, 500 struct PropertyRNA *prop, 501 const char *value); 502 typedef int (*EnumPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); 503 typedef void (*EnumPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); 504 /* same as PropEnumItemFunc */ 505 typedef const EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, 506 PointerRNA *ptr, 507 struct PropertyRNA *prop, 508 bool *r_free); 509 510 typedef struct PropertyRNA PropertyRNA; 511 512 /* Parameter List */ 513 514 typedef struct ParameterList { 515 /** Storage for parameters*. */ 516 void *data; 517 518 /** Function passed at creation time. */ 519 struct FunctionRNA *func; 520 521 /** Store the parameter size. */ 522 int alloc_size; 523 524 int arg_count, ret_count; 525 } ParameterList; 526 527 typedef struct ParameterIterator { 528 struct ParameterList *parms; 529 /* PointerRNA funcptr; */ /*UNUSED*/ 530 void *data; 531 int size, offset; 532 533 PropertyRNA *parm; 534 int valid; 535 } ParameterIterator; 536 537 /** Mainly to avoid confusing casts. */ 538 typedef struct ParameterDynAlloc { 539 /** Important, this breaks when set to an int. */ 540 intptr_t array_tot; 541 void *array; 542 } ParameterDynAlloc; 543 544 /* Function */ 545 546 /** 547 * Options affecting callback signature. 548 * 549 * Those add additional parameters at the beginning of the C callback, like that: 550 * <pre> 551 * rna_my_func([ID *_selfid], 552 * [<DNA_STRUCT> *self|StructRNA *type], 553 * [Main *bmain], 554 * [bContext *C], 555 * [ReportList *reports], 556 * <other RNA-defined parameters>); 557 * </pre> 558 */ 559 typedef enum FunctionFlag { 560 /** 561 * Pass ID owning 'self' data 562 * (i.e. ptr->owner_id, might be same as self in case data is an ID...). 563 */ 564 FUNC_USE_SELF_ID = (1 << 11), 565 566 /** 567 * Do not pass the object (DNA struct pointer) from which it is called, 568 * used to define static or class functions. 569 */ 570 FUNC_NO_SELF = (1 << 0), 571 /** Pass RNA type, used to define class functions, only valid when #FUNC_NO_SELF is set. */ 572 FUNC_USE_SELF_TYPE = (1 << 1), 573 574 /* Pass Main, bContext and/or ReportList. */ 575 FUNC_USE_MAIN = (1 << 2), 576 FUNC_USE_CONTEXT = (1 << 3), 577 FUNC_USE_REPORTS = (1 << 4), 578 579 /***** Registering of Python subclasses. *****/ 580 /** 581 * This function is part of the registerable class' interface, 582 * and can be implemented/redefined in Python. 583 */ 584 FUNC_REGISTER = (1 << 5), 585 /** Subclasses can choose not to implement this function. */ 586 FUNC_REGISTER_OPTIONAL = FUNC_REGISTER | (1 << 6), 587 /** 588 * If not set, the Python function implementing this call 589 * is not allowed to write into data-blocks. 590 * Except for WindowManager and Screen currently, see rna_id_write_error() in bpy_rna.c 591 */ 592 FUNC_ALLOW_WRITE = (1 << 12), 593 594 /***** Internal flags. *****/ 595 /** UNUSED CURRENTLY? ??? */ 596 FUNC_BUILTIN = (1 << 7), 597 /** UNUSED CURRENTLY. ??? */ 598 FUNC_EXPORT = (1 << 8), 599 /** Function has been defined at runtime, not statically in RNA source code. */ 600 FUNC_RUNTIME = (1 << 9), 601 /** 602 * UNUSED CURRENTLY? Function owns its identifier and description strings, 603 * and has to free them when deleted. 604 */ 605 FUNC_FREE_POINTERS = (1 << 10), 606 } FunctionFlag; 607 608 typedef void (*CallFunc)(struct bContext *C, 609 struct ReportList *reports, 610 PointerRNA *ptr, 611 ParameterList *parms); 612 613 typedef struct FunctionRNA FunctionRNA; 614 615 /* Struct */ 616 617 typedef enum StructFlag { 618 /** Indicates that this struct is an ID struct, and to use reference-counting. */ 619 STRUCT_ID = (1 << 0), 620 STRUCT_ID_REFCOUNT = (1 << 1), 621 /** defaults on, clear for user preferences and similar */ 622 STRUCT_UNDO = (1 << 2), 623 624 /* internal flags */ 625 STRUCT_RUNTIME = (1 << 3), 626 /* STRUCT_GENERATED = (1 << 4), */ /* UNUSED */ 627 STRUCT_FREE_POINTERS = (1 << 5), 628 /** Menus and Panels don't need properties */ 629 STRUCT_NO_IDPROPERTIES = (1 << 6), 630 /** e.g. for Operator */ 631 STRUCT_NO_DATABLOCK_IDPROPERTIES = (1 << 7), 632 /** for PropertyGroup which contains pointers to datablocks */ 633 STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES = (1 << 8), 634 /** Added to type-map #BlenderRNA.structs_map */ 635 STRUCT_PUBLIC_NAMESPACE = (1 << 9), 636 /** All subtypes are added too. */ 637 STRUCT_PUBLIC_NAMESPACE_INHERIT = (1 << 10), 638 } StructFlag; 639 640 typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function); 641 typedef int (*StructCallbackFunc)(struct bContext *C, 642 struct PointerRNA *ptr, 643 struct FunctionRNA *func, 644 ParameterList *list); 645 typedef void (*StructFreeFunc)(void *data); 646 typedef struct StructRNA *(*StructRegisterFunc)(struct Main *bmain, 647 struct ReportList *reports, 648 void *data, 649 const char *identifier, 650 StructValidateFunc validate, 651 StructCallbackFunc call, 652 StructFreeFunc free); 653 654 typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type); 655 typedef void **(*StructInstanceFunc)(PointerRNA *ptr); 656 657 typedef struct StructRNA StructRNA; 658 659 /** 660 * Blender RNA 661 * 662 * Root RNA data structure that lists all struct types. 663 */ 664 typedef struct BlenderRNA BlenderRNA; 665 666 /** 667 * Extending 668 * 669 * This struct must be embedded in *Type structs in 670 * order to make them definable through RNA. 671 */ 672 typedef struct ExtensionRNA { 673 void *data; 674 StructRNA *srna; 675 StructCallbackFunc call; 676 StructFreeFunc free; 677 } ExtensionRNA; 678 679 #ifdef __cplusplus 680 } 681 #endif 682 683 #endif /* __RNA_TYPES_H__ */ 684