Brush Assets: Add library choice to "Save As" operator #118021

Merged
Hans Goudey merged 14 commits from HooglyBoogly/blender:brush-assets-save-library-option into brush-assets-project 2024-02-14 17:36:57 +01:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit 922a42785a - Show all commits

View File

@ -1316,6 +1316,11 @@ static int brush_asset_save_as_exec(bContext *C, wmOperator *op)
static int brush_asset_save_as_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
RNA_string_set(op->ptr, "name", brush->id.name + 2);
if (const bUserAssetLibrary *library = brush_asset_get_default_library()) {
AssetLibraryReference library_ref{};
library_ref.custom_library_index = BLI_findindex(&U.asset_libraries, library);
@ -1324,11 +1329,6 @@ static int brush_asset_save_as_invoke(bContext *C, wmOperator *op, const wmEvent
op->ptr, "asset_library_reference", asset::library_reference_to_enum_value(&library_ref));
}
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
RNA_string_set(op->ptr, "name", brush->id.name + 2);
return WM_operator_props_dialog_popup(C, op, 400, std::nullopt, IFACE_("Save"));
}