27 "Show assets from all of the listed asset libraries"},
32 "Show the assets currently available in this Blender session"},
37 "Show the basic building blocks and utilities coming with Blender"},
42 "Show assets from the asset libraries configured in the Preferences"},
43 {0,
nullptr, 0,
nullptr,
nullptr},
49# include <fmt/format.h>
68static std::optional<std::string> rna_AssetMetaData_path(
const PointerRNA * )
73static bool rna_AssetMetaData_editable_from_owner_id(
const ID *owner_id,
77 if (owner_id && asset_data && (owner_id->
asset_data == asset_data)) {
83 "Asset metadata from external asset libraries can't be edited, only assets stored in the "
93 return rna_AssetMetaData_editable_from_owner_id(
ptr->
owner_id, asset_data, r_info) ?
98static std::optional<std::string> rna_AssetTag_path(
const PointerRNA *
ptr)
101 char asset_tag_name_esc[
sizeof(asset_tag->
name) * 2];
103 return fmt::format(
"asset_data.tags[\"{}\"]", asset_tag_name_esc);
106static int rna_AssetTag_editable(
const PointerRNA *
ptr,
const char **r_info)
112 "The owner of the asset tag pointer is not the asset ID containing the tag");
116 return rna_AssetMetaData_editable_from_owner_id(
122static AssetTag *rna_AssetMetaData_tag_new(
125 const char *disabled_info =
nullptr;
126 if (!rna_AssetMetaData_editable_from_owner_id(
id, asset_data, &disabled_info)) {
133 if (skip_if_exists) {
136 if (!result.is_new) {
138 reports,
RPT_WARNING,
"Tag '%s' already present for given asset", result.tag->name);
150static void rna_AssetMetaData_tag_remove(
ID *
id,
155 const char *disabled_info =
nullptr;
156 if (!rna_AssetMetaData_editable_from_owner_id(
id, asset_data, &disabled_info)) {
177static void rna_AssetMetaData_author_get(
PointerRNA *
ptr,
char *value)
182 strcpy(value, asset_data->
author);
192 return asset_data->
author ? strlen(asset_data->
author) : 0;
195static void rna_AssetMetaData_author_set(
PointerRNA *
ptr,
const char *value)
207 asset_data->
author =
nullptr;
211static void rna_AssetMetaData_description_get(
PointerRNA *
ptr,
char *value)
223static int rna_AssetMetaData_description_length(
PointerRNA *
ptr)
229static void rna_AssetMetaData_description_set(
PointerRNA *
ptr,
const char *value)
245static void rna_AssetMetaData_copyright_get(
PointerRNA *
ptr,
char *value)
257static int rna_AssetMetaData_copyright_length(
PointerRNA *
ptr)
263static void rna_AssetMetaData_copyright_set(
PointerRNA *
ptr,
const char *value)
279static void rna_AssetMetaData_license_get(
PointerRNA *
ptr,
char *value)
284 strcpy(value, asset_data->
license);
297static void rna_AssetMetaData_license_set(
PointerRNA *
ptr,
const char *value)
313static void rna_AssetMetaData_active_tag_range(
318 *max = *softmax = std::max(
int(asset_data->
tot_tags - 1), 0);
321static void rna_AssetMetaData_catalog_id_get(
PointerRNA *
ptr,
char *value)
327static int rna_AssetMetaData_catalog_id_length(
PointerRNA * )
332static void rna_AssetMetaData_catalog_id_set(
PointerRNA *
ptr,
const char *value)
337 if (value[0] ==
'\0') {
344 printf(
"UUID %s not formatted correctly, ignoring new value\n", value);
358 if (sfile ==
nullptr) {
366 if (asset_library ==
nullptr) {
391static void rna_AssetRepresentation_name_get(
PointerRNA *
ptr,
char *value)
398static int rna_AssetRepresentation_name_length(
PointerRNA *
ptr)
423static int rna_AssetRepresentation_id_type_get(
PointerRNA *
ptr)
435static void rna_AssetRepresentation_full_library_path_get(
PointerRNA *
ptr,
char *value)
439 BLI_strncpy(value, full_library_path.c_str(), full_library_path.size() + 1);
442static int rna_AssetRepresentation_full_library_path_length(
PointerRNA *
ptr)
446 return full_library_path.size();
449static void rna_AssetRepresentation_full_path_get(
PointerRNA *
ptr,
char *value)
452 const std::string full_path = asset->
full_path();
453 BLI_strncpy(value, full_path.c_str(), full_path.size() + 1);
456static int rna_AssetRepresentation_full_path_length(
PointerRNA *
ptr)
459 const std::string full_path = asset->
full_path();
460 return full_path.size();
517 "Do not add a new tag if one of the same type already exists");
547 "rna_AssetMetaData_author_get",
548 "rna_AssetMetaData_author_length",
549 "rna_AssetMetaData_author_set");
555 "rna_AssetMetaData_description_get",
556 "rna_AssetMetaData_description_length",
557 "rna_AssetMetaData_description_set");
559 prop,
"Description",
"A description of the asset to be displayed for the user");
564 "rna_AssetMetaData_copyright_get",
565 "rna_AssetMetaData_copyright_length",
566 "rna_AssetMetaData_copyright_set");
570 "Copyright notice for this asset. An empty copyright notice does not necessarily indicate "
571 "that this is copyright-free. Contact the author if any clarification is needed.");
576 "rna_AssetMetaData_license_get",
577 "rna_AssetMetaData_license_length",
578 "rna_AssetMetaData_license_set");
581 "The type of license this asset is distributed under. An empty license "
582 "name does not necessarily indicate that this is free of licensing "
583 "terms. Contact the author if any clarification is needed.");
590 "Custom tags (name tokens) for the asset, used for filtering and "
591 "general asset management");
600 "rna_AssetMetaData_catalog_id_get",
601 "rna_AssetMetaData_catalog_id_length",
602 "rna_AssetMetaData_catalog_id_set");
607 "Identifier for the asset's catalog, used by Blender to look up the "
608 "asset's catalog path. Must be a UUID according to RFC4122.");
613 "Catalog Simple Name",
614 "Simple name of the asset's catalog, for debugging and "
615 "data recovery purposes");
633 prop,
"rna_AssetHandle_file_data_get",
"rna_AssetHandle_file_data_set",
nullptr,
nullptr);
635 prop,
"File Entry",
"TEMPORARY, DO NOT USE - File data used to refer to the asset");
645 "Asset Representation",
646 "Information about an entity that makes it possible for the asset system "
647 "to deal with the entity as asset");
652 prop,
"rna_AssetRepresentation_name_get",
"rna_AssetRepresentation_name_length",
nullptr);
659 prop,
"rna_AssetRepresentation_metadata_get",
nullptr,
nullptr,
nullptr);
671 "The type of the data-block, if the asset represents one ('NONE' otherwise)");
677 prop,
"rna_AssetRepresentation_local_id_get",
nullptr,
nullptr,
nullptr);
680 "The local data-block this asset represents; only valid if that is a "
681 "data-block in this file");
686 "rna_AssetRepresentation_full_library_path_get",
687 "rna_AssetRepresentation_full_library_path_length",
691 prop,
"Full Library Path",
"Absolute path to the .blend file containing this asset");
696 "rna_AssetRepresentation_full_path_get",
697 "rna_AssetRepresentation_full_path_length",
703 "Absolute path to the .blend file containing this asset extended with the path "
704 "of the asset inside the file");
717 srna,
"Asset Library Reference",
"Identifier to refer to the asset library");
Main runtime representation of an asset.
AssetTag AssetTagEnsureResult BKE_asset_metadata_tag_ensure(AssetMetaData *asset_data, const char *name)
AssetTag * BKE_asset_metadata_tag_add(AssetMetaData *asset_data, const char *name) ATTR_NONNULL(1
void BKE_asset_metadata_catalog_id_clear(AssetMetaData *asset_data)
void BKE_asset_metadata_catalog_id_set(AssetMetaData *asset_data, bUUID catalog_id, const char *catalog_simple_name)
void BKE_asset_metadata_tag_remove(AssetMetaData *asset_data, AssetTag *tag)
SpaceFile * CTX_wm_space_file(const bContext *C)
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_msg(a, msg)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define UNUSED_VARS_NDEBUG(...)
bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) ATTR_NONNULL()
void BLI_uuid_format(char *buffer, bUUID uuid) ATTR_NONNULL()
#define BLT_I18NCONTEXT_ID_ID
@ ASSET_LIBRARY_ESSENTIALS
blender::asset_system::AssetLibrary * ED_fileselect_active_asset_library_get(const SpaceFile *sfile)
#define RNA_POINTER_INVALIDATE(ptr)
@ STRUCT_NO_DATABLOCK_IDPROPERTIES
constexpr int64_t size() const
void refresh_catalog_simplename(AssetMetaData *asset_data)
std::string full_path() const
AssetMetaData & get_metadata() const
ID_Type get_id_type() const
std::string full_library_path() const
StringRefNull get_name() const
void MEM_freeN(void *vmemh)
const EnumPropertyItem * library_reference_to_rna_enum_itemf(bool include_generated)
const EnumPropertyItem rna_enum_id_type_items[]
PointerRNA rna_pointer_inherit_refine(const PointerRNA *ptr, StructRNA *type, void *data)
PointerRNA RNA_id_pointer_create(ID *id)
static void rna_def_asset_data(BlenderRNA *brna)
static void rna_def_asset_tag(BlenderRNA *brna)
static void rna_def_asset_library_reference(BlenderRNA *brna)
static void rna_def_asset_handle(BlenderRNA *brna)
const EnumPropertyItem rna_enum_asset_library_type_items[]
static void rna_def_asset_catalog_path(BlenderRNA *brna)
static void rna_def_asset_tags_api(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_asset_representation(BlenderRNA *brna)
static void rna_def_asset_weak_reference(BlenderRNA *brna)
void RNA_def_asset(BlenderRNA *brna)
PropertyRNA * rna_def_asset_library_reference_common(StructRNA *srna, const char *get, const char *set)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
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_struct_path_func(StructRNA *srna, const char *path)
void RNA_define_animate_sdna(bool animate)
void RNA_def_struct_flag(StructRNA *srna, int flag)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
const EnumPropertyItem * rna_asset_library_reference_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
int rna_AssetMetaData_editable(const PointerRNA *ptr, const char **r_info)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
const struct FileDirEntry * file_data
User defined tag. Currently only used by assets, could be used more often at some point....
struct AssetMetaData * asset_data
Universally Unique Identifier according to RFC4122.