[Bf-blender-cvs] [62cb5c5c4aa] master: Enable Asset Browser by default for poses, rest stays experimental

Julian Eisel noreply at git.blender.org
Wed Aug 11 14:32:42 CEST 2021


Commit: 62cb5c5c4aacc3f83fa5053e4fb5fc4524522fe7
Author: Julian Eisel
Date:   Wed Aug 11 14:20:49 2021 +0200
Branches: master
https://developer.blender.org/rB62cb5c5c4aacc3f83fa5053e4fb5fc4524522fe7

Enable Asset Browser by default for poses, rest stays experimental

Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.

* Adds a new experimental option "Extended Asset Browser", replacing
  "Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
  This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
  disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
  browing inside .blend files. That way you can hide data-blocks that
  are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
  it's needed for pose library access.

Addresses T90181, T90180 and T90300.

Differential Revision: https://developer.blender.org/D12120

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

M	release/scripts/startup/bl_ui/space_filebrowser.py
M	release/scripts/startup/bl_ui/space_outliner.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/asset/intern/asset_ops.cc
M	source/blender/editors/interface/interface_context_menu.c
M	source/blender/editors/space_file/space_file.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 00ac69595c7..aea2b76e07b 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -195,7 +195,7 @@ class FILEBROWSER_PT_filter(FileBrowserPanel, Panel):
 
                 sub = row.column(align=True)
 
-                if context.preferences.experimental.use_asset_browser:
+                if context.preferences.experimental.use_extended_asset_browser:
                     sub.prop(params, "use_filter_asset_only")
 
                 filter_id = params.filter_id
@@ -653,6 +653,10 @@ class ASSETBROWSER_PT_navigation_bar(asset_utils.AssetBrowserPanel, Panel):
     bl_region_type = 'TOOLS'
     bl_options = {'HIDE_HEADER'}
 
+    @classmethod
+    def poll(cls, context):
+        return context.preferences.experimental.use_extended_asset_browser
+
     def draw(self, context):
         layout = self.layout
 
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 0a4f419362d..febd064147f 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -315,7 +315,7 @@ class OUTLINER_MT_asset(Menu):
 
     @classmethod
     def poll(cls, context):
-        return context.preferences.experimental.use_asset_browser
+        return context.preferences.experimental.use_extended_asset_browser
 
     def draw(self, context):
         layout = self.layout
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 91bd5f04b9d..003f2f223ea 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1366,11 +1366,6 @@ class USERPREF_PT_saveload_autorun(FilePathsPanel, Panel):
 class USERPREF_PT_file_paths_asset_libraries(FilePathsPanel, Panel):
     bl_label = "Asset Libraries"
 
-    @classmethod
-    def poll(cls, context):
-        prefs = context.preferences
-        return prefs.experimental.use_asset_browser
-
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = False
@@ -2258,7 +2253,7 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
             context, (
                 ({"property": "use_sculpt_vertex_colors"}, "T71947"),
                 ({"property": "use_sculpt_tools_tilt"}, "T82877"),
-                ({"property": "use_asset_browser"}, ("project/profile/124/", "Milestone 1")),
+                ({"property": "use_extended_asset_browser"}, ("project/view/130/", "Project Page")),
                 ({"property": "use_override_templates"}, ("T73318", "Milestone 4")),
             ),
         )
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 61827be08e5..1c5d8804280 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -660,10 +660,6 @@ UserDef *BKE_blendfile_userdef_from_defaults(void)
   BKE_studiolight_default(userdef->light_param, userdef->light_ambient);
 
   BKE_preferences_asset_library_default_add(userdef);
-  /* Enable asset browser features by default for alpha testing.
-   * BLO_sanitize_experimental_features_userpref_blend() will disable it again for non-alpha
-   * builds. */
-  userdef->experimental.use_asset_browser = true;
 
   return userdef;
 }
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index c409f0a71fc..0042ff29dc2 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -873,13 +873,6 @@ void blo_do_versions_userdef(UserDef *userdef)
     }
   }
 
-  if (!USER_VERSION_ATLEAST(293, 2)) {
-    /* Enable asset browser features by default for alpha testing.
-     * BLO_sanitize_experimental_features_userpref_blend() will disable it again for non-alpha
-     * builds. */
-    userdef->experimental.use_asset_browser = true;
-  }
-
   if (!USER_VERSION_ATLEAST(293, 12)) {
     if (userdef->gizmo_size_navigate_v3d == 0) {
       userdef->gizmo_size_navigate_v3d = 80;
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index dc418a1b3d5..d69a2cae94d 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -36,7 +36,7 @@ using PointerRNAVec = blender::Vector<PointerRNA>;
 
 static bool asset_operation_poll(bContext * /*C*/)
 {
-  return U.experimental.use_asset_browser;
+  return U.experimental.use_extended_asset_browser;
 }
 
 /**
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index d917534895d..8ace057891d 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -952,7 +952,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
   }
 
   /* If the button represents an id, it can set the "id" context pointer. */
-  if (U.experimental.use_asset_browser && ED_asset_can_mark_single_from_context(C)) {
+  if (U.experimental.use_extended_asset_browser && ED_asset_can_mark_single_from_context(C)) {
     ID *id = CTX_data_pointer_get_type(C, "id", &RNA_ID).data;
 
     /* Gray out items depending on if data-block is an asset. Preferably this could be done via
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 0b3349f5751..7deaa2fec60 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -1,4 +1,4 @@
-/*
+/*
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
@@ -334,6 +334,12 @@ static void file_refresh(const bContext *C, ScrArea *area)
     sfile->files = filelist_new(params->type);
     params->highlight_file = -1; /* added this so it opens nicer (ton) */
   }
+
+  if (!U.experimental.use_extended_asset_browser && ED_fileselect_is_asset_browser(sfile)) {
+    /* Only poses supported as non-experimental right now. */
+    params->filter_id = FILTER_ID_AC;
+  }
+
   filelist_settype(sfile->files, params->type);
   filelist_setdir(sfile->files, params->dir);
   filelist_setrecursion(sfile->files, params->recursion_level);
@@ -575,6 +581,16 @@ static void file_main_region_message_subscribe(const wmRegionMessageSubscribePar
     /* All properties for this space type. */
     WM_msg_subscribe_rna(mbus, &ptr, NULL, &msg_sub_value_area_tag_refresh, __func__);
   }
+
+  /* Experimental Asset Browser features option. */
+  {
+    PointerRNA ptr;
+    RNA_pointer_create(NULL, &RNA_PreferencesExperimental, &U.experimental, &ptr);
+    PropertyRNA *prop = RNA_struct_find_property(&ptr, "use_extended_asset_browser");
+
+    /* All properties for this space type. */
+    WM_msg_subscribe_rna(mbus, &ptr, prop, &msg_sub_value_area_tag_refresh, __func__);
+  }
 }
 
 static bool file_main_region_needs_refresh_before_draw(SpaceFile *sfile)
@@ -852,13 +868,7 @@ static void file_space_subtype_item_extend(bContext *UNUSED(C),
                                            EnumPropertyItem **item,
                                            int *totitem)
 {
-  if (U.experimental.use_asset_browser) {
-    RNA_enum_items_add(item, totitem, rna_enum_space_file_browse_mode_items);
-  }
-  else {
-    RNA_enum_items_add_value(
-        item, totitem, rna_enum_space_file_browse_mode_items, FILE_BROWSE_MODE_FILES);
-  }
+  RNA_enum_items_add(item, totitem, rna_enum_space_file_browse_mode_items);
 }
 
 static const char *file_context_dir[] = {
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 5f8a8c6230a..28acf5413b8 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -645,7 +645,7 @@ typedef struct UserDef_Experimental {
   char use_full_frame_compositor;
   char use_sculpt_vertex_colors;
   char use_sculpt_tools_tilt;
-  char use_asset_browser;
+  char use_extended_asset_browser;
   char use_override_templates;
   char _pad[5];
   /** `makesdna` does not allow empty structs. */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 97615016016..1eeb68c3a23 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -499,6 +499,7 @@ extern StructRNA RNA_Pose;
 extern StructRNA RNA_PoseBone;
 extern StructRNA RNA_Preferences;
 extern StructRNA RNA_PreferencesEdit;
+extern StructRNA RNA_PreferencesExperimental;
 extern StructRNA RNA_PreferencesFilePaths;
 extern StructRNA RNA_PreferencesInput;
 extern StructRNA RNA_PreferencesKeymap;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 2d93715a438..483506d5733 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6297,12 +6297,12 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
   RNA_def_property_ui_text(
       prop, "Sculpt Mode Tilt Support", "Support for pen tablet tilt events in Sculpt Mode");
 
-  prop = RNA_def_property(srna, "use_asset_browser", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_sdna(prop, NULL, "use_asset_browser", 1);
-  RNA_def_property_ui_text(
-      prop,
-      "Asset Browser",
-      "Enable Asset Browser editor and operators to manage data-blocks as asset");
+  prop = RNA_def_property(srna, "use_extended_asset_browser", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(prop,
+                           "Extended Asset Browser",
+                           "Enable Asset Browser editor and operators to manage regular "
+                           "data-blocks as assets, not just poses");
+  RNA_def_property_update(prop, 0, "rna_userdef_ui_u

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list