[Bf-blender-cvs] [0cff7c2a228] master: LibOverride: Make it reasonably impossible for users to create overrides of scenes.

Bastien Montagne noreply at git.blender.org
Thu Aug 5 15:34:10 CEST 2021


Commit: 0cff7c2a228589505bd2d66e966e5e84613b2786
Author: Bastien Montagne
Date:   Thu Aug 5 15:24:46 2021 +0200
Branches: master
https://developer.blender.org/rB0cff7c2a228589505bd2d66e966e5e84613b2786

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.

===================================================================

M	source/blender/editors/space_outliner/outliner_tools.c
M	source/blender/makesdna/DNA_ID.h

===================================================================

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



More information about the Bf-blender-cvs mailing list