Cleanup: Simplify asset metadata copy function

Also move the destructor declaration to be consistent with the style guide.
This commit is contained in:
Hans Goudey
2024-02-14 12:06:56 -05:00
parent 48dee674f3
commit 1c3c1e7776
2 changed files with 9 additions and 17 deletions

View File

@@ -52,18 +52,10 @@ AssetMetaData *BKE_asset_metadata_copy(const AssetMetaData *source)
BKE_asset_metadata_catalog_id_set(copy, source->catalog_id, source->catalog_simple_name);
if (source->author) {
copy->author = BLI_strdup(source->author);
}
if (source->description) {
copy->description = BLI_strdup(source->description);
}
if (source->copyright) {
copy->copyright = BLI_strdup(source->copyright);
}
if (source->license) {
copy->license = BLI_strdup(source->license);
}
copy->author = BLI_strdup_null(source->author);
copy->description = BLI_strdup_null(source->description);
copy->copyright = BLI_strdup_null(source->copyright);
copy->license = BLI_strdup_null(source->license);
BLI_duplicatelist(&copy->tags, &source->tags);
copy->active_tag = source->active_tag;

View File

@@ -50,11 +50,6 @@ typedef struct AssetFilterSettings {
* more than that from the file. So pointers to other IDs or ID data are strictly forbidden.
*/
typedef struct AssetMetaData {
#ifdef __cplusplus
/** Enables use with `std::unique_ptr<AssetMetaData>`. */
~AssetMetaData();
#endif
/** Runtime type, to reference event callbacks. Only valid for local assets. */
struct AssetTypeInfo *local_type_info;
@@ -96,6 +91,11 @@ typedef struct AssetMetaData {
short tot_tags;
char _pad[4];
#ifdef __cplusplus
/** Enables use with `std::unique_ptr<AssetMetaData>`. */
~AssetMetaData();
#endif
} AssetMetaData;
typedef enum eAssetLibraryType {