[Bf-blender-cvs] [f3186389b00] blender-v3.3-release: Fix T100586: libOverride resync could remove too many data-blocks.

Bastien Montagne noreply at git.blender.org
Tue Aug 30 15:18:22 CEST 2022


Commit: f3186389b0094b0478df5adb2da917ac722acd7f
Author: Bastien Montagne
Date:   Tue Aug 30 14:20:53 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBf3186389b0094b0478df5adb2da917ac722acd7f

Fix T100586: libOverride resync could remove too many data-blocks.

Do not delete 'orphaned' overrides when their reference is missing
because the library file itself is missing.

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

M	source/blender/blenkernel/intern/lib_override.cc

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

diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index 03ad4b1cd5f..0e09c36fd64 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -2081,9 +2081,13 @@ static bool lib_override_library_resync(Main *bmain,
     }
     /* Also deal with old overrides that went missing in new linked data - only for real local
      * overrides for now, not those who are linked. */
-    else if (id->tag & LIB_TAG_MISSING && !ID_IS_LINKED(id)) {
-      BLI_assert(ID_IS_OVERRIDE_LIBRARY(id));
-      if (!BKE_lib_override_library_is_user_edited(id)) {
+    else if (id->tag & LIB_TAG_MISSING && !ID_IS_LINKED(id) && ID_IS_OVERRIDE_LIBRARY(id)) {
+      if (ID_IS_OVERRIDE_LIBRARY_REAL(id) &&
+          id->override_library->reference->lib->id.tag & LIB_TAG_MISSING) {
+        /* Do not delete overrides which reference is missing because the library itself is missing
+         * (ref. T100586). */
+      }
+      else if (!BKE_lib_override_library_is_user_edited(id)) {
         /* If user never edited them, we can delete them. */
         id->tag |= LIB_TAG_DOIT;
         id->tag &= ~LIB_TAG_MISSING;
@@ -2395,6 +2399,11 @@ static void lib_override_library_main_resync_on_library_indirect_level(
       continue;
     }
 
+    /* Do not attempt to resync from missing data. */
+    if (((id->tag | id->override_library->reference->tag) & LIB_TAG_MISSING) != 0) {
+      continue;
+    }
+
     if (id->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) {
       /* This ID is not part of an override hierarchy. */
       continue;
@@ -2423,6 +2432,11 @@ static void lib_override_library_main_resync_on_library_indirect_level(
       continue;
     }
 
+    /* Do not attempt to resync from missing data. */
+    if (((id->tag | id->override_library->reference->tag) & LIB_TAG_MISSING) != 0) {
+      continue;
+    }
+
     if (id->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_NO_HIERARCHY) {
       /* This ID is not part of an override hierarchy. */
       BLI_assert((id->tag & LIB_TAG_LIB_OVERRIDE_NEED_RESYNC) == 0);
@@ -2550,6 +2564,15 @@ static void lib_override_library_main_resync_on_library_indirect_level(
   /* Check there are no left-over IDs needing resync from the current (or higher) level of indirect
    * library level. */
   FOREACH_MAIN_ID_BEGIN (bmain, id) {
+    if (!ID_IS_OVERRIDE_LIBRARY(id)) {
+      continue;
+    }
+    /* Do not attempt to resync to/from missing data. */
+    if (((id->tag | (ID_IS_OVERRIDE_LIBRARY_REAL(id) ? id->override_library->reference->tag : 0)) &
+         LIB_TAG_MISSING) != 0) {
+      continue;
+    }
+
     const bool is_valid_tagged_need_resync = ((id->tag & LIB_TAG_LIB_OVERRIDE_NEED_RESYNC) == 0 ||
                                               lib_override_resync_id_lib_level_is_valid(
                                                   id, library_indirect_level - 1, false));



More information about the Bf-blender-cvs mailing list