[Bf-blender-cvs] [b8c7e93a650] master: Add experimental option to force all linked data as directly linked.

Bastien Montagne noreply at git.blender.org
Fri Dec 2 13:39:42 CET 2022


Commit: b8c7e93a6504833ee1e617523dfe2921c4fd0816
Author: Bastien Montagne
Date:   Fri Dec 2 13:37:11 2022 +0100
Branches: master
https://developer.blender.org/rBb8c7e93a6504833ee1e617523dfe2921c4fd0816

Add experimental option to force all linked data as directly linked.

This is a workaround required to get BAT reliably working again after
recent rB133dde41bb5b, which fixed many indirectly linked IDs being
tagged as directly linked, and therefore having their reference written
in .blend file.

It seems that BAT is still missing proper handling of some ID pointers.

Required for the end of the Heist production here at Blender Studio.

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

M	source/blender/blenloader/intern/writefile.cc
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/source/blender/blenloader/intern/writefile.cc b/source/blender/blenloader/intern/writefile.cc
index 38d0970b4ed..bc1a90fb022 100644
--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1131,9 +1131,17 @@ static bool write_file_handle(Main *mainvar,
   if (!wd->use_memfile) {
     ID *id_iter;
     FOREACH_MAIN_ID_BEGIN (mainvar, id_iter) {
-      if (ID_IS_LINKED(id_iter)) {
-        id_iter->tag |= LIB_TAG_INDIRECT;
-        id_iter->tag &= ~LIB_TAG_EXTERN;
+      if (ID_IS_LINKED(id_iter) && BKE_idtype_idcode_is_linkable(GS(id_iter->name))) {
+        if (USER_EXPERIMENTAL_TEST(&U, use_all_linked_data_direct)) {
+          /* Forces all linked data to be considered as directly linked.
+           * FIXME: Workaround some BAT tool limitations for Heist production, should be removed
+           * asap afterward. */
+          id_lib_extern(id_iter);
+        }
+        else {
+          id_iter->tag |= LIB_TAG_INDIRECT;
+          id_iter->tag &= ~LIB_TAG_EXTERN;
+        }
       }
     }
     FOREACH_MAIN_ID_END;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 911f139e54f..8a644803fd7 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -640,6 +640,7 @@ typedef struct UserDef_Experimental {
   char show_asset_debug_info;
   char no_asset_indexing;
   char use_viewport_debug;
+  char use_all_linked_data_direct;
   char SANITIZE_AFTER_HERE;
   /* The following options are automatically sanitized (set to 0)
    * when the release cycle is not alpha. */
@@ -652,6 +653,7 @@ typedef struct UserDef_Experimental {
   char enable_eevee_next;
   char use_sculpt_texture_paint;
   char use_realtime_compositor;
+  char _pad0[7];
   /** `makesdna` does not allow empty structs. */
 } UserDef_Experimental;
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index d240636f31b..b93983d0a87 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6391,6 +6391,13 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
                            "Enable viewport debugging options for developers in the overlays "
                            "pop-over");
   RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
+
+  prop = RNA_def_property(srna, "use_all_linked_data_direct", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(
+      prop,
+      "All Linked Data Direct",
+      "Forces all linked data to be considered as directly linked. Workaround for current "
+      "issues/limitations in BAT (Blender studio pipeline tool)");
 }
 
 static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)



More information about the Bf-blender-cvs mailing list