From deb01eb1991e49fb912ede1ef036710e51b25fc5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 30 Jun 2020 11:33:36 +0200 Subject: LibOverride: Add concept of 'embedded'/'virtual' override. IDs like embedded ones (master collections, root node trees) cannot be linked, and thus cannot be real override themselves. Since they are managed by their owner ID, that one will also have the overrides for their locally edited properties. We still need a way to mark them as overridden though, for various UI and override-internal purposes, this is done using a new ID flag. Note that since Shae Keys are not linkable, and their pointers are not editable in RNA, they are also considered as embedded from override point of view. --- source/blender/makesdna/DNA_ID.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index ed2d3671b6b..60cedfe3c8a 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -470,8 +470,15 @@ typedef enum ID_Type { #define ID_IS_OVERRIDABLE_LIBRARY(_id) \ (ID_IS_LINKED(_id) && !ID_MISSING(_id) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 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) \ - (((const ID *)(_id))->override_library != NULL && ((const 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) @@ -509,6 +516,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, }; /** -- cgit v1.2.3