diff options
author | Julian Eisel <julian@blender.org> | 2021-01-13 02:52:10 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-01-13 13:10:17 +0300 |
commit | aed5b88ec1a651faad5f4a95828e1b9d907f0af4 (patch) | |
tree | bafe6858a775e4d359dec83be540b18307aec163 /source/blender | |
parent | 27b78c9c94baf6fa43268e851de58da96f7d7123 (diff) |
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/
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/asset/asset_ops.c | 9 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_context_menu.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tools.c | 3 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 7 |
6 files changed, 29 insertions, 3 deletions
diff --git a/source/blender/editors/asset/asset_ops.c b/source/blender/editors/asset/asset_ops.c index 929d49e19fa..29c3174f051 100644 --- a/source/blender/editors/asset/asset_ops.c +++ b/source/blender/editors/asset/asset_ops.c @@ -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; } diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index 09e3d39c603..24a9558d095 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -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 diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 774dc54700c..aedc6228355 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -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}; diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index f6d6e771801..2a2803c58dd 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -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; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index d9ee9a27294..51699dae641 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -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; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f5a11719912..3a4e395c914 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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) |