[Bf-blender-cvs] [a639446] asset-engine: More WIP work towards designing Updated feature for assets/engines.

Bastien Montagne noreply at git.blender.org
Thu Mar 17 14:54:53 CET 2016


Commit: a6394466145eea06e37e1f65a244c123d1c9b522
Author: Bastien Montagne
Date:   Wed Mar 9 20:33:38 2016 +0100
Branches: asset-engine
https://developer.blender.org/rBa6394466145eea06e37e1f65a244c123d1c9b522

More WIP work towards designing Updated feature for assets/engines.

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

M	source/blender/blenkernel/BKE_asset.h
M	source/blender/blenkernel/intern/blender.c
M	source/blender/makesdna/DNA_ID.h
M	source/blender/makesrna/intern/rna_asset.c
M	source/creator/creator.c

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

diff --git a/source/blender/blenkernel/BKE_asset.h b/source/blender/blenkernel/BKE_asset.h
index 858968d..29fead1 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -97,7 +97,7 @@ typedef bool (*ae_entries_block_get)(struct AssetEngine *engine, const int start
 typedef bool (*ae_entries_uuid_get)(struct AssetEngine *engine, struct AssetUUIDList *uuids,
                                     struct FileDirEntryArr *entries_r);
 
-/* 'pre-loading' hook, called before opening/appending/linking given entries.
+/* 'pre-loading' hook, called before opening/appending/linking/updating given entries.
  * Note first given uuid is the one of 'active' entry, and first entry in returned list will be considered as such too.
  * E.g. allows the engine to ensure entries' paths are actually valid by downloading requested data, etc.
  * If is_virtual is True, then there is no requirement that returned paths actually exist.
@@ -108,10 +108,16 @@ typedef bool (*ae_entries_uuid_get)(struct AssetEngine *engine, struct AssetUUID
 typedef bool (*ae_load_pre)(struct AssetEngine *engine, struct AssetUUIDList *uuids,
                             struct FileDirEntryArr *entries_r);
 
-/* 'post-loading' hook, called after opening/appending/linking given entries.
+/* 'post-loading' hook, called after opening/appending/linking/updating given entries.
  * E.g. allows an advanced engine to make fancy scripted operations over loaded items. */
 typedef bool (*ae_load_post)(struct AssetEngine *engine, struct ID *items, const int *num_items);
 
+/* 'update' hook, called to prepare updating of given entries (typically after a file (re)load).
+ * Engine should check whether given assets are still valid, if they should be updated, etc.
+ * uuids tagged as needing reload will then be reloaded as new ones
+ * (ae_load_pre, then actual lib loading, then ae_load_post). */
+typedef bool (*ae_update_check)(struct AssetEngine *engine, struct AssetUUIDList *uuids);
+
 typedef struct AssetEngineType {
 	struct AssetEngineType *next, *prev;
 
@@ -136,6 +142,7 @@ typedef struct AssetEngineType {
 
 	ae_load_pre load_pre;
 	ae_load_post load_post;
+	ae_update_check update_check;
 
 	/* RNA integration */
 	struct ExtensionRNA ext;
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index af3e4ee..878c189 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -517,7 +517,7 @@ static void read_file_update_assets(bContext *C)
 
 	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);
+			printf("Handling lib file %s (engine %s, ver. %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;
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 557ad62..11d29cd 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -136,6 +136,8 @@ enum {
 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). */
+
+	UUID_TAG_ASSET_RELOAD   = 1 << 8,  /* Set by the asset engine to indicates that that asset has to be reloaded. */
 };
 
 typedef struct AssetUUIDList {
diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c
index b7e2855..3b38ccf 100644
--- a/source/blender/makesrna/intern/rna_asset.c
+++ b/source/blender/makesrna/intern/rna_asset.c
@@ -678,6 +678,10 @@ static void rna_def_asset_uuid(BlenderRNA *brna)
 
 	RNA_def_int_vector(srna, "uuid_revision", 4, null_uuid, INT_MIN, INT_MAX,
 	                   "Revision UUID", "Unique identifier of this asset's revision", INT_MIN, INT_MAX);
+
+	prop = RNA_def_boolean(srna, "is_unknown_engine", 0, "Unknown Asset Engine",
+	                       "This AssetUUID is referencing an unknown asset engine");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 }
 
 static void rna_def_asset_uuid_list(BlenderRNA *brna)
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 5c17627..a53fc9c 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -46,14 +46,14 @@
 #  include "BLI_winstuff.h"
 #endif
 
-#include "RNA_define.h"
-
 #include "BLI_args.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 #include "BLI_callbacks.h"
 #include "BLI_string.h"
 
+#include "RNA_define.h"
+
 /* mostly init functions */
 #include "BKE_appdir.h"
 #include "BKE_asset.h"




More information about the Bf-blender-cvs mailing list