Asset System: Disable Asset Browser as experimental feature

The Asset Browser will be disabled and not available for the 2.92 release. In
alpha/beta builds, there will be an "Asset Browser" option under Preferences >
Experimental, if the developer extras are enabled.
Note that this also disables related UI elements (e.g. "Mark Asset" buttons,
Preferences settings for asset libraries, etc.).

The code is still in master of course, development and testing will continue
there. But there simply needs to be too much polishing and fixing before the
2.92 release, plus there are some design decisions to be reevaluated.

Check the milestone 1 project to follow ongoing work:
https://developer.blender.org/project/view/124/
This commit is contained in:
Julian Eisel 2021-01-13 00:52:10 +01:00
parent 27b78c9c94
commit aed5b88ec1
8 changed files with 49 additions and 8 deletions

View File

@ -197,7 +197,8 @@ class FILEBROWSER_PT_filter(Panel):
sub = row.column(align=True)
sub.prop(params, "use_filter_asset_only")
if context.preferences.experimental.use_asset_browser:
sub.prop(params, "use_filter_asset_only")
filter_id = params.filter_id
for identifier in dir(filter_id):
@ -390,7 +391,8 @@ class FILEBROWSER_PT_advanced_filter(Panel):
layout.separator()
col = layout.column(align=True)
col.prop(params, "use_filter_asset_only")
if context.preferences.experimental.use_asset_browser:
col.prop(params, "use_filter_asset_only")
filter_id = params.filter_id
for identifier in dir(filter_id):

View File

@ -1342,6 +1342,11 @@ 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
@ -2188,14 +2193,21 @@ class ExperimentalPanel:
layout.use_property_split = False
layout.use_property_decorate = False
for prop_keywords, task in items:
for prop_keywords, reference in items:
split = layout.split(factor=0.66)
col = split.split()
col.prop(experimental, **prop_keywords)
if task:
if reference:
if type(reference) is tuple:
url_ext = reference[0]
text = reference[1]
else:
url_ext = reference
text = reference
col = split.split()
col.operator("wm.url_open", text=task, icon='URL').url = self.url_prefix + task
col.operator("wm.url_open", text=text, icon='URL').url = self.url_prefix + url_ext
"""
@ -2225,6 +2237,7 @@ class USERPREF_PT_experimental_new_features(ExperimentalPanel, Panel):
({"property": "use_switch_object_operator"}, "T80402"),
({"property": "use_sculpt_tools_tilt"}, "T82877"),
({"property": "use_object_add_tool"}, "T57210"),
({"property": "use_asset_browser"}, ("project/profile/124/", "Milestone 1")),
),
)

View File

@ -26,8 +26,10 @@
#include "BLI_listbase.h"
#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "DNA_asset_types.h"
#include "DNA_userdef_types.h"
#include "ED_asset.h"
@ -47,6 +49,11 @@ struct AssetMarkResultStats {
ID *last_id;
};
static bool asset_ops_poll(bContext *UNUSED(C))
{
return U.experimental.use_asset_browser;
}
/**
* Return the IDs to operate on as list of #CollectionPointerLink links. Needs freeing.
*/
@ -146,6 +153,7 @@ static void ASSET_OT_mark(wmOperatorType *ot)
ot->idname = "ASSET_OT_mark";
ot->exec = asset_mark_exec;
ot->poll = asset_ops_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@ -225,6 +233,7 @@ static void ASSET_OT_clear(wmOperatorType *ot)
ot->idname = "ASSET_OT_clear";
ot->exec = asset_clear_exec;
ot->poll = asset_ops_poll;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}

View File

@ -954,7 +954,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
/* If the button reprents an id, it can set the "id" context pointer. */
if (ED_asset_can_make_single_from_context(C)) {
if (U.experimental.use_asset_browser && ED_asset_can_make_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

@ -776,7 +776,13 @@ static void file_space_subtype_item_extend(bContext *UNUSED(C),
EnumPropertyItem **item,
int *totitem)
{
RNA_enum_items_add(item, totitem, rna_enum_space_file_browse_mode_items);
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);
}
}
static const char *file_context_dir[] = {"active_file", "active_id", NULL};

View File

@ -1791,6 +1791,9 @@ static bool outliner_id_operation_item_poll(bContext *C,
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
switch (enum_value) {
case OUTLINER_IDOP_MARK_ASSET:
case OUTLINER_IDOP_CLEAR_ASSET:
return U.experimental.use_asset_browser;
case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE:
case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE_HIERARCHY:
return true;

View File

@ -644,7 +644,8 @@ typedef struct UserDef_Experimental {
char use_switch_object_operator;
char use_sculpt_tools_tilt;
char use_object_add_tool;
char _pad[7];
char use_asset_browser;
char _pad[6];
/** `makesdna` does not allow empty structs. */
} UserDef_Experimental;

View File

@ -6229,6 +6229,13 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "use_object_add_tool", 1);
RNA_def_property_ui_text(
prop, "Add Object Tool", "Show add object tool in the toolbar in Object Mode and Edit 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");
}
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)