[Bf-blender-cvs] [9c9bc6e131a] asset-engine: Cleanup/internal renaming.

Bastien Montagne noreply at git.blender.org
Wed Feb 7 10:26:55 CET 2018


Commit: 9c9bc6e131ab2c5cdeb56ede632cbf096afe7210
Author: Bastien Montagne
Date:   Mon Feb 5 16:11:29 2018 +0100
Branches: asset-engine
https://developer.blender.org/rB9c9bc6e131ab2c5cdeb56ede632cbf096afe7210

Cleanup/internal renaming.

===================================================================

M	source/blender/blenkernel/BKE_asset_engine.h
M	source/blender/blenkernel/intern/asset_engine.c
M	source/blender/blenkernel/intern/library_asset.c
M	source/blender/windowmanager/intern/wm_files_link.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_asset_engine.h b/source/blender/blenkernel/BKE_asset_engine.h
index fa99c2d12c4..9f8276b6329 100644
--- a/source/blender/blenkernel/BKE_asset_engine.h
+++ b/source/blender/blenkernel/BKE_asset_engine.h
@@ -116,7 +116,7 @@ typedef int (*ae_previews_get)(struct AssetEngine *engine, const int job_id, str
  * uuids tagged as needing reload will then be reloaded as new ones
  * (ae_load_pre, then actual lib loading, then ae_load_post).
  * \warning This callback is expected to handle **real** UUIDS (not 'users' filebrowser ones),
- *          i.e. calling ae_load_pre with those shall **not** alters them in returned direntries
+ *          i.e. calling ae_load_pre with those shall **not** alter them in returned direntries
  *          (else 'link' between old IDs and reloaded ones would be broken). */
 typedef int (*ae_update_check)(struct AssetEngine *engine, const int job_id, struct AssetUUIDList *uuids);
 
@@ -262,15 +262,15 @@ struct FileDirEntry *BKE_filedir_entry_copy(struct FileDirEntry *entry);
 
 void BKE_filedir_entryarr_clear(struct FileDirEntryArr *array);
 
-#define ASSETUUID_SUB_COMPARE(_uuida, _uuidb, _member) \
+#define ASSETUUID_SUB_EQUAL(_uuida, _uuidb, _member) \
 	(memcmp((_uuida)->_member, (_uuidb)->_member, sizeof((_uuida)->_member)) == 0)
 
-#define ASSETUUID_COMPARE(_uuida, _uuidb) \
-	(ASSETUUID_SUB_COMPARE(_uuida, _uuidb, uuid_repository) && \
-	 ASSETUUID_SUB_COMPARE(_uuida, _uuidb, uuid_asset) && \
-	 ASSETUUID_SUB_COMPARE(_uuida, _uuidb, uuid_variant) && \
-	 ASSETUUID_SUB_COMPARE(_uuida, _uuidb, uuid_revision) && \
-	 ASSETUUID_SUB_COMPARE(_uuida, _uuidb, uuid_view))
+#define ASSETUUID_EQUAL(_uuida, _uuidb) \
+	(ASSETUUID_SUB_EQUAL(_uuida, _uuidb, uuid_repository) && \
+	 ASSETUUID_SUB_EQUAL(_uuida, _uuidb, uuid_asset) && \
+	 ASSETUUID_SUB_EQUAL(_uuida, _uuidb, uuid_variant) && \
+	 ASSETUUID_SUB_EQUAL(_uuida, _uuidb, uuid_revision) && \
+	 ASSETUUID_SUB_EQUAL(_uuida, _uuidb, uuid_view))
 
 /* Various helpers */
 unsigned int BKE_asset_uuid_hash(const void *key);
diff --git a/source/blender/blenkernel/intern/asset_engine.c b/source/blender/blenkernel/intern/asset_engine.c
index ce8207be348..b9cd584e306 100644
--- a/source/blender/blenkernel/intern/asset_engine.c
+++ b/source/blender/blenkernel/intern/asset_engine.c
@@ -474,7 +474,7 @@ bool BKE_asset_uuid_cmp(const void *a, const void *b)
 {
 	const AssetUUID *uuid1 = a;
 	const AssetUUID *uuid2 = b;
-	return !ASSETUUID_COMPARE(uuid1, uuid2);  /* Expects false when compared equal... */
+	return !ASSETUUID_EQUAL(uuid1, uuid2);  /* Expects false when compared equal... */
 }
 
 void BKE_asset_uuid_print(const AssetUUID *uuid)
diff --git a/source/blender/blenkernel/intern/library_asset.c b/source/blender/blenkernel/intern/library_asset.c
index 4c60d2ab2bb..91e01e6193a 100644
--- a/source/blender/blenkernel/intern/library_asset.c
+++ b/source/blender/blenkernel/intern/library_asset.c
@@ -101,7 +101,7 @@ AssetRef *BKE_library_asset_repository_asset_find(Library *lib, const void *idv)
 	BLI_assert(id->uuid != NULL);
 
 	for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
-		if (ASSETUUID_COMPARE(&aref->uuid, id->uuid)) {
+		if (ASSETUUID_EQUAL(&aref->uuid, id->uuid)) {
 #ifndef NDEBUG
 			LinkData *link = aref->id_list.first;
 			BLI_assert(link && (link->data == idv));
@@ -233,10 +233,10 @@ AssetRef *BKE_libraries_asset_repository_uuid_find(Main *bmain, const AssetUUID
 	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)) {
+			if (ASSETUUID_EQUAL(&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));
+				BLI_assert(link && ((ID *)link->data)->uuid && ASSETUUID_EQUAL(((ID *)link->data)->uuid, uuid));
 #endif
 				return aref;
 			}
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index a2a332623cd..08b7c871de8 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -278,7 +278,7 @@ static void wm_link_virtual_lib(
 			case ID_IM:
 				new_id = (ID *)BKE_image_load_exists_ex(item->name, &id_exists);
 				if (id_exists) {
-					if (!new_id->uuid || !ASSETUUID_COMPARE(new_id->uuid, item->uuid)) {
+					if (!new_id->uuid || !ASSETUUID_EQUAL(new_id->uuid, item->uuid)) {
 						/* Fake 'same ID' (same path, but different uuid or whatever), force loading into new ID. */
 						BLI_assert(new_id->lib != virtlib);
 						new_id = (ID *)BKE_image_load(bmain, item->name);
@@ -1285,7 +1285,7 @@ static void asset_update_engines_uuids_fetch(
 					int i = uuids->nbr_uuids;
 					bool skip = true;
 					for (AssetUUID *uuid = uuids->uuids; i--; uuid++) {
-						if (ASSETUUID_COMPARE(id->uuid, uuid)) {
+						if (ASSETUUID_EQUAL(id->uuid, uuid)) {
 							skip = false;
 							break;
 						}
@@ -1414,7 +1414,7 @@ static void asset_updatecheck_update(void *aucjv)
 						for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
 							ID *id = ((LinkData *)aref->id_list.first)->data;
 							BLI_assert(id->uuid);
-							if (ASSETUUID_COMPARE(id->uuid, uuid)) {
+							if (ASSETUUID_EQUAL(id->uuid, uuid)) {
 								*id->uuid = *uuid;
 
 								if (id->uuid->tag & UUID_TAG_ENGINE_MISSING) {
@@ -1619,7 +1619,7 @@ static int wm_assets_reload_exec(bContext *C, wmOperator *op)
 
 				AssetRef *aref = BKE_libraries_asset_repository_uuid_find(bmain, uuid);
 				ID *old_id = aref ? ((LinkData *)aref->id_list.first)->data : NULL;
-				BLI_assert(!old_id || (old_id->uuid && ASSETUUID_COMPARE(old_id->uuid, uuid)));
+				BLI_assert(!old_id || (old_id->uuid && ASSETUUID_EQUAL(old_id->uuid, uuid)));
 
 				lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, libname_def));



More information about the Bf-blender-cvs mailing list