Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/asset/intern/asset_mark_clear.cc
| Show All 34 Lines | |||||
| #include "UI_interface_icons.h" | #include "UI_interface_icons.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "ED_asset_list.h" | #include "ED_asset_list.h" | ||||
| #include "ED_asset_mark_clear.h" | #include "ED_asset_mark_clear.h" | ||||
| bool ED_asset_mark_id(const bContext *C, ID *id) | bool ED_asset_mark_id(ID *id) | ||||
| { | { | ||||
| if (id->asset_data) { | if (id->asset_data) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (!BKE_id_can_be_asset(id)) { | if (!BKE_id_can_be_asset(id)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| id_fake_user_set(id); | id_fake_user_set(id); | ||||
| id->asset_data = BKE_asset_metadata_create(); | id->asset_data = BKE_asset_metadata_create(); | ||||
| UI_icon_render_id(C, nullptr, id, ICON_SIZE_PREVIEW, true); | |||||
| /* Important for asset storage to update properly! */ | /* Important for asset storage to update properly! */ | ||||
| ED_assetlist_storage_tag_main_data_dirty(); | ED_assetlist_storage_tag_main_data_dirty(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| void ED_asset_generate_preview(const bContext *C, ID *id) | |||||
| { | |||||
| UI_icon_render_id(C, nullptr, id, ICON_SIZE_PREVIEW, true); | |||||
| } | |||||
| bool ED_asset_clear_id(ID *id) | bool ED_asset_clear_id(ID *id) | ||||
| { | { | ||||
| if (!id->asset_data) { | if (!id->asset_data) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| BKE_asset_metadata_free(&id->asset_data); | BKE_asset_metadata_free(&id->asset_data); | ||||
| id_fake_user_clear(id); | id_fake_user_clear(id); | ||||
| Show All 11 Lines | |||||