[Bf-blender-cvs] [fa21019] asset-engine: Add global 'asset search by uuid' helper.
Bastien Montagne
noreply at git.blender.org
Thu May 5 17:19:59 CEST 2016
Commit: fa2101974542e3ea3585e1b2012cd82cb50bf0bf
Author: Bastien Montagne
Date: Thu May 5 17:19:02 2016 +0200
Branches: asset-engine
https://developer.blender.org/rBfa2101974542e3ea3585e1b2012cd82cb50bf0bf
Add global 'asset search by uuid' helper.
===================================================================
M source/blender/blenkernel/BKE_library.h
M source/blender/blenkernel/intern/library.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 791ba75..405728f 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -39,6 +39,7 @@ extern "C" {
#include "BLI_compiler_attrs.h"
struct AssetEngineType;
+struct AssetUUID;
struct BlendThumbnail;
struct ListBase;
struct ID;
@@ -134,6 +135,7 @@ void BKE_library_asset_repository_subdata_remove(struct AssetRef *aref, const vo
void BKE_libraries_asset_subdata_remove(struct Main *bmain, const void *idv);
void BKE_libraries_asset_repositories_clear(struct Main *bmain);
void BKE_libraries_asset_repositories_rebuild(struct Main *bmain);
+struct AssetRef *BKE_libraries_asset_repository_uuid_find(struct Main *bmain, const struct AssetUUID *uuid);
typedef void (*BKE_library_free_window_manager_cb)(struct bContext *, struct wmWindowManager *);
typedef void (*BKE_library_free_notifier_reference_cb)(const void *);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index dcbdcc1..0daab15 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2065,6 +2065,23 @@ void BKE_libraries_asset_repositories_rebuild(Main *bmain)
}
}
+AssetRef *BKE_libraries_asset_repository_uuid_find(Main *bmain, const AssetUUID *uuid)
+{
+ ListBase *lb = which_libbase(bmain, ID_LI);
+ for (Library *lib = lb->first; lib; lib = lib->id.next) {
+ for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
+ if (ASSETUUID_COMPARE(&aref->uuid, uuid)) {
+#ifndef NDEBUG
+ LinkData *link = aref->id_list.first;
+ BLI_assert(link && ((ID *)link->data)->uuid && ASSETUUID_COMPARE(((ID *)link->data)->uuid, uuid));
+#endif
+ return aref;
+ }
+ }
+ }
+ return NULL;
+}
+
/**
* Use after setting the ID's name
* When name exists: call 'new_id'
More information about the Bf-blender-cvs
mailing list