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.h87
1 files changed, 56 insertions, 31 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 4f2bbc4ee73..4ec622574cc 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -206,7 +206,10 @@ typedef struct IDOverrideLibraryProperty {
/** Runtime, tags are common to both IDOverrideProperty and IDOverridePropertyOperation. */
short tag;
- char _pad0[6];
+ char _pad[2];
+
+ /** The property type matching the rna_path. */
+ unsigned int rna_prop_type;
} IDOverrideLibraryProperty;
/* IDOverrideProperty->tag and IDOverridePropertyOperation->tag. */
@@ -215,8 +218,18 @@ enum {
IDOVERRIDE_LIBRARY_TAG_UNUSED = 1 << 0,
};
-/* We do not need a full struct for that currently, just a GHash. */
-typedef struct GHash IDOverrideLibraryRuntime;
+#
+#
+typedef struct IDOverrideLibraryRuntime {
+ struct GHash *rna_path_to_override_properties;
+ uint tag;
+} IDOverrideLibraryRuntime;
+
+/* IDOverrideLibraryRuntime->tag. */
+enum {
+ /** This override needs to be reloaded. */
+ IDOVERRIDE_LIBRARY_RUNTIME_TAG_NEEDS_RELOAD = 1 << 0,
+};
/* Main container for all overriding data info of a data-block. */
typedef struct IDOverrideLibrary {
@@ -225,9 +238,6 @@ typedef struct IDOverrideLibrary {
/** List of IDOverrideProperty structs. */
ListBase properties;
- short flag;
- char _pad[6];
-
/* Read/write data. */
/* Temp ID storing extra override data (used for differential operations only currently).
* Always NULL outside of read/write context. */
@@ -236,10 +246,6 @@ typedef struct IDOverrideLibrary {
IDOverrideLibraryRuntime *runtime;
} IDOverrideLibrary;
-enum eOverrideLibrary_Flag {
- OVERRIDE_LIBRARY_AUTO = 1 << 0, /* Allow automatic generation of overriding rules. */
-};
-
/* watch it: Sequence has identical beginning. */
/**
* ID is the first thing included in all serializable types. It
@@ -309,16 +315,17 @@ typedef struct Library {
ID id;
struct FileData *filedata;
/** Path name used for reading, can be relative and edited in the outliner. */
- char name[1024];
+ char filepath[1024];
/**
- * Absolute filepath, this is only for convenience,
- * 'name' is the real path used on file read but in
- * some cases its useful to access the absolute one.
- * This is set on file read.
- * Use BKE_library_filepath_set() rather than setting 'name'
- * directly and it will be kept in sync - campbell */
- char filepath[1024];
+ * Run-time only, absolute file-path (set on read).
+ * This is only for convenience, `filepath` is the real path
+ * used on file read but in some cases its useful to access the absolute one.
+ *
+ * Use #BKE_library_filepath_set() rather than setting `filepath`
+ * directly and it will be kept in sync - campbell
+ */
+ char filepath_abs[1024];
/** Set for indirectly linked libs, used in the outliner and while reading. */
struct Library *parent;
@@ -455,37 +462,41 @@ typedef enum ID_Type {
/* fluidsim Ipo */
#define ID_FLUIDSIM MAKE_ID2('F', 'S')
-#define ID_FAKE_USERS(id) ((((ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0)
-#define ID_REAL_USERS(id) (((ID *)id)->us - ID_FAKE_USERS(id))
-#define ID_EXTRA_USERS(id) (((ID *)id)->tag & LIB_TAG_EXTRAUSER ? 1 : 0)
+#define ID_FAKE_USERS(id) ((((const ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0)
+#define ID_REAL_USERS(id) (((const ID *)id)->us - ID_FAKE_USERS(id))
+#define ID_EXTRA_USERS(id) (((const ID *)id)->tag & LIB_TAG_EXTRAUSER ? 1 : 0)
#define ID_CHECK_UNDO(id) \
((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM) && (GS((id)->name) != ID_WS))
#define ID_BLEND_PATH(_bmain, _id) \
- ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path((_bmain)))
+ ((_id)->lib ? (_id)->lib->filepath_abs : BKE_main_blendfile_path((_bmain)))
#define ID_BLEND_PATH_FROM_GLOBAL(_id) \
- ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path_from_global())
+ ((_id)->lib ? (_id)->lib->filepath_abs : BKE_main_blendfile_path_from_global())
-#define ID_MISSING(_id) ((((ID *)(_id))->tag & LIB_TAG_MISSING) != 0)
+#define ID_MISSING(_id) ((((const ID *)(_id))->tag & LIB_TAG_MISSING) != 0)
-#define ID_IS_LINKED(_id) (((ID *)(_id))->lib != NULL)
+#define ID_IS_LINKED(_id) (((const ID *)(_id))->lib != NULL)
/* Note that this is a fairly high-level check, should be used at user interaction level, not in
* BKE_library_override typically (especially due to the check on LIB_TAG_EXTERN). */
#define ID_IS_OVERRIDABLE_LIBRARY(_id) \
- (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((ID *)(_id))->tag & LIB_TAG_EXTERN) != 0)
+ (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 0 && \
+ (BKE_idtype_get_info_from_id((const ID *)(_id))->flags & IDTYPE_FLAGS_NO_LIBLINKING) == 0)
+
+#define ID_IS_OVERRIDE_LIBRARY_REAL(_id) \
+ (((const ID *)(_id))->override_library != NULL && \
+ ((const ID *)(_id))->override_library->reference != NULL)
+
+#define ID_IS_OVERRIDE_LIBRARY_VIRTUAL(_id) \
+ ((((const ID *)(_id))->flag & LIB_EMBEDDED_DATA_LIB_OVERRIDE) != 0)
#define ID_IS_OVERRIDE_LIBRARY(_id) \
- (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference != NULL)
+ (ID_IS_OVERRIDE_LIBRARY_REAL(_id) || ID_IS_OVERRIDE_LIBRARY_VIRTUAL(_id))
#define ID_IS_OVERRIDE_LIBRARY_TEMPLATE(_id) \
(((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference == NULL)
-#define ID_IS_OVERRIDE_LIBRARY_AUTO(_id) \
- (!ID_IS_LINKED((_id)) && ID_IS_OVERRIDE_LIBRARY((_id)) && \
- (((ID *)(_id))->override_library->flag & OVERRIDE_LIBRARY_AUTO))
-
/* Check whether datablock type is covered by copy-on-write. */
#define ID_TYPE_IS_COW(_id_type) (!ELEM(_id_type, ID_BR, ID_PAL, ID_IM))
@@ -519,6 +530,11 @@ enum {
* we want to restore if possible, and silently drop if it's missing.
*/
LIB_INDIRECT_WEAK_LINK = 1 << 11,
+ /**
+ * The data-block is a sub-data of another one, which is an override.
+ * Note that this also applies to shapekeys, even though they are not 100% embedded data...
+ */
+ LIB_EMBEDDED_DATA_LIB_OVERRIDE = 1 << 12,
};
/**
@@ -680,6 +696,15 @@ typedef enum IDRecalcFlag {
* input file or for color space changes. */
ID_RECALC_SOURCE = (1 << 23),
+ /* Virtual recalc tag/marker required for undo in some cases, where actual data does not change
+ * and hence do not require an update, but conceptually we are dealing with something new.
+ *
+ * Current known case: linked IDs made local without requiring any copy. While their users do not
+ * require any update, they have actually been 'virtually' remapped from the linked ID to the
+ * local one.
+ */
+ ID_RECALC_TAG_FOR_UNDO = (1 << 24),
+
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */