Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesdna/DNA_ID.h
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
| /*->flag*/ | /*->flag*/ | ||||
| enum { | enum { | ||||
| IDP_FLAG_GHOST = 1 << 7, /* this means the property is set but RNA will return false when checking | IDP_FLAG_GHOST = 1 << 7, /* this means the property is set but RNA will return false when checking | ||||
| * 'RNA_property_is_set', currently this is a runtime flag */ | * 'RNA_property_is_set', currently this is a runtime flag */ | ||||
| }; | }; | ||||
| /* add any future new id property types here.*/ | /* add any future new id property types here.*/ | ||||
| /* Static ID override structs. */ | |||||
| typedef struct IDOverrideStaticPropertyOperation { | |||||
| struct IDOverrideStaticPropertyOperation *next, *prev; | |||||
| /* Type of override. */ | |||||
| short operation; | |||||
| short flag; | |||||
| short pad_s1[2]; | |||||
| /* Sub-item references, if needed (for arrays or collections only). | |||||
| * We need both reference and local values to allow e.g. insertion into collections (constraints, modifiers...). | |||||
| * In collection case, if names are defined, they are used in priority. | |||||
| * Names are pointers (instead of char[64]) to save some space, NULL when unset. | |||||
| * Indices are -1 when unset. */ | |||||
| char *subitem_reference_name; | |||||
| char *subitem_local_name; | |||||
| int subitem_reference_index; | |||||
| int subitem_local_index; | |||||
| } IDOverrideStaticPropertyOperation; | |||||
| /* IDOverridePropertyOperation->operation. */ | |||||
| enum { | |||||
| /* Basic operations. */ | |||||
| IDOVERRIDESTATIC_OP_NOOP = 0, /* Special value, forbids any overriding. */ | |||||
| IDOVERRIDESTATIC_OP_REPLACE = 1, /* Fully replace local value by reference one. */ | |||||
| /* Numeric-only operations. */ | |||||
| IDOVERRIDESTATIC_OP_ADD = 101, /* Add local value to reference one. */ | |||||
| /* Subtract local value from reference one (needed due to unsigned values etc.). */ | |||||
| IDOVERRIDESTATIC_OP_SUBTRACT = 102, | |||||
| /* Multiply reference value by local one (more useful than diff for scales and the like). */ | |||||
| IDOVERRIDESTATIC_OP_MULTIPLY = 103, | |||||
| /* Collection-only operations. */ | |||||
| IDOVERRIDESTATIC_OP_INSERT_AFTER = 201, /* Insert after given reference's subitem. */ | |||||
| IDOVERRIDESTATIC_OP_INSERT_BEFORE = 202, /* Insert before given reference's subitem. */ | |||||
| /* We can add more if needed (move, delete, ...). */ | |||||
| }; | |||||
| /* IDOverridePropertyOperation->flag. */ | |||||
| enum { | |||||
| IDOVERRIDESTATIC_FLAG_MANDATORY = 1 << 0, /* User cannot remove that override operation. */ | |||||
| IDOVERRIDESTATIC_FLAG_LOCKED = 1 << 1, /* User cannot change that override operation. */ | |||||
| }; | |||||
| /* A single overriden property, contain all operations on this one. */ | |||||
| typedef struct IDOverrideStaticProperty { | |||||
| struct IDOverrideStaticProperty *next, *prev; | |||||
| /* Path from ID to overridden property. *Does not* include indices/names for final arrays/collections items. */ | |||||
| char *rna_path; | |||||
| ListBase operations; /* List of overriding operations (IDOverridePropertyOperation) applied to this property. */ | |||||
| } IDOverrideStaticProperty; | |||||
| /* Main container for all overriding data info of a data-block. */ | |||||
| typedef struct IDOverrideStatic { | |||||
| struct ID *reference; /* Reference linked ID which this one overrides. */ | |||||
| ListBase properties; /* List of IDOverrideProperty structs. */ | |||||
| /* Read/write data. */ | |||||
| /* Temp ID storing extra override data (used for differential operations only currently). | |||||
| * Always NULL outside of read/write context. */ | |||||
| struct ID *storage; | |||||
| } IDOverrideStatic; | |||||
| /* watch it: Sequence has identical beginning. */ | /* watch it: Sequence has identical beginning. */ | ||||
| /** | /** | ||||
| * ID is the first thing included in all serializable types. It | * ID is the first thing included in all serializable types. It | ||||
| * provides a common handle to place all data in double-linked lists. | * provides a common handle to place all data in double-linked lists. | ||||
| * */ | * */ | ||||
| /* 2 characters for ID code and 64 for actual name */ | /* 2 characters for ID code and 64 for actual name */ | ||||
| #define MAX_ID_NAME 66 | #define MAX_ID_NAME 66 | ||||
| Show All 11 Lines | typedef struct ID { | ||||
| short flag; | short flag; | ||||
| /** | /** | ||||
| * LIB_TAG_... tags (runtime only, cleared at read time). | * LIB_TAG_... tags (runtime only, cleared at read time). | ||||
| */ | */ | ||||
| int tag; | int tag; | ||||
| int us; | int us; | ||||
| int icon_id; | int icon_id; | ||||
| IDProperty *properties; | IDProperty *properties; | ||||
| IDOverrideStatic *override_static; /* Reference linked ID which this one overrides. */ | |||||
| void *py_instance; | void *py_instance; | ||||
| void *pad1; | |||||
| } ID; | } ID; | ||||
| /** | /** | ||||
| * For each library file used, a Library struct is added to Main | * For each library file used, a Library struct is added to Main | ||||
| * WARNING: readfile.c, expand_doit() reads this struct without DNA check! | * WARNING: readfile.c, expand_doit() reads this struct without DNA check! | ||||
| */ | */ | ||||
| typedef struct Library { | typedef struct Library { | ||||
| ID id; | ID id; | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
| #define GS(a) (CHECK_TYPE_ANY(a, char *, const char *, char [66], const char[66]), (ID_Type)(*((const short *)(a)))) | #define GS(a) (CHECK_TYPE_ANY(a, char *, const char *, char [66], const char[66]), (ID_Type)(*((const short *)(a)))) | ||||
| #define ID_NEW_SET(_id, _idn) \ | #define ID_NEW_SET(_id, _idn) \ | ||||
| (((ID *)(_id))->newid = (ID *)(_idn), ((ID *)(_id))->newid->tag |= LIB_TAG_NEW, (void *)((ID *)(_id))->newid) | (((ID *)(_id))->newid = (ID *)(_idn), ((ID *)(_id))->newid->tag |= LIB_TAG_NEW, (void *)((ID *)(_id))->newid) | ||||
| #define ID_NEW_REMAP(a) if ((a) && (a)->id.newid) (a) = (void *)(a)->id.newid | #define ID_NEW_REMAP(a) if ((a) && (a)->id.newid) (a) = (void *)(a)->id.newid | ||||
| /* id->flag (persitent). */ | /* id->flag (persitent). */ | ||||
| enum { | enum { | ||||
| LIB_OVERRIDE_STATIC_AUTO = 1 << 0, /* Allow automatic generation of overriding rules. */ | |||||
| LIB_FAKEUSER = 1 << 9, | LIB_FAKEUSER = 1 << 9, | ||||
| }; | }; | ||||
| /** | /** | ||||
| * id->tag (runtime-only). | * id->tag (runtime-only). | ||||
| * | * | ||||
| * Those flags belong to three different categories, which have different expected handling in code: | * Those flags belong to three different categories, which have different expected handling in code: | ||||
| * | * | ||||
| * - RESET_BEFORE_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' first. | * - RESET_BEFORE_USE: piece of code that wants to use such flag has to ensure they are properly 'reset' first. | ||||
| Show All 18 Lines | enum { | ||||
| /* RESET_AFTER_USE Flag used internally in readfile.c, to mark IDs needing to be linked from a library. */ | /* RESET_AFTER_USE Flag used internally in readfile.c, to mark IDs needing to be linked from a library. */ | ||||
| LIB_TAG_READ = 1 << 4, | LIB_TAG_READ = 1 << 4, | ||||
| /* RESET_AFTER_USE */ | /* RESET_AFTER_USE */ | ||||
| LIB_TAG_NEED_LINK = 1 << 5, | LIB_TAG_NEED_LINK = 1 << 5, | ||||
| /* RESET_NEVER tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */ | /* RESET_NEVER tag datablock as a place-holder (because the real one could not be linked from its library e.g.). */ | ||||
| LIB_TAG_MISSING = 1 << 6, | LIB_TAG_MISSING = 1 << 6, | ||||
| /* RESET_NEVER tag datablock as being up-to-date regarding its reference. */ | |||||
| LIB_TAG_OVERRIDESTATIC_OK = 1 << 9, | |||||
| /* tag datablock has having an extra user. */ | /* tag datablock has having an extra user. */ | ||||
| LIB_TAG_EXTRAUSER = 1 << 2, | LIB_TAG_EXTRAUSER = 1 << 2, | ||||
| /* tag datablock has having actually increased usercount for the extra virtual user. */ | /* tag datablock has having actually increased usercount for the extra virtual user. */ | ||||
| LIB_TAG_EXTRAUSER_SET = 1 << 7, | LIB_TAG_EXTRAUSER_SET = 1 << 7, | ||||
| /* RESET_AFTER_USE tag newly duplicated/copied IDs. | /* RESET_AFTER_USE tag newly duplicated/copied IDs. | ||||
| * Also used internally in readfile.c to mark datablocks needing do_versions. */ | * Also used internally in readfile.c to mark datablocks needing do_versions. */ | ||||
| LIB_TAG_NEW = 1 << 8, | LIB_TAG_NEW = 1 << 8, | ||||
| ▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines | |||||