WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 381 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.
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 2dec98b69f - Show all commits

View File

@ -1302,7 +1302,7 @@ static void BRUSH_OT_asset_save_as(wmOperatorType *ot)
RNA_def_string(ot->srna, "name", nullptr, MAX_NAME, "Name", "Name used to save the brush asset"); RNA_def_string(ot->srna, "name", nullptr, MAX_NAME, "Name", "Name used to save the brush asset");
} }
static bool asset_is_editable(const AssetWeakReference &brush_weak_ref) static bool asset_is_editable(const AssetWeakReference &asset_weak_ref)
{ {
/* Fairly simple checks, based on filepath only: /* Fairly simple checks, based on filepath only:
* - The blendlib filepath ends up with the `.asset.blend` extension. * - The blendlib filepath ends up with the `.asset.blend` extension.
@ -1313,7 +1313,7 @@ static bool asset_is_editable(const AssetWeakReference &brush_weak_ref)
char path_buffer[FILE_MAX_LIBEXTRA]; char path_buffer[FILE_MAX_LIBEXTRA];
char *dir, *group, *name; char *dir, *group, *name;
AS_asset_full_path_explode_from_weak_ref(&brush_weak_ref, path_buffer, &dir, &group, &name); AS_asset_full_path_explode_from_weak_ref(&asset_weak_ref, path_buffer, &dir, &group, &name);
if (!StringRef(dir).endswith(BLENDER_ASSET_FILE_SUFFIX)) { if (!StringRef(dir).endswith(BLENDER_ASSET_FILE_SUFFIX)) {
return false; return false;
@ -1419,13 +1419,13 @@ static int brush_asset_update_exec(bContext *C, wmOperator *op)
{ {
Paint *paint = BKE_paint_get_active_from_context(C); Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = nullptr; Brush *brush = nullptr;
const AssetWeakReference *brush_weak_ref = const AssetWeakReference *asset_weak_ref =
BKE_paint_brush_asset_get(paint, &brush).value_or(nullptr); BKE_paint_brush_asset_get(paint, &brush).value_or(nullptr);
char path_buffer[FILE_MAX_LIBEXTRA]; char path_buffer[FILE_MAX_LIBEXTRA];
char *filepath; char *filepath;
AS_asset_full_path_explode_from_weak_ref( AS_asset_full_path_explode_from_weak_ref(
brush_weak_ref, path_buffer, &filepath, nullptr, nullptr); asset_weak_ref, path_buffer, &filepath, nullptr, nullptr);
BLI_assert(BKE_paint_brush_is_valid_asset(brush)); BLI_assert(BKE_paint_brush_is_valid_asset(brush));