[Bf-blender-cvs] [ed52de948cc] master: LibOverride: Add tag to libraries that had to be recursively resynced.

Bastien Montagne noreply at git.blender.org
Fri Jan 7 12:09:59 CET 2022


Commit: ed52de948ccddf297e010dbf79dfadfcd164dae9
Author: Bastien Montagne
Date:   Fri Jan 7 12:07:37 2022 +0100
Branches: master
https://developer.blender.org/rBed52de948ccddf297e010dbf79dfadfcd164dae9

LibOverride: Add tag to libraries that had to be recursively resynced.

Request from studio, to help identify quickly libs that need update.

NOTE: Currently only outputing INFO log in console, display of this info
in the outliner will come in a separate commit.

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

M	source/blender/blenkernel/intern/lib_override.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesrna/intern/rna_access_compare_override.c

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

diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 011b7a4924d..6fe57a0257c 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1733,6 +1733,10 @@ static void lib_override_library_main_resync_on_library_indirect_level(
           continue;
         }
 
+        if (ID_IS_LINKED(id)) {
+          id->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED;
+        }
+
         /* We cannot resync a scene that is currently active. */
         if (id == &scene->id) {
           id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
@@ -1889,6 +1893,16 @@ void BKE_lib_override_library_main_resync(Main *bmain,
   if (BKE_collection_is_empty(override_resync_residual_storage)) {
     BKE_collection_delete(bmain, override_resync_residual_storage, true);
   }
+
+  LISTBASE_FOREACH (Library *, library, &bmain->libraries) {
+    if (library->tag & LIBRARY_TAG_RESYNC_REQUIRED) {
+      CLOG_INFO(&LOG,
+                2,
+                "library '%s' contains some linked overrides that required recursive resync, "
+                "consider updating it",
+                library->filepath);
+    }
+  }
 }
 
 void BKE_lib_override_library_delete(Main *bmain, ID *id_root)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 9fdf7be04e2..a70befc155b 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -445,12 +445,21 @@ typedef struct Library {
 
   struct PackedFile *packedfile;
 
+  ushort tag;
+  char _pad_0[6];
+
   /* Temp data needed by read/write code, and liboverride recursive resync. */
   int temp_index;
   /** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */
   short versionfile, subversionfile;
 } Library;
 
+/* Library.tag */
+enum eLibrary_Tag {
+  /* Automatic recursive resync was needed when linking/loading data from that library. */
+  LIBRARY_TAG_RESYNC_REQUIRED = 1 << 0,
+};
+
 /**
  * A weak library/ID reference for local data that has been appended, to allow re-using that local
  * data instead of creating a new copy of it in future appends.
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index e59938d7ea3..950eccdb552 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -1127,6 +1127,9 @@ static void rna_property_override_check_resync(Main *bmain,
         * self-references updated to itself, instead of still pointing to its linked source. */
        (id_dst->lib == id_src->lib && id_dst != id_owner_dst))) {
     id_owner_dst->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
+    if (ID_IS_LINKED(id_owner_src)) {
+      id_owner_src->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED;
+    }
     CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", id_owner_dst->name);
   }
 }



More information about the Bf-blender-cvs mailing list