[Bf-blender-cvs] [b0a541a] asset-engine: Slightly modified way to check for assets on loadfile.

Bastien Montagne noreply at git.blender.org
Mon Mar 7 15:08:41 CET 2016


Commit: b0a541a76c55254bb21c92b20858d6880c6be56b
Author: Bastien Montagne
Date:   Mon Mar 7 15:03:28 2016 +0100
Branches: asset-engine
https://developer.blender.org/rBb0a541a76c55254bb21c92b20858d6880c6be56b

Slightly modified way to check for assets on loadfile.

Since we now build a list of assets and their dependencies in Library datablocks, use it!

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

M	source/blender/blenkernel/intern/blender.c
M	source/blender/makesdna/DNA_ID.h

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

diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 5d42225..af3e4ee 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -515,20 +515,20 @@ static void read_file_update_assets(bContext *C)
 	ListBase *lb_array[MAX_LIBARRAY];
 	int i = set_listbasepointers(bmain, lb_array);
 
-	BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
-
-	while (i--) {
-		for (ID *id = lb_array[i]->first; id; id = id->next) {
-			if (id->tag & LIB_TAG_ASSET) {
-				BLI_assert(id->lib);
-				id->lib->id.tag | LIB_TAG_DOIT;
-				if (id->uuid) {
-					printf("We need to check for updated asset %s...\n", id->name);
+	for (Library *lib = bmain->library.first; lib; lib = lib->id.next) {
+		if (lib->asset_repository) {
+			printf("Handling lib file %s (engine %s, %d)\n", lib->filepath, lib->asset_repository->asset_engine, lib->asset_repository->asset_engine_version);
+			for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
+				for (LinkData *ld = aref->id_list.first; ld; ld = ld->next) {
+					ID *id = ld->data;
+
+					if (id->uuid) {
+						printf("\tWe need to check for updated asset %s...\n", id->name);
+					}
+					else {
+						printf("\t\tWe need to check for updated asset sub-data %s...\n", id->name);
+					}
 				}
-				else {
-					printf("We need to check for updated asset sub-data %s...\n", id->name);
-				}
-				id->tag |= LIB_TAG_DOIT;
 			}
 		}
 	}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index dd35fa1..557ad62 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -118,8 +118,26 @@ typedef struct AssetUUID {
 	int uuid_asset[4];
 	int uuid_variant[4];
 	int uuid_revision[4];
+	short flag;  /* Saved. */
+	short tag;   /* Runtime. */
+	int pad_i1;
 } AssetUUID;
 
+/**
+ * uuid->flag (persitent, saved in .blend files).
+ */
+enum {
+	UUID_FLAG_LAST_REVISION  = 1 << 0,  /* This asset should always use latest available revision. */
+};
+
+/**
+ * uuid->tag (runtime only).
+ */
+enum {
+	UUID_TAG_ENGINE_MISSING = 1 << 0,  /* The asset engine used for this asset is not known by Blender. */
+	UUID_TAG_ASSET_MISSING  = 1 << 1,  /* The asset engine was found but does not know about this asset (anymore). */
+};
+
 typedef struct AssetUUIDList {
 	AssetUUID *uuids;
 	int nbr_uuids;




More information about the Bf-blender-cvs mailing list