[Bf-blender-cvs] [8b68a758723] master: LibOverride: Add a new 'leftover' flag to ID.

Bastien Montagne noreply at git.blender.org
Thu Apr 8 11:48:22 CEST 2021


Commit: 8b68a75872372197d8b38c516f054d07f0b7ad30
Author: Bastien Montagne
Date:   Wed Apr 7 15:50:53 2021 +0200
Branches: master
https://developer.blender.org/rB8b68a75872372197d8b38c516f054d07f0b7ad30

LibOverride: Add a new 'leftover' flag to ID.

This flag is set for liboverride IDs that are detected as no longer
needed by resync process, while having been user-edited, so
auto-handling code cannot silently delete them.

Exposing those to users will be part of the new incoming Override
Outliner view.

Part of D10855.

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

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

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

diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index ebe8043d41d..112c4c21a27 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -702,6 +702,9 @@ static void lib_override_library_create_post_process(Main *bmain,
                 base = BKE_view_layer_base_find(view_layer, ob_new);
                 DEG_id_tag_update_ex(
                     bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS);
+                if (is_resync) {
+                  ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
+                }
               }
 
               if (ob_new == (Object *)ob_reference->id.newid && base != NULL) {
@@ -713,6 +716,9 @@ static void lib_override_library_create_post_process(Main *bmain,
                          view_layer, ob_new, is_resync)) {
               BKE_collection_object_add(bmain, collection_new, ob_new);
               DEG_id_tag_update_ex(bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS);
+              if (is_resync) {
+                ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
+              }
             }
           }
         }
@@ -729,6 +735,9 @@ static void lib_override_library_create_post_process(Main *bmain,
           else {
             BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new);
           }
+          if (is_resync) {
+            ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
+          }
         }
         break;
       }
@@ -1087,6 +1096,7 @@ bool BKE_lib_override_library_resync(Main *bmain,
         /* Otherwise, keep them, user needs to decide whether what to do with them. */
         BLI_assert((id->tag & LIB_TAG_DOIT) == 0);
         id_fake_user_set(id);
+        id->flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
         CLOG_INFO(&LOG, 2, "Old override %s is being kept around as it was user-edited", id->name);
       }
     }
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index d88db091cc2..f9524fac72d 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -491,6 +491,11 @@ enum {
    * Note that this also applies to shapekeys, even though they are not 100% embedded data...
    */
   LIB_EMBEDDED_DATA_LIB_OVERRIDE = 1 << 12,
+  /**
+   * The override data-block appears to not be needed anymore after resync with linked data, but it
+   * was kept around (because e.g. detected as user-edited).
+   */
+  LIB_LIB_OVERRIDE_RESYNC_LEFTOVER = 1 << 13,
 };
 
 /**



More information about the Bf-blender-cvs mailing list