diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-05 21:43:52 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-05 22:31:01 +0300 |
commit | 5f4caa8c4fc393e6519b810fc095b4c339266251 (patch) | |
tree | 76c0db78a2f196f5b0f92ba507ac38fd3055d0d8 /source/blender/makesdna/DNA_ID.h | |
parent | 8622849beb964536d39ca2da8a2a0e4db978502f (diff) |
LibOverride: add a generic macro to check whetehr an ID is overridable.
...and use it in code generating library overrides.
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index ed7416e06c9..a1bc71ade62 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -432,10 +432,15 @@ typedef enum ID_Type { #define ID_BLEND_PATH_FROM_GLOBAL(_id) \ ((_id)->lib ? (_id)->lib->filepath : BKE_main_blendfile_path_from_global()) -#define ID_MISSING(_id) (((_id)->tag & LIB_TAG_MISSING) != 0) +#define ID_MISSING(_id) ((((ID *)(_id))->tag & LIB_TAG_MISSING) != 0) #define ID_IS_LINKED(_id) (((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) + #define ID_IS_OVERRIDE_LIBRARY(_id) \ (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference != NULL) |