diff options
author | Bastien Montagne <bastien@blender.org> | 2021-08-05 16:24:46 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-08-05 16:26:08 +0300 |
commit | 0cff7c2a228589505bd2d66e966e5e84613b2786 (patch) | |
tree | d8a861789386609cfdf77164b020529f27d065b3 /source/blender | |
parent | 720ea8a67df06ba2242e7771b349cefd753f7ea5 (diff) |
LibOverride: Make it reasonably impossible for users to create overrides of scenes.
This is not supported currently,doing so through RNA API remains
possible, but from regular UI operations it should not be doable
anymore.
Ref. T90459.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 3edb12c5503..e3aec572bd3 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -845,8 +845,20 @@ static void id_override_library_create_fn(bContext *C, if (!ID_IS_LINKED(te->store_elem->id)) { break; } + /* If we'd need to override that arent ID, but it is not overridable, abort. */ + if (!ID_IS_OVERRIDABLE_LIBRARY(te->store_elem->id)) { + BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + BKE_reportf(reports, + RPT_WARNING, + "Could not create library override from data-block '%s', one of its parents " + "is not overridable ('%s')", + id_root->name, + te->store_elem->id->name); + return; + } te->store_elem->id->tag |= LIB_TAG_DOIT; } + success = BKE_lib_override_library_create( bmain, CTX_data_scene(C), CTX_data_view_layer(C), id_root, id_reference, NULL); } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index c9d652ad03d..f7f4b0e6104 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -429,7 +429,8 @@ typedef struct PreviewImage { * 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) && (((const ID *)(_id))->tag & LIB_TAG_EXTERN) != 0 && \ - (BKE_idtype_get_info_from_id((const ID *)(_id))->flags & IDTYPE_FLAGS_NO_LIBLINKING) == 0) + (BKE_idtype_get_info_from_id((const ID *)(_id))->flags & IDTYPE_FLAGS_NO_LIBLINKING) == 0 && \ + !ELEM(GS(((ID *)(_id))->name), ID_SCE)) /* NOTE: The three checks below do not take into account whether given ID is linked or not (when * chaining overrides over several libraries). User must ensure the ID is not linked itself |