UI: Asset Shelf (Experimental Feature) #104831

Closed
Julian Eisel wants to merge 399 commits from asset-shelf into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 9 additions and 10 deletions
Showing only changes of commit 061469eb90 - Show all commits

View File

@ -8297,7 +8297,7 @@ class VIEW3D_AST_sculpt_brushes(bpy.types.AssetShelf):
return bool(context.object and context.object.mode == 'SCULPT')
@classmethod
def asset_poll_temp_api(cls, asset):
def asset_poll(cls, asset):
return asset.file_data.id_type == 'BRUSH'

View File

@ -10,7 +10,7 @@ class MyAssetShelf(bpy.types.AssetShelf):
return bool(context.object and context.object.mode == 'OBJECT')
@classmethod
def asset_poll_temp_api(cls, asset):
def asset_poll(cls, asset):
return asset.file_data.id_type in {'MATERIAL', 'OBJECT'}

View File

@ -673,7 +673,7 @@ static void asset_shelf_header_draw(const bContext *C, Header *header)
uiItemSpacer(layout);
uiItemR(layout, &shelf_ptr, "search_filter", 0, "", ICON_VIEWZOOM);
uiItemR(layout, &shelf_ptr, "search_filter", UI_ITEM_NONE, "", ICON_VIEWZOOM);
uiItemS(layout);
uiItemPopoverPanel(layout, C, "ASSETSHELF_PT_display", "", ICON_IMGDISPLAY);
}

View File

@ -1082,11 +1082,11 @@ static StructRNA *rna_Menu_refine(PointerRNA *mtr)
static bool asset_shelf_asset_poll(const AssetShelfType *shelf_type, const AssetHandle *asset)
{
extern FunctionRNA rna_AssetShelf_asset_poll_temp_api_func;
extern FunctionRNA rna_AssetShelf_asset_poll_func;
PointerRNA ptr;
RNA_pointer_create(nullptr, shelf_type->rna_ext.srna, nullptr, &ptr); /* dummy */
FunctionRNA *func = &rna_AssetShelf_asset_poll_temp_api_func;
FunctionRNA *func = &rna_AssetShelf_asset_poll_func;
ParameterList list;
RNA_parameter_list_create(&list, &ptr, func);
@ -2125,18 +2125,17 @@ static void rna_def_asset_shelf(BlenderRNA *brna)
func = RNA_def_function(srna, "poll", nullptr);
RNA_def_function_ui_description(
func, "If this method returns a non-null output, then the asset shelf will be visible");
func, "If this method returns a non-null output, the asset shelf will be visible");
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
RNA_def_function_return(func, RNA_def_boolean(func, "visible", true, "", ""));
parm = RNA_def_pointer(func, "context", "Context", "", "");
RNA_def_parameter_flags(parm, PropertyFlag(0), PARM_REQUIRED);
func = RNA_def_function(srna, "asset_poll_temp_api", nullptr);
func = RNA_def_function(srna, "asset_poll", nullptr);
RNA_def_function_ui_description(
func,
"TEMPORARY DESIGN; Expect compatibility breakage. Determine if an asset should be visible "
"in the asset shelf. If this method returns a non-null output, then the asset shelf will be "
"visible");
"Determine if an asset should be visible in the asset shelf. If this method returns a "
"non-null output, the asset will be visible");
RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
RNA_def_function_return(func, RNA_def_boolean(func, "visible", true, "", ""));
parm = RNA_def_pointer(func, "asset_handle", "AssetHandle", "", "");