|
Blender V4.5
|
ID and Library types, which are fundamental for SDNA. More...
#include "DNA_ID_enums.h"#include "DNA_defs.h"#include "DNA_listBase.h"#include "BLI_assert.h"#include "BLI_compiler_typecheck.h"Go to the source code of this file.
Classes | |
| struct | IDPropertyUIData |
| struct | IDPropertyUIDataEnumItem |
| struct | IDPropertyUIDataInt |
| struct | IDPropertyUIDataBool |
| struct | IDPropertyUIDataFloat |
| struct | IDPropertyUIDataString |
| struct | IDPropertyUIDataID |
| struct | IDPropertyData |
| struct | IDProperty |
| struct | IDOverrideLibraryPropertyOperation |
| struct | IDOverrideLibraryProperty |
| struct | IDOverrideLibraryRuntime |
| struct | IDOverrideLibrary |
| struct | ID_Runtime_Remap |
| struct | ID_Runtime |
| struct | ID |
| struct | Library |
| struct | LibraryWeakReference |
| struct | PreviewImage |
Macros | |
| #define | MAX_IDPROP_NAME 64 |
| #define | DEFAULT_ALLOC_FOR_NULL_STRINGS 64 |
| #define | MAX_ID_NAME 66 |
| #define | ID_FAKE_USERS(id) |
| #define | ID_EXTRA_USERS(id) |
| #define | ID_EXTRA_REAL_USERS(id) |
| #define | ID_REAL_USERS(id) |
| #define | ID_REFCOUNTING_USERS(id) |
| #define | ID_CHECK_UNDO(id) |
| #define | ID_BLEND_PATH(_bmain, _id) |
| #define | ID_BLEND_PATH_FROM_GLOBAL(_id) |
| #define | ID_MISSING(_id) |
| #define | ID_IS_LINKED(_id) |
| #define | ID_TYPE_SUPPORTS_ASSET_EDITABLE(id_type) |
| #define | ID_IS_EDITABLE(_id) |
| #define | ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY(_id) |
| #define | ID_IS_OVERRIDABLE_LIBRARY(_id) |
| #define | ID_IS_OVERRIDE_LIBRARY_REAL(_id) |
| #define | ID_IS_OVERRIDE_LIBRARY_VIRTUAL(_id) |
| #define | ID_IS_OVERRIDE_LIBRARY(_id) |
| #define | ID_IS_OVERRIDE_LIBRARY_HIERARCHY_ROOT(_id) |
| #define | ID_IS_ASSET(_id) |
| #define | ID_TYPE_USE_COPY_ON_EVAL(_id_type) |
| #define | ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(id_type) |
| #define | ID_TYPE_IS_DEPRECATED(id_type) |
| #define | GS(a) |
| #define | ID_NEW_SET(_id, _idn) |
| #define | ID_NEW_REMAP(a) |
| #define | ID_TAG_KEEP_ON_UNDO (ID_TAG_EXTRAUSER | ID_TAG_MISSING | ID_TAG_RUNTIME) |
| #define | FILTER_ID_AC (1ULL << 0) |
| #define | FILTER_ID_AR (1ULL << 1) |
| #define | FILTER_ID_BR (1ULL << 2) |
| #define | FILTER_ID_CA (1ULL << 3) |
| #define | FILTER_ID_CU_LEGACY (1ULL << 4) |
| #define | FILTER_ID_GD_LEGACY (1ULL << 5) |
| #define | FILTER_ID_GR (1ULL << 6) |
| #define | FILTER_ID_IM (1ULL << 7) |
| #define | FILTER_ID_LA (1ULL << 8) |
| #define | FILTER_ID_LS (1ULL << 9) |
| #define | FILTER_ID_LT (1ULL << 10) |
| #define | FILTER_ID_MA (1ULL << 11) |
| #define | FILTER_ID_MB (1ULL << 12) |
| #define | FILTER_ID_MC (1ULL << 13) |
| #define | FILTER_ID_ME (1ULL << 14) |
| #define | FILTER_ID_MSK (1ULL << 15) |
| #define | FILTER_ID_NT (1ULL << 16) |
| #define | FILTER_ID_OB (1ULL << 17) |
| #define | FILTER_ID_PAL (1ULL << 18) |
| #define | FILTER_ID_PC (1ULL << 19) |
| #define | FILTER_ID_SCE (1ULL << 20) |
| #define | FILTER_ID_SPK (1ULL << 21) |
| #define | FILTER_ID_SO (1ULL << 22) |
| #define | FILTER_ID_TE (1ULL << 23) |
| #define | FILTER_ID_TXT (1ULL << 24) |
| #define | FILTER_ID_VF (1ULL << 25) |
| #define | FILTER_ID_WO (1ULL << 26) |
| #define | FILTER_ID_PA (1ULL << 27) |
| #define | FILTER_ID_CF (1ULL << 28) |
| #define | FILTER_ID_WS (1ULL << 29) |
| #define | FILTER_ID_LP (1ULL << 31) |
| #define | FILTER_ID_CV (1ULL << 32) |
| #define | FILTER_ID_PT (1ULL << 33) |
| #define | FILTER_ID_VO (1ULL << 34) |
| #define | FILTER_ID_SIM (1ULL << 35) |
| #define | FILTER_ID_KE (1ULL << 36) |
| #define | FILTER_ID_SCR (1ULL << 37) |
| #define | FILTER_ID_WM (1ULL << 38) |
| #define | FILTER_ID_LI (1ULL << 39) |
| #define | FILTER_ID_GP (1ULL << 40) |
| #define | FILTER_ID_IP (1ULL << 41) |
| #define | FILTER_ID_ALL |
| #define | INDEX_ID_MAX (INDEX_ID_NULL + 1) |
| #define FILTER_ID_ALL |
| #define GS | ( | a | ) |
| #define ID_BLEND_PATH | ( | _bmain, | |
| _id ) |
| #define ID_BLEND_PATH_FROM_GLOBAL | ( | _id | ) |
| #define ID_CHECK_UNDO | ( | id | ) |
| #define ID_EXTRA_REAL_USERS | ( | id | ) |
Amount of real 'extra' shallow, runtime-only usages of this ID (typically from UI). Always 0 or 1.
| #define ID_EXTRA_USERS | ( | id | ) |
Amount of defined 'extra' shallow, runtime-only usages of this ID (typically from UI). Always 0 or 1.
| #define ID_FAKE_USERS | ( | id | ) |
Amount of 'fake user' usages of this ID. Always 0 or 1.
| #define ID_IS_ASSET | ( | _id | ) |
| #define ID_IS_EDITABLE | ( | _id | ) |
| #define ID_IS_LINKED | ( | _id | ) |
| #define ID_IS_OVERRIDABLE_LIBRARY | ( | _id | ) |
| #define ID_IS_OVERRIDABLE_LIBRARY_HIERARCHY | ( | _id | ) |
| #define ID_IS_OVERRIDE_LIBRARY | ( | _id | ) |
| #define ID_IS_OVERRIDE_LIBRARY_HIERARCHY_ROOT | ( | _id | ) |
| #define ID_IS_OVERRIDE_LIBRARY_REAL | ( | _id | ) |
| #define ID_IS_OVERRIDE_LIBRARY_VIRTUAL | ( | _id | ) |
| #define ID_MISSING | ( | _id | ) |
| #define ID_NEW_REMAP | ( | a | ) |
| #define ID_NEW_SET | ( | _id, | |
| _idn ) |
| #define ID_REAL_USERS | ( | id | ) |
Amount of real usages of this ID (i.e. excluding the 'fake user' one, but including a potential 'extra' shallow/runtime usage).
| #define ID_REFCOUNTING_USERS | ( | id | ) |
Amount of 'normal' reference-counting usages of this ID (i.e. excluding the 'fake user' one, and a potential 'extra' shallow/runtime usage).
| #define ID_TAG_KEEP_ON_UNDO (ID_TAG_EXTRAUSER | ID_TAG_MISSING | ID_TAG_RUNTIME) |
Most of ID tags are cleared on file write (i.e. also when storing undo steps), since they either have of very short lifetime (not expected to exist across undo steps), or are info that will be re-generated when reading undo steps.
However a few of these need to be explicitly preserved across undo steps.
| #define ID_TYPE_IS_DEPRECATED | ( | id_type | ) |
| #define ID_TYPE_SUPPORTS_ASSET_EDITABLE | ( | id_type | ) |
| #define ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW | ( | id_type | ) |
| #define ID_TYPE_USE_COPY_ON_EVAL | ( | _id_type | ) |
| #define INDEX_ID_MAX (INDEX_ID_NULL + 1) |
| #define MAX_ID_NAME 66 |
This enum defines the index assigned to each type of IDs in the array returned by BKE_main_lists_get, and by extension, controls the default order in which each ID type is processed during standard 'foreach' looping over all IDs of a Main data-base.
This is (loosely) defined with a relationship order in mind, from lowest level (ID types using, referencing almost no other ID types) to highest level (ID types potentially using many other ID types).
So e.g. it ensures that this dependency chain is respected: Material <- Mesh <- Object <- Collection <- Scene
Default order of processing of IDs in 'foreach' macros (FOREACH_MAIN_ID_BEGIN and the like), built on top of BKE_main_lists_get, is actually reversed compared to the order defined here, since processing usually needs to happen on users before it happens on used IDs (when freeing e.g.).
DO NOT rely on this order as being full-proofed dependency order, there are many cases were it can be violated (most obvious cases being custom properties and drivers, which can reference any other ID types).
However, this order can be considered as an optimization heuristic, especially when processing relationships in a non-recursive pattern: in typical cases, a vast majority of those relationships can be processed fine in the first pass, and only few additional passes are required to address all remaining relationship cases. See e.g. how BKE_library_unused_linked_data_set_tag is doing this.
| typedef struct ID ID |
| typedef struct ID_Runtime ID_Runtime |
| typedef struct ID_Runtime_Remap ID_Runtime_Remap |
Status used and counters created during id-remapping.
| typedef struct IDOverrideLibrary IDOverrideLibrary |
| typedef struct IDOverrideLibraryProperty IDOverrideLibraryProperty |
A single overridden property, contain all operations on this one.
| typedef struct IDOverrideLibraryPropertyOperation IDOverrideLibraryPropertyOperation |
| typedef struct IDOverrideLibraryRuntime IDOverrideLibraryRuntime |
| typedef struct IDProperty IDProperty |
| typedef struct IDPropertyData IDPropertyData |
| typedef struct IDPropertyUIData IDPropertyUIData |
| typedef struct IDPropertyUIDataBool IDPropertyUIDataBool |
For IDP_UI_DATA_TYPE_BOOLEAN Use int8_t because DNA does not support bool.
| typedef struct IDPropertyUIDataEnumItem IDPropertyUIDataEnumItem |
| typedef struct IDPropertyUIDataFloat IDPropertyUIDataFloat |
| typedef struct IDPropertyUIDataID IDPropertyUIDataID |
For IDP_UI_DATA_TYPE_ID.
| typedef struct IDPropertyUIDataInt IDPropertyUIDataInt |
| typedef struct IDPropertyUIDataString IDPropertyUIDataString |
| typedef struct LibraryWeakReference LibraryWeakReference |
A weak library/ID reference for local data that has been appended, to allow re-using that local data instead of creating a new copy of it in future appends.
NOTE: This is by design a week reference, in other words code should be totally fine and perform a regular append if it cannot find a valid matching local ID.
NOTE: There should always be only one single ID in current Main matching a given linked reference.
| typedef struct PreviewImage PreviewImage |
This type allows shallow copies. Use BKE_previewimg_free() to release contained resources. Don't call this for shallow copies (or the original instance will have dangling pointers).
| anonymous enum |
| anonymous enum |
| anonymous enum |
| Enumerator | |
|---|---|
| LIBOVERRIDE_FLAG_NO_HIERARCHY | The override data-block should not be considered as part of an override hierarchy (generally because it was created as an single override, outside of any hierarchy consideration). |
| LIBOVERRIDE_FLAG_SYSTEM_DEFINED | The override ID is required for the system to work (because of ID dependencies), but is not seen as editable by the user. |
| anonymous enum |
id->flag (persistent).
| Enumerator | |
|---|---|
| ID_FLAG_FAKEUSER | Don't delete the data-block even if unused. |
| ID_FLAG_EMBEDDED_DATA | The data-block is a sub-data of another one. Direct persistent references are not allowed. |
| ID_FLAG_INDIRECT_WEAK_LINK | Data-block is from a library and linked indirectly, with ID_TAG_INDIRECT tag set. But the current .blend file also has a weak pointer to it that we want to restore if possible, and silently drop if it's missing. |
| ID_FLAG_EMBEDDED_DATA_LIB_OVERRIDE | The data-block is a sub-data of another one, which is an override. Note that this also applies to shape-keys, even though they are not 100% embedded data. |
| ID_FLAG_LIB_OVERRIDE_RESYNC_LEFTOVER | The override data-block appears to not be needed anymore after resync with linked data, but it was kept around (because e.g. detected as user-edited). |
| ID_FLAG_CLIPBOARD_MARK | This id was explicitly copied as part of a clipboard copy operation. When reading the clipboard back, this can be used to check which ID's are intended to be part of the clipboard, compared with ID's that were indirectly referenced. While the flag is typically cleared, a saved file may have this set for some data-blocks, so it must be treated as dirty. |
| anonymous enum |
| anonymous enum |
| Enumerator | |
|---|---|
| LIBOVERRIDE_OP_FLAG_MANDATORY | User cannot remove that override operation. |
| LIBOVERRIDE_OP_FLAG_LOCKED | User cannot change that override operation. |
| LIBOVERRIDE_OP_FLAG_IDPOINTER_MATCH_REFERENCE | For overrides of ID pointers: this override still matches (follows) the hierarchy of the reference linked data. |
| LIBOVERRIDE_OP_FLAG_IDPOINTER_ITEM_USE_ID | For overrides of ID pointers within RNA collections: this override is using the ID pointer in addition to the item name (to fully disambiguate the reference, since IDs from different libraries can have a same name). |
| anonymous enum |
| anonymous enum |
id->tag (runtime-only).
Those tags belong to three different categories, which have different expected handling in code:
| Enumerator | |
|---|---|
| ID_TAG_LOCAL | Long-life tags giving important info about general ID management. These tags are typically not changed often, if ever, during an ID's life. ID is from current .blend file. RESET_NEVER |
| ID_TAG_EXTERN | ID is from a library, but is used (linked) directly by current .blend file. RESET_NEVER |
| ID_TAG_INDIRECT | ID is from a library, and is only used (linked) indirectly through other libraries. RESET_NEVER |
| ID_TAG_RUNTIME | ID is considered as runtime, and should not be saved when writing .blend file, nor influence (in)direct status of linked data. Only meaningful for IDs belonging to regular Main database, all other cases are implicitly considered runtime-only. RESET_NEVER |
| ID_TAG_MISSING | ID is a place-holder, an 'empty shell' (because the real one could not be linked from its library e.g.). RESET_NEVER |
| ID_TAG_EXTRAUSER | ID has an extra virtual user (aka 'ensured real', as set by e.g. some editors, not to be confused with the ID_FLAG_FAKEUSER flag). RESET_NEVER
|
| ID_TAG_EXTRAUSER_SET | ID actually has increased user-count for the extra virtual user. RESET_NEVER |
| ID_TAG_LIBOVERRIDE_REFOK | ID is up-to-date regarding its reference (only for library overrides). RESET_NEVER |
| ID_TAG_LIBOVERRIDE_AUTOREFRESH | ID needs an auto-diffing execution, if enabled (only for library overrides). RESET_NEVER |
| ID_TAG_LIBOVERRIDE_NEED_RESYNC | ID is a library override that needs re-sync to its linked reference.
RESET_NEVER |
| ID_TAG_NEW | Short-life tags used during specific processes, like blend-file reading. ID is newly duplicated/copied (see ID_NEW_SET macro above). RESET_AFTER_USE
|
| ID_TAG_PRE_EXISTING | ID is already existing. Set before linking, to distinguish between existing data-blocks and newly linked ones. RESET_AFTER_USE |
| ID_TAG_UNDO_OLD_ID_REUSED_UNCHANGED | ID is being re-used from the old Main (instead of read from memfile), during memfile undo processing, because it was detected as unchanged.
RESET_AFTER_USE |
| ID_TAG_UNDO_OLD_ID_REUSED_NOUNDO | ID is being re-used from the old Main (instead of read from memfile), during memfile undo processing, because it is a 'NO_UNDO' type of ID.
RESET_AFTER_USE |
| ID_TAG_UNDO_OLD_ID_REREAD_IN_PLACE | ID has be re-read in-place, the ID address is the same as in the old main, but the content is different. RESET_AFTER_USE |
| ID_TAG_TEMP_MAIN | Tags for special kind of IDs, not living in regular BMain data-base. IDs with such tags have typically a short life. ID is part of a temporary Main which is expected to be freed in a short time-frame. RESET_NEVER Don't allow assigning this to non-temporary members (since it's likely to cause errors). When set ID.session_uid isn't initialized, since the data isn't part of the session. |
| ID_TAG_NO_MAIN | General ID management info, for freeing or copying behavior e.g. ID is not listed/stored in any Main database. RESET_NEVER |
| ID_TAG_LOCALIZED | ID is fully outside of any ID management area, and should be considered as a purely independent data. RESET_NEVER
|
| ID_TAG_COPIED_ON_EVAL | ID is an evaluated/localized version. RESET_NEVER
|
| ID_TAG_COPIED_ON_EVAL_FINAL_RESULT | ID is not the original evaluated ID created by the depsgraph, but has been re-allocated during the evaluation process of another ID. RESET_NEVER Typical example is object data, when evaluating the object's modifier stack the final obdata can be different than the evaluated initial obdata ID. |
| ID_TAG_NO_USER_REFCOUNT | ID management status tags related to non-standard BMain IDs. Datablock does not refcount usages of other IDs. RESET_NEVER |
| ID_TAG_NOT_ALLOCATED | ID was not allocated by standard system (BKE_libblock_alloc), do not free its memory (usual type-specific freeing is called though). RESET_NEVER |
| ID_TAG_DOIT | Free to use tag, often used in BKE code to mark IDs to be processed. RESET_BEFORE_USE
|
| anonymous enum |
| enum eID_Index |
This enum defines the index assigned to each type of IDs in the array returned by BKE_main_lists_get, and by extension, controls the default order in which each ID type is processed during standard 'foreach' looping over all IDs of a Main data-base.
This is (loosely) defined with a relationship order in mind, from lowest level (ID types using, referencing almost no other ID types) to highest level (ID types potentially using many other ID types).
So e.g. it ensures that this dependency chain is respected: Material <- Mesh <- Object <- Collection <- Scene
Default order of processing of IDs in 'foreach' macros (FOREACH_MAIN_ID_BEGIN and the like), built on top of BKE_main_lists_get, is actually reversed compared to the order defined here, since processing usually needs to happen on users before it happens on used IDs (when freeing e.g.).
DO NOT rely on this order as being full-proofed dependency order, there are many cases were it can be violated (most obvious cases being custom properties and drivers, which can reference any other ID types).
However, this order can be considered as an optimization heuristic, especially when processing relationships in a non-recursive pattern: in typical cases, a vast majority of those relationships can be processed fine in the first pass, and only few additional passes are required to address all remaining relationship cases. See e.g. how BKE_library_unused_linked_data_set_tag is doing this.
| enum ePreviewImage_Flag |
| enum IDRecalcFlag |