[Bf-blender-cvs] [09f134a] asset-engine: Make asset engine's `load_pre` callback mandatory now.

Bastien Montagne noreply at git.blender.org
Mon Apr 11 21:32:45 CEST 2016


Commit: 09f134aa6c28288c1d3d295adecb403654affb88
Author: Bastien Montagne
Date:   Mon Apr 11 16:14:05 2016 +0200
Branches: asset-engine
https://developer.blender.org/rB09f134aa6c28288c1d3d295adecb403654affb88

Make asset engine's `load_pre` callback mandatory now.

Reason is, even if paths returned by `list_dir` are OK, we will also use `load_pre`
during 'reload'/'update' scenarii, where we only have uuids, to retrieve final
.blend datablock paths.

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

M	source/blender/blenkernel/intern/blender.c
M	source/blender/makesrna/intern/rna_asset.c

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

diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index a2f2636..2e92428 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -547,8 +547,6 @@ static void read_file_update_assets(bContext *C)
 				ae = BKE_asset_engine_create(ae_type, NULL);
 			}
 
-			/* Note: we assume update check callback does not add, remove or alter order of uuids in that list! */
-
 			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;
@@ -590,6 +588,9 @@ static void read_file_update_assets(bContext *C)
 
 			BLI_assert(nbr_uuids == uuids.nbr_uuids);
 
+			/* Note: UUIDs list itself is not editable from py (adding/removing/reordering items), so we can use mere
+			 *       order to map returned uuid data to their IDs. */
+
 			uuid = uuids.uuids;
 			for (AssetRef *aref = lib->asset_repository->assets.first; aref; aref = aref->next) {
 				for (LinkData *ld = aref->id_list.first; ld; ld = ld->next) {
diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c
index 42419c6..72d4355 100644
--- a/source/blender/makesrna/intern/rna_asset.c
+++ b/source/blender/makesrna/intern/rna_asset.c
@@ -1131,7 +1131,7 @@ static void rna_def_asset_engine(BlenderRNA *brna)
 	/* Pre-load callback */
 	func = RNA_def_function(srna, "load_pre", NULL);
 	RNA_def_function_ui_description(func, "Pre-process given assets to make them loadable by Blender");
-	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+	RNA_def_function_flag(func, FUNC_ALLOW_WRITE);
 	RNA_def_pointer(func, "uuids", "AssetUUIDList", "", "Identifiers of assets to 'make real'");
 	RNA_def_pointer(func, "entries", "AssetList", "", "List of actual, existing paths that Blender can load");
 	parm = RNA_def_boolean(func, "success_return", 0, "", "Success");




More information about the Bf-blender-cvs mailing list