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:
authorBastien Montagne <bastien@blender.org>2021-06-28 18:00:08 +0300
committerBastien Montagne <bastien@blender.org>2021-11-02 16:29:19 +0300
commit9a290dd6571d2998900222aabcb2b6660acef883 (patch)
tree4f8ba3d7b5ce772e11bc7ae342aa2c3010347b63 /source/blender/blenkernel/intern
parent619c51592fcf1efcdc960386385f8a511c2a590e (diff)
LibOverride: Fix crash in ShapeKeys when making a mesh override local.
Weird 'embedded for overrides' flag of embedded IDs (including ShapeKeys in override context) was not properly cleaned up when making an override fully local. Reported by studio, thanks. @jbakker should be backported to 2.93LTS if possible.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/lib_id.c4
-rw-r--r--source/blender/blenkernel/intern/lib_override.c28
2 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index 6546603ffb4..eeda77771ed 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -1917,13 +1917,13 @@ void BKE_library_make_local(Main *bmain,
ntree->tag &= ~LIB_TAG_DOIT;
}
- if (id->lib == NULL) {
+ if (!ID_IS_LINKED(id->lib)) {
id->tag &= ~(LIB_TAG_EXTERN | LIB_TAG_INDIRECT | LIB_TAG_NEW);
id->flag &= ~LIB_INDIRECT_WEAK_LINK;
if (ID_IS_OVERRIDE_LIBRARY_REAL(id) &&
ELEM(lib, NULL, id->override_library->reference->lib) &&
((untagged_only == false) || !(id->tag & LIB_TAG_PRE_EXISTING))) {
- BKE_lib_override_library_free(&id->override_library, true);
+ BKE_lib_override_library_make_local(id);
}
}
/* The check on the fourth line (LIB_TAG_PRE_EXISTING) is done so it's possible to tag data
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 54d14e33209..fd78e72b9a7 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -48,6 +48,7 @@
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
+#include "BKE_node.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -1313,6 +1314,33 @@ void BKE_lib_override_library_delete(Main *bmain, ID *id_root)
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
}
+/** Make given ID fully local.
+ *
+ * \note Only differs from lower-level `BKE_lib_override_library_free in infamous embedded ID
+ * cases.
+ */
+void BKE_lib_override_library_make_local(ID *id)
+{
+ BKE_lib_override_library_free(&id->override_library, true);
+
+ Key *shape_key = BKE_key_from_id(id);
+ if (shape_key != NULL) {
+ shape_key->id.flag &= ~LIB_EMBEDDED_DATA_LIB_OVERRIDE;
+ }
+
+ if (GS(id->name) == ID_SCE) {
+ Collection *master_collection = ((Scene *)id)->master_collection;
+ if (master_collection != NULL) {
+ master_collection->id.flag &= ~LIB_EMBEDDED_DATA_LIB_OVERRIDE;
+ }
+ }
+
+ bNodeTree *node_tree = ntreeFromID(id);
+ if (node_tree != NULL) {
+ node_tree->id.flag &= ~LIB_EMBEDDED_DATA_LIB_OVERRIDE;
+ }
+}
+
BLI_INLINE IDOverrideLibraryRuntime *override_library_rna_path_runtime_ensure(
IDOverrideLibrary *override)
{