Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r--source/blender/makesdna/DNA_ID.h217
1 files changed, 164 insertions, 53 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 451c921c4ef..d64b3d361cf 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -22,6 +22,7 @@ struct GPUTexture;
struct ID;
struct Library;
struct PackedFile;
+struct UniqueName_Map;
/* Runtime display data */
struct DrawData;
@@ -36,7 +37,7 @@ typedef struct DrawData {
/* Only nested data, NOT the engine data itself. */
DrawDataFreeCb free;
/* Accumulated recalc flags, which corresponds to ID->recalc flags. */
- int recalc;
+ unsigned int recalc;
} DrawData;
typedef struct DrawDataList {
@@ -255,6 +256,7 @@ typedef struct IDOverrideLibraryProperty {
/**
* List of overriding operations (IDOverrideLibraryPropertyOperation) applied to this property.
+ * Recreated as part of the diffing, so do not store any of these elsewhere.
*/
ListBase operations;
@@ -386,7 +388,7 @@ typedef struct ID {
int tag;
int us;
int icon_id;
- int recalc;
+ unsigned int recalc;
/**
* Used by undo code. recalc_after_undo_push contains the changes between the
* last undo push and the current state. This is accumulated as IDs are tagged
@@ -396,8 +398,8 @@ typedef struct ID {
* recalc_after_undo_push at the time of the undo push. This means it can be
* used to find the changes between undo states.
*/
- int recalc_up_to_undo_push;
- int recalc_after_undo_push;
+ unsigned int recalc_up_to_undo_push;
+ unsigned int recalc_after_undo_push;
/**
* A session-wide unique identifier for a given ID, that remain the same across potential
@@ -444,6 +446,11 @@ typedef struct ID {
struct ID_Runtime runtime;
} ID;
+typedef struct Library_Runtime {
+ /* Used for efficient calculations of unique names. */
+ struct UniqueName_Map *name_map;
+} Library_Runtime;
+
/**
* For each library file used, a Library struct is added to Main
* WARNING: readfile.c, expand_doit() reads this struct without DNA check!
@@ -476,6 +483,8 @@ typedef struct Library {
int temp_index;
/** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */
short versionfile, subversionfile;
+
+ struct Library_Runtime runtime;
} Library;
/** #Library.tag */
@@ -646,62 +655,123 @@ enum {
/**
* 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.
* - RESET_AFTER_USE: piece of code that wants to use such flag has to ensure they are properly
- * 'reset' after usage
- * (though 'lifetime' of those flags is a bit fuzzy, e.g. _RECALC ones are reset on depsgraph
- * evaluation...).
- * - RESET_NEVER: those flags are 'status' one, and never actually need any reset
- * (except on initialization during .blend file reading).
+ * 'reset' after usage (though 'lifetime' of those flags is a bit fuzzy, e.g. _RECALC ones are
+ * reset on depsgraph evaluation...).
+ * - RESET_NEVER: these flags are 'status' ones, and never actually need any reset (except on
+ * initialization during .blend file reading).
*/
enum {
- /* RESET_NEVER Datablock is from current .blend file. */
+ /**
+ * ID is from current .blend file.
+ *
+ * RESET_NEVER
+ */
LIB_TAG_LOCAL = 0,
- /* RESET_NEVER Datablock is from a library,
- * but is used (linked) directly by current .blend file. */
+ /**
+ * ID is from a library, but is used (linked) directly by current .blend file.
+ *
+ * RESET_NEVER
+ */
LIB_TAG_EXTERN = 1 << 0,
- /* RESET_NEVER Datablock is from a library,
- * and is only used (linked) indirectly through other libraries. */
+ /**
+ * ID is from a library, and is only used (linked) indirectly through other libraries.
+ *
+ * RESET_NEVER
+ */
LIB_TAG_INDIRECT = 1 << 1,
- /* RESET_AFTER_USE Flag used internally in readfile.c,
- * to mark IDs needing to be expanded (only done once). */
+ /**
+ * Tag used internally in readfile.c, to mark IDs needing to be expanded (only done once).
+ *
+ * RESET_AFTER_USE
+ */
LIB_TAG_NEED_EXPAND = 1 << 3,
- /* RESET_AFTER_USE Flag used internally in readfile.c to mark ID
- * placeholders for linked data-blocks needing to be read. */
+ /**
+ * Tag used internally in readfile.c, to mark ID placeholders for linked data-blocks needing to
+ * be read.
+ *
+ * RESET_AFTER_USE
+ */
LIB_TAG_ID_LINK_PLACEHOLDER = 1 << 4,
- /* RESET_AFTER_USE */
+ /**
+ * Tag used internally in readfile.c, to mark IDs needing to be 'lib-linked', i.e. to get their
+ * pointers to other data-blocks updated from the 'UID' values stored in .blend files to the new,
+ * actual pointers.
+ *
+ * RESET_AFTER_USE
+ */
LIB_TAG_NEED_LINK = 1 << 5,
- /* RESET_NEVER tag data-block as a place-holder
- * (because the real one could not be linked from its library e.g.). */
+ /**
+ * ID is a place-holder, an 'empty shell' (because the real one could not be linked from its
+ * library e.g.).
+ *
+ * RESET_NEVER
+ */
LIB_TAG_MISSING = 1 << 6,
- /* RESET_NEVER tag data-block as being up-to-date regarding its reference. */
+ /**
+ * ID is up-to-date regarding its reference (only for library overrides).
+ *
+ * RESET_NEVER
+ */
LIB_TAG_OVERRIDE_LIBRARY_REFOK = 1 << 9,
- /* RESET_NEVER tag data-block as needing an auto-override execution, if enabled. */
+ /**
+ * ID needs an auto-diffing execution, if enabled (only for library overrides).
+ *
+ * RESET_NEVER
+ */
LIB_TAG_OVERRIDE_LIBRARY_AUTOREFRESH = 1 << 17,
- /* tag data-block as having an extra user. */
+ /**
+ * ID has an extra virtual user (aka 'ensured real', as set by e.g. some editors, not to be
+ * confused with the `LIB_FAKEUSER` flag).
+ *
+ * RESET_NEVER
+ *
+ * \note This tag does not necessarily mean the actual user count of the ID is increased, this is
+ * defined by #LIB_TAG_EXTRAUSER_SET.
+ */
LIB_TAG_EXTRAUSER = 1 << 2,
- /* tag data-block as having actually increased user-count for the extra virtual user. */
+ /**
+ * ID actually has increased user-count for the extra virtual user.
+ *
+ * RESET_NEVER
+ */
LIB_TAG_EXTRAUSER_SET = 1 << 7,
- /* RESET_AFTER_USE tag newly duplicated/copied IDs (see #ID_NEW_SET macro above).
- * Also used internally in readfile.c to mark data-blocks needing do_versions. */
+ /**
+ * ID is newly duplicated/copied (see #ID_NEW_SET macro above).
+ *
+ * RESET_AFTER_USE
+ *
+ * \note Also used internally in readfile.c to mark data-blocks needing do_versions.
+ */
LIB_TAG_NEW = 1 << 8,
- /* RESET_BEFORE_USE free test flag.
- * TODO: make it a RESET_AFTER_USE too. */
+ /**
+ * Free to use tag, often used in BKE code to mark IDs to be processed.
+ *
+ * RESET_BEFORE_USE
+ *
+ * \todo Make it a RESET_AFTER_USE too.
+ */
LIB_TAG_DOIT = 1 << 10,
- /* RESET_AFTER_USE tag existing data before linking so we know what is new. */
+ /**
+ * ID is already existing. Set before linking, to distinguish between existing data-blocks and
+ * newly linked ones.
+ *
+ * RESET_AFTER_USE
+ */
LIB_TAG_PRE_EXISTING = 1 << 11,
/**
- * The data-block is a copy-on-write/localized version.
+ * ID is a copy-on-write/localized version.
*
* RESET_NEVER
*
@@ -711,8 +781,8 @@ enum {
*/
LIB_TAG_COPIED_ON_WRITE = 1 << 12,
/**
- * The data-block is not the original COW ID created by the depsgraph, but has be re-allocated
- * during the evaluation process of another ID.
+ * ID is not the original COW ID created by the depsgraph, but has been re-allocated during the
+ * evaluation process of another ID.
*
* RESET_NEVER
*
@@ -722,34 +792,58 @@ enum {
LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT = 1 << 13,
/**
- * The data-block is fully outside of any ID management area, and should be considered as a
- * purely independent data.
+ * ID is fully outside of any ID management area, and should be considered as a purely
+ * independent data.
*
* RESET_NEVER
*
- * NOTE: Only used by node-groups currently.
+ * \note Only used by node-trees currently.
*/
LIB_TAG_LOCALIZED = 1 << 14,
- /* RESET_NEVER tag data-block for freeing etc. behavior
- * (usually set when copying real one into temp/runtime one). */
- LIB_TAG_NO_MAIN = 1 << 15, /* Datablock is not listed in Main database. */
- LIB_TAG_NO_USER_REFCOUNT = 1 << 16, /* Datablock does not refcount usages of other IDs. */
- /* Datablock was not allocated by standard system (BKE_libblock_alloc), do not free its memory
- * (usual type-specific freeing is called though). */
+ /** General ID management info, for freeing or copying behavior e.g. */
+ /**
+ * ID is not listed/stored in Main database.
+ *
+ * RESET_NEVER
+ */
+ LIB_TAG_NO_MAIN = 1 << 15,
+ /**
+ * Datablock does not refcount usages of other IDs.
+ *
+ * RESET_NEVER
+ */
+ LIB_TAG_NO_USER_REFCOUNT = 1 << 16,
+ /**
+ * ID was not allocated by standard system (BKE_libblock_alloc), do not free its memory
+ * (usual type-specific freeing is called though).
+ *
+ * RESET_NEVER
+ */
LIB_TAG_NOT_ALLOCATED = 1 << 18,
- /* RESET_AFTER_USE Used by undo system to tag unchanged IDs re-used from old Main (instead of
- * read from memfile). */
+ /**
+ * ID is being re-used from the old Main (instead of read from memfile), during memfile undo
+ * processing.
+ *
+ * RESET_AFTER_USE
+ */
LIB_TAG_UNDO_OLD_ID_REUSED = 1 << 19,
- /* This ID is part of a temporary #Main which is expected to be freed in a short time-frame.
+ /**
+ * 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_uuid isn't initialized, since the data isn't part of the session. */
+ * When set #ID.session_uuid isn't initialized, since the data isn't part of the session.
+ */
LIB_TAG_TEMP_MAIN = 1 << 20,
/**
- * The data-block is a library override that needs re-sync to its linked reference.
+ * ID is a library override that needs re-sync to its linked reference.
+ *
+ * RESET_NEVER
*/
LIB_TAG_LIB_OVERRIDE_NEED_RESYNC = 1 << 21,
};
@@ -862,6 +956,17 @@ typedef enum IDRecalcFlag {
/* The node tree has changed in a way that affects its output nodes. */
ID_RECALC_NTREE_OUTPUT = (1 << 25),
+ /* Provisioned flags.
+ *
+ * Not for actual use. The idea of them is to have all bits of the `IDRecalcFlag` defined to a
+ * known value, silencing sanitizer warnings when checking bits of the ID_RECALC_ALL. */
+ ID_RECALC_PROVISION_26 = (1 << 26),
+ ID_RECALC_PROVISION_27 = (1 << 27),
+ ID_RECALC_PROVISION_28 = (1 << 28),
+ ID_RECALC_PROVISION_29 = (1 << 29),
+ ID_RECALC_PROVISION_30 = (1 << 30),
+ ID_RECALC_PROVISION_31 = (1u << 31),
+
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */
@@ -880,7 +985,8 @@ typedef enum IDRecalcFlag {
* Do NOT use those for tagging. */
/* Identifies that SOMETHING has been changed in this ID. */
- ID_RECALC_ALL = ~(0),
+ ID_RECALC_ALL = (0xffffffff),
+
/* Identifies that something in particle system did change. */
ID_RECALC_PSYS_ALL = (ID_RECALC_PSYS_REDO | ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_CHILD |
ID_RECALC_PSYS_PHYS),
@@ -923,6 +1029,10 @@ typedef enum IDRecalcFlag {
#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_ALL \
(FILTER_ID_AC | FILTER_ID_AR | FILTER_ID_BR | FILTER_ID_CA | FILTER_ID_CU_LEGACY | \
@@ -930,7 +1040,8 @@ typedef enum IDRecalcFlag {
FILTER_ID_MA | FILTER_ID_MB | FILTER_ID_MC | FILTER_ID_ME | FILTER_ID_MSK | FILTER_ID_NT | \
FILTER_ID_OB | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_SCE | FILTER_ID_SPK | \
FILTER_ID_SO | FILTER_ID_TE | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_WO | FILTER_ID_CF | \
- FILTER_ID_WS | FILTER_ID_LP | FILTER_ID_CV | FILTER_ID_PT | FILTER_ID_VO | FILTER_ID_SIM)
+ FILTER_ID_WS | FILTER_ID_LP | FILTER_ID_CV | FILTER_ID_PT | FILTER_ID_VO | FILTER_ID_SIM | \
+ FILTER_ID_KE | FILTER_ID_SCR | FILTER_ID_WM | FILTER_ID_LI)
/**
* This enum defines the index assigned to each type of IDs in the array returned by