33 static bool rna_AssetMetaData_editable_from_owner_id(
const ID *owner_id,
37 if (owner_id && asset_data && (owner_id->
asset_data == asset_data)) {
43 "Asset metadata from external asset libraries can't be edited, only assets stored in the "
53 return rna_AssetMetaData_editable_from_owner_id(
ptr->
owner_id, asset_data, r_info) ?
58 static int rna_AssetTag_editable(
PointerRNA *
ptr,
const char **r_info)
64 "The owner of the asset tag pointer is not the asset ID containing the tag");
73 static AssetTag *rna_AssetMetaData_tag_new(
76 const char *disabled_info =
NULL;
77 if (!rna_AssetMetaData_editable_from_owner_id(
id, asset_data, &disabled_info)) {
89 reports,
RPT_WARNING,
"Tag '%s' already present for given asset",
result.tag->name);
101 static void rna_AssetMetaData_tag_remove(
ID *
id,
106 const char *disabled_info =
NULL;
107 if (!rna_AssetMetaData_editable_from_owner_id(
id, asset_data, &disabled_info)) {
128 static void rna_AssetMetaData_author_get(
PointerRNA *
ptr,
char *value)
133 strcpy(value, asset_data->
author);
143 return asset_data->
author ? strlen(asset_data->
author) : 0;
146 static void rna_AssetMetaData_author_set(
PointerRNA *
ptr,
const char *value)
162 static void rna_AssetMetaData_description_get(
PointerRNA *
ptr,
char *value)
174 static int rna_AssetMetaData_description_length(
PointerRNA *
ptr)
180 static void rna_AssetMetaData_description_set(
PointerRNA *
ptr,
const char *value)
196 static void rna_AssetMetaData_active_tag_range(
204 static void rna_AssetMetaData_catalog_id_get(
PointerRNA *
ptr,
char *value)
215 static void rna_AssetMetaData_catalog_id_set(
PointerRNA *
ptr,
const char *value)
220 if (value[0] ==
'\0') {
227 printf(
"UUID %s not formatted correctly, ignoring new value\n", value);
248 if (asset_library ==
NULL) {
273 static void rna_AssetHandle_get_full_library_path(
344 "Do not add a new tag if one of the same type already exists");
373 "rna_AssetMetaData_author_get",
374 "rna_AssetMetaData_author_length",
375 "rna_AssetMetaData_author_set");
381 "rna_AssetMetaData_description_get",
382 "rna_AssetMetaData_description_length",
383 "rna_AssetMetaData_description_set");
385 prop,
"Description",
"A description of the asset to be displayed for the user");
392 "Custom tags (name tokens) for the asset, used for filtering and "
393 "general asset management");
402 "rna_AssetMetaData_catalog_id_get",
403 "rna_AssetMetaData_catalog_id_length",
404 "rna_AssetMetaData_catalog_id_set");
409 "Identifier for the asset's catalog, used by Blender to look up the "
410 "asset's catalog path. Must be a UUID according to RFC4122");
415 "Catalog Simple Name",
416 "Simple name of the asset's catalog, for debugging and "
417 "data recovery purposes");
425 func =
RNA_def_function(srna,
"get_full_library_path",
"rna_AssetHandle_get_full_library_path");
430 parm =
RNA_def_pointer(func,
"asset_file_handle",
"FileSelectEntry",
"",
"");
434 "AssetLibraryReference",
436 "The asset library containing the given asset, only valid if the asset "
437 "library is external (i.e. not the \"Current File\" one");
459 prop,
"rna_AssetHandle_file_data_get",
"rna_AssetHandle_file_data_set",
NULL,
NULL);
461 prop,
"File Entry",
"TEMPORARY, DO NOT USE - File data used to refer to the asset");
468 "The local data-block this asset represents; only valid if that is a "
469 "data-block in this file");
479 srna,
"Asset Library Reference",
"Identifier to refer to the asset library");
void BKE_asset_metadata_tag_remove(struct AssetMetaData *asset_data, struct AssetTag *tag)
void BKE_asset_metadata_catalog_id_set(struct AssetMetaData *asset_data, bUUID catalog_id, const char *catalog_simple_name)
void BKE_asset_metadata_catalog_id_clear(struct AssetMetaData *asset_data)
struct AssetTagEnsureResult BKE_asset_metadata_tag_ensure(struct AssetMetaData *asset_data, const char *name)
struct AssetTag * BKE_asset_metadata_tag_add(struct AssetMetaData *asset_data, const char *name)
struct AssetLibrary AssetLibrary
void BKE_asset_library_refresh_catalog_simplename(struct AssetLibrary *asset_library, struct AssetMetaData *asset_data)
struct 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() ATTR_MALLOC
#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 FILE_MAX_LIBEXTRA
struct ID * ED_asset_handle_get_local_id(const struct AssetHandle *asset)
void ED_asset_handle_get_full_library_path(const struct bContext *C, const struct AssetLibraryReference *asset_library_ref, const struct AssetHandle *asset, char r_full_lib_path[])
const struct EnumPropertyItem * ED_asset_library_reference_to_rna_enum_itemf(bool include_local_library)
struct AssetLibrary * ED_fileselect_active_asset_library_get(const struct SpaceFile *sfile)
#define RNA_POINTER_INVALIDATE(ptr)
@ STRUCT_NO_DATABLOCK_IDPROPERTIES
void(* MEM_freeN)(void *vmemh)
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
static void rna_def_asset_data(BlenderRNA *brna)
static void rna_def_asset_handle_api(StructRNA *srna)
static void rna_def_asset_tag(BlenderRNA *brna)
static void rna_def_asset_library_reference(BlenderRNA *brna)
PropertyRNA * rna_def_asset_library_reference_common(struct StructRNA *srna, const char *get, const char *set)
static void rna_def_asset_handle(BlenderRNA *brna)
static void rna_def_asset_tags_api(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_asset(BlenderRNA *brna)
void RNA_define_animate_sdna(bool animate)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
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)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
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_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
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)
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)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
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)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
int rna_AssetMetaData_editable(struct PointerRNA *ptr, const char **r_info)
const EnumPropertyItem * rna_asset_library_reference_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free)
const EnumPropertyItem DummyRNA_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.
static FT_Library library