WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 358 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
2 changed files with 5 additions and 14 deletions
Showing only changes of commit e3ef163816 - Show all commits

View File

@ -1077,6 +1077,7 @@ class VIEW3D_HT_header(Header):
class VIEW3D_AST_brush_asset_shelf(bpy.types.AssetShelf):
bl_space_type = "VIEW_3D"
bl_options = {'NO_ASSET_DRAG'}
@classmethod
def poll(cls, context):
@ -1084,7 +1085,7 @@ class VIEW3D_AST_brush_asset_shelf(bpy.types.AssetShelf):
@classmethod
def asset_poll(cls, asset):
return asset.file_data.id_type == 'BRUSH'
return asset.id_type == 'BRUSH'
class VIEW3D_MT_editor_menus(Menu):

View File

@ -1177,22 +1177,12 @@ static void SCULPT_CURVES_OT_min_distance_edit(wmOperatorType *ot)
static int brush_asset_select_exec(bContext *C, wmOperator * /*op*/)
{
char *brush_name = nullptr;
char asset_libpath[FILE_MAX];
char asset_libpath_full[FILE_MAX_LIBEXTRA];
bool asset_handle_valid;
const AssetHandle asset_handle = CTX_wm_asset_handle(C, &asset_handle_valid);
if (!asset_handle_valid) {
blender::asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
if (!asset) {
return OPERATOR_CANCELLED;
}
AssetRepresentationHandle *asset = ED_asset_handle_get_representation(&asset_handle);
AssetWeakReference *brush_asset_reference = asset->make_weak_reference();
ED_asset_handle_get_full_path(&asset_handle, asset_libpath_full);
BKE_blendfile_library_path_explode(asset_libpath_full, asset_libpath, nullptr, &brush_name);
BLI_assert(brush_name != nullptr);
Brush *brush = BKE_brush_asset_runtime_ensure(CTX_data_main(C), brush_asset_reference);
ToolSettings *tool_settings = CTX_data_tool_settings(C);