[Bf-blender-cvs] [501b0190d67] master: LibOverride: Deprecate Proxies: Add auto-conversion on file load.

Bastien Montagne noreply at git.blender.org
Fri Sep 24 12:40:22 CEST 2021


Commit: 501b0190d679b54f47a11d2c3d345e4af3a0c64c
Author: Bastien Montagne
Date:   Tue Sep 21 15:12:05 2021 +0200
Branches: master
https://developer.blender.org/rB501b0190d679b54f47a11d2c3d345e4af3a0c64c

LibOverride: Deprecate Proxies: Add auto-conversion on file load.

This commit also add an experimental userPreferences to prevent proxies
conversions on file load, and reporting for amount of coverted proxies
(and possible issues).

Note that potentially linked proxies from other libraries are not
hamdled here (this feature seems to be broken anyway in master
currently?).

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenkernel/intern/lib_override.c
M	source/blender/blenloader/BLO_readfile.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 0093110d326..ef1c7a77a2b 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2283,6 +2283,7 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
             context, (
                 ({"property": "use_undo_legacy"}, "T60695"),
                 ({"property": "override_auto_resync"}, "T83811"),
+                ({"property": "proxy_to_override_auto_conversion"}, "T91671"),
                 ({"property": "use_cycles_debug"}, None),
             ),
         )
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 1c5d8804280..6957f9b5a69 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -344,6 +344,13 @@ static void setup_app_data(bContext *C,
     do_versions_ipos_to_animato(bmain);
   }
 
+  /* FIXME: Same as above, readfile's `do_version` do not allow to create new IDs. */
+  /* TODO: Once this is definitively validated for 3.0 and option to not do it is removed, add a
+   * version bump and check here. */
+  if (!USER_EXPERIMENTAL_TEST(&U, no_proxy_to_override_conversion)) {
+    BKE_lib_override_library_main_proxy_convert(bmain, reports);
+  }
+
   bmain->recovered = 0;
 
   /* startup.blend or recovered startup */
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 5e14c603d4a..f382fc0614b 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -1016,7 +1016,7 @@ static void lib_override_library_proxy_convert_do(Main *bmain,
   if (success) {
     CLOG_INFO(&LOG,
               4,
-              "Proxy object '&s' successfuly converted to library overrides",
+              "Proxy object '%s' successfuly converted to library overrides",
               ob_proxy->id.name);
     /* Remove the instance empty from this scene, the items now have an overridden collection
      * instead. */
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 4b4311d32bf..9093c6fd85b 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -111,8 +111,16 @@ typedef struct BlendFileReadReport {
     /* Some sub-categories of the above `missing_linked_id` counter. */
     int missing_obdata;
     int missing_obproxies;
+
     /* Number of root override IDs that were resynced. */
     int resynced_lib_overrides;
+
+    /* Number of (non-converted) linked proxies. */
+    int linked_proxies;
+    /* Number of proxies converted to library overrides. */
+    int proxies_to_lib_overrides_success;
+    /* Number of proxies that failed to convert to library overrides. */
+    int proxies_to_lib_overrides_failures;
   } count;
 
   /* Number of libraries which had overrides that needed to be resynced, and a single linked list
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 4f86201ced2..2399fb324d7 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -635,6 +635,7 @@ typedef struct UserDef_Experimental {
   /* Debug options, always available. */
   char use_undo_legacy;
   char no_override_auto_resync;
+  char no_proxy_to_override_conversion;
   char use_cycles_debug;
   char SANITIZE_AFTER_HERE;
   /* The following options are automatically sanitized (set to 0)
@@ -647,7 +648,7 @@ typedef struct UserDef_Experimental {
   char use_extended_asset_browser;
   char use_override_templates;
   char use_geometry_nodes_fields;
-  char _pad[4];
+  char _pad[3];
   /** `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 563c6ea35e0..16f33507bed 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6285,6 +6285,13 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
       "Enable library overrides automatic resync detection and process on file load. Disable when "
       "dealing with older .blend files that need manual Resync (Enforce) handling");
 
+  prop = RNA_def_property(srna, "proxy_to_override_auto_conversion", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_negative_sdna(prop, NULL, "no_proxy_to_override_conversion", 1);
+  RNA_def_property_ui_text(
+      prop,
+      "Proxy to Override Auto Conversion",
+      "Enable automatic conversion of proxies to library overrides on file load");
+
   prop = RNA_def_property(srna, "use_new_point_cloud_type", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_new_point_cloud_type", 1);
   RNA_def_property_ui_text(
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 2ce2bcc2f3c..bbab3a8b326 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -857,6 +857,20 @@ static void file_read_reports_finalize(BlendFileReadReport *bf_reports)
                 duration_lib_override_recursive_resync_seconds);
   }
 
+  if (bf_reports->count.linked_proxies != 0 ||
+      bf_reports->count.proxies_to_lib_overrides_success != 0 ||
+      bf_reports->count.proxies_to_lib_overrides_failures != 0) {
+    BKE_reportf(bf_reports->reports,
+                RPT_WARNING,
+                "Proxies are deprecated (%d proxies were automatically converted to library "
+                "overrides, %d proxies could not be converted and %d linked proxies were kept "
+                "untouched). If you need to keep proxies for the time being, please disable the "
+                "`Proxy to Override Auto Conversion` in Experimental user preferences",
+                bf_reports->count.proxies_to_lib_overrides_success,
+                bf_reports->count.proxies_to_lib_overrides_failures,
+                bf_reports->count.linked_proxies);
+  }
+
   BLI_linklist_free(bf_reports->resynced_lib_overrides_libraries, NULL);
   bf_reports->resynced_lib_overrides_libraries = NULL;
 }



More information about the Bf-blender-cvs mailing list