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
This commit is contained in:
Julian Eisel 2021-08-11 14:20:49 +02:00
parent 48ba341d15
commit 62cb5c5c4a
Notes: blender-bot 2023-02-14 08:49:53 +01:00
Referenced by issue #90300, Move non Pose Asset functionality to Experimental Feature
Referenced by issue #87658, Remove Asset Browser from experimental features
11 changed files with 35 additions and 36 deletions

View File

@ -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

View File

@ -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

View File

@ -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")),
),
)

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}
/**

View File

@ -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

View File

@ -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[] = {

View File

@ -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. */

View File

@ -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;

View File

@ -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_update");
prop = RNA_def_property(srna, "use_override_templates", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_override_templates", 1);