86 ot->
name =
"Activate Brush Asset";
87 ot->
description =
"Activate a brush asset as current sculpt and paint tool";
88 ot->
idname =
"BRUSH_OT_asset_activate";
144 if (paint ==
nullptr || brush ==
nullptr) {
179#if defined(__GNUC__) && !defined(__clang__)
180# pragma GCC diagnostic push
181# pragma GCC diagnostic ignored "-Wdangling-reference"
192 parent = parent / component_name;
196#if defined(__GNUC__) && !defined(__clang__)
197# pragma GCC diagnostic pop
211 U.runtime.is_dirty =
true;
229 if (name[0] ==
'\0') {
257 if (catalog_path[0]) {
259 *library, catalog_path);
265 *bmain, brush->
id, name, *user_library, brush_asset_reference, *op->
reports);
266 if (!final_full_asset_filepath) {
273 brush =
reinterpret_cast<Brush *
>(
302 *C, brush_weak_ref, op->
reports);
320 "asset_library_reference",
327 "asset_library_reference",
387 const char *edit_text,
399 ot->
name =
"Save as Brush Asset";
401 "Save a copy of the active brush asset into the default asset library, and make it the "
403 ot->
idname =
"BRUSH_OT_asset_save_as";
410 ot->
srna,
"name",
nullptr,
MAX_NAME,
"Name",
"Name for the new brush asset");
417 ot->
srna,
"catalog_path",
nullptr,
MAX_NAME,
"Catalog",
"Catalog to use for the new asset");
430 *C, brush_weak_ref, op->
reports);
447 if (catalog_path[0]) {
449 *library, catalog_path);
458 char *file_path =
nullptr;
460 &brush_weak_ref, asset_full_path_buffer, &file_path,
nullptr,
nullptr);
479 *C, brush_weak_ref, op->
reports);
506 const char *edit_text,
512 *C, brush_weak_ref,
nullptr);
530 if (paint ==
nullptr || brush ==
nullptr) {
538 if (!brush_weak_ref) {
543 *C, *brush_weak_ref,
nullptr);
567 ot->
name =
"Edit Metadata";
568 ot->
description =
"Edit asset information like the catalog, preview image, tags, or author";
569 ot->
idname =
"BRUSH_OT_asset_edit_metadata";
576 ot->
srna,
"catalog_path",
nullptr,
MAX_NAME,
"Catalog",
"The asset's catalog path");
591 *C, brush_weak_ref, op->
reports);
626 ot->
name =
"Load Preview Image";
628 ot->
idname =
"BRUSH_OT_asset_load_preview";
647 if (paint ==
nullptr || brush ==
nullptr) {
695 IFACE_(
"Delete Brush Asset"),
697 IFACE_(
"Permanently delete brush asset blend file. This cannot be undone.") :
698 IFACE_(
"Permanently delete brush. This cannot be undone."),
706 ot->
name =
"Delete Brush Asset";
708 ot->
idname =
"BRUSH_OT_asset_delete";
719 if (paint ==
nullptr || brush ==
nullptr) {
766 ot->
name =
"Save Brush Asset";
767 ot->
description =
"Update the active brush asset in the asset library with current settings";
778 if (paint ==
nullptr || brush ==
nullptr) {
809 ot->
name =
"Revert Brush Asset";
811 "Revert the active brush settings to the default values from the asset library";
812 ot->
idname =
"BRUSH_OT_asset_revert";
blender::asset_system::AssetLibrary * AS_asset_library_load(const Main *bmain, const AssetLibraryReference &library_reference)
std::string AS_asset_library_root_path_from_library_ref(const AssetLibraryReference &library_reference)
void AS_asset_full_path_explode_from_weak_ref(const AssetWeakReference *asset_reference, char r_path_buffer[1090], char **r_dir, char **r_group, char **r_name)
Main runtime representation of an asset.
void BKE_asset_metadata_catalog_id_set(AssetMetaData *asset_data, bUUID catalog_id, const char *catalog_simple_name)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool BKE_paint_brush_set(Paint *paint, Brush *brush)
Paint * BKE_paint_get_active_from_context(const bContext *C)
bool BKE_paint_brush_set_default(Main *bmain, Paint *paint)
Brush * BKE_paint_brush(Paint *paint)
struct bUserAssetLibrary * BKE_preferences_asset_library_find_index(const struct UserDef *userdef, int index) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
struct bUserAssetLibrary * BKE_preferences_asset_library_find_by_name(const struct UserDef *userdef, const char *name) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(UserDef *userdef, const char *shelf_idname, const char *catalog_path)
void BKE_previewimg_id_custom_set(ID *id, const char *filepath)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_unreachable()
File and directory operations.
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_path_cmp_normalized(const char *p1, const char *p2) ATTR_NONNULL(1
#define STRNCPY(dst, src)
#define ID_IS_LINKED(_id)
@ ASSET_LIBRARY_ESSENTIALS
#define FILE_MAX_LIBEXTRA
@ PROP_STRING_SEARCH_SUGGESTION
constexpr bool is_empty() const
constexpr const char * c_str() const
const std::string & str() const
void iterate_components(ComponentIteratorFn callback) const
AssetCatalog * find_catalog_by_path(const AssetCatalogPath &path) const
AssetCatalog * find_catalog(CatalogID catalog_id) const
bool write_to_disk(const CatalogFilePath &blend_file_path)
AssetCatalog * create_catalog(const AssetCatalogPath &catalog_path)
const AssetCatalogTree & catalog_tree()
AssetCatalogPath catalog_path() const
void foreach_item(ItemIterFn callback) const
const CatalogID catalog_id
AssetCatalogService & catalog_service() const
StringRefNull root_path() const
AssetMetaData & get_metadata() const
const AssetLibrary & owner_asset_library() const
AssetWeakReference make_weak_reference() const
StringRefNull get_name() const
AssetLibraryReference all_library_reference()
Vector< AssetLibraryReference > all_valid_asset_library_refs()
ID * asset_edit_id_from_weak_reference(Main &global_main, ID_Type id_type, const AssetWeakReference &weak_ref)
std::optional< std::string > asset_edit_id_save_as(Main &global_main, const ID &id, StringRefNull name, const bUserAssetLibrary &user_library, AssetWeakReference &r_weak_ref, ReportList &reports)
ID * asset_edit_id_revert(Main &global_main, ID &id, ReportList &reports)
bool asset_edit_id_delete(Main &global_main, ID &id, ReportList &reports)
bool asset_edit_id_is_writable(const ID &id)
bool asset_edit_id_is_editable(const ID &id)
bool asset_edit_id_save(Main &global_main, const ID &id, ReportList &reports)
void clear(const AssetLibraryReference *library_reference, const bContext *C)
AssetShelf * active_shelf_from_area(const ScrArea *area)
const asset_system::AssetRepresentation * find_asset_from_weak_ref(const bContext &C, const AssetWeakReference &weak_ref, ReportList *reports)
int library_reference_to_enum_value(const AssetLibraryReference *library)
AssetLibraryReference library_reference_from_enum_value(int value)
void operator_asset_reference_props_register(StructRNA &srna)
const EnumPropertyItem * library_reference_to_rna_enum_itemf(bool include_generated)
void generate_preview(const bContext *C, ID *id)
const asset_system::AssetRepresentation * operator_asset_reference_props_get_asset_from_all_library(const bContext &C, PointerRNA &ptr, ReportList *reports)
static const bUserAssetLibrary * get_asset_library_from_prop(PointerRNA &ptr)
static int brush_asset_edit_metadata_exec(bContext *C, wmOperator *op)
static int brush_asset_edit_metadata_invoke(bContext *C, wmOperator *op, const wmEvent *)
static std::optional< AssetLibraryReference > library_to_library_ref(const asset_system::AssetLibrary &library)
void BRUSH_OT_asset_save(wmOperatorType *ot)
static int brush_asset_delete_exec(bContext *C, wmOperator *op)
static bool brush_asset_edit_metadata_poll(bContext *C)
void BRUSH_OT_asset_delete(wmOperatorType *ot)
void BRUSH_OT_asset_edit_metadata(wmOperatorType *ot)
static asset_system::AssetCatalog & asset_library_ensure_catalogs_in_path(asset_system::AssetLibrary &library, const asset_system::AssetCatalogPath &path)
static bool brush_asset_delete_poll(bContext *C)
static void refresh_asset_library(const bContext *C, const AssetLibraryReference &library_ref)
static asset_system::AssetCatalog & asset_library_ensure_catalog(asset_system::AssetLibrary &library, const asset_system::AssetCatalogPath &path)
static void visit_library_prop_catalogs_catalog_for_search_fn(const bContext *C, PointerRNA *ptr, PropertyRNA *, const char *edit_text, FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
static int brush_asset_delete_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool library_is_editable(const AssetLibraryReference &library)
static void visit_active_library_catalogs_catalog_for_search_fn(const bContext *C, PointerRNA *, PropertyRNA *, const char *edit_text, FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
static int brush_asset_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int brush_asset_load_preview_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void BRUSH_OT_asset_load_preview(wmOperatorType *ot)
static void show_catalog_in_asset_shelf(const bContext &C, const StringRefNull catalog_path)
static bool brush_asset_save_as_poll(bContext *C)
static bool brush_asset_revert_poll(bContext *C)
static int brush_asset_load_preview_exec(bContext *C, wmOperator *op)
static int brush_asset_save_exec(bContext *C, wmOperator *op)
static int brush_asset_activate_exec(bContext *C, wmOperator *op)
void BRUSH_OT_asset_revert(wmOperatorType *ot)
static bool brush_asset_save_poll(bContext *C)
static const bUserAssetLibrary * library_ref_to_user_library(const AssetLibraryReference &library_ref)
static AssetLibraryReference user_library_to_library_ref(const bUserAssetLibrary &user_library)
void BRUSH_OT_asset_save_as(wmOperatorType *ot)
static int brush_asset_revert_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem * rna_asset_library_reference_itemf(bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
static int brush_asset_save_as_exec(bContext *C, wmOperator *op)
void BRUSH_OT_asset_activate(wmOperatorType *ot)
static void visit_library_catalogs_catalog_for_search(const Main &bmain, const bUserAssetLibrary &user_library, const StringRef edit_text, const FunctionRef< void(StringPropertySearchVisitParams)> visit_fn)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_string_search_func_runtime(PropertyRNA *prop, StringPropertySearchFunc search_fn, const eStringPropertySearchFlag search_flag)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
const char * asset_library_identifier
struct AssetMetaData * asset_data
struct AssetWeakReference * brush_asset_reference
Universally Unique Identifier according to RFC4122.
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
int WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, int icon, bool cancel_default)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default)
bScreen * WM_window_get_active_screen(const wmWindow *win)