[Bf-blender-cvs] [e29ff1adb52] asset-engine: Fix various mistakes and forgotten bits in previous 'Views' adding commit.

Bastien Montagne noreply at git.blender.org
Mon Sep 25 22:04:06 CEST 2017


Commit: e29ff1adb521387816783b44f3f7d9290d3a4b2e
Author: Bastien Montagne
Date:   Mon Sep 25 21:42:25 2017 +0200
Branches: asset-engine
https://developer.blender.org/rBe29ff1adb521387816783b44f3f7d9290d3a4b2e

Fix various mistakes and forgotten bits in previous 'Views' adding commit.

Core API code shall now be mostly functional again.

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

M	source/blender/blenkernel/intern/asset_engine.c
M	source/blender/editors/space_file/file_ops.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/windowmanager/intern/wm_files_link.c
M	source/blender/windowmanager/intern/wm_operator_props.c

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

diff --git a/source/blender/blenkernel/intern/asset_engine.c b/source/blender/blenkernel/intern/asset_engine.c
index d0a0857c518..ce8207be348 100644
--- a/source/blender/blenkernel/intern/asset_engine.c
+++ b/source/blender/blenkernel/intern/asset_engine.c
@@ -184,20 +184,23 @@ static void asset_engine_load_pre(AssetEngine *engine, AssetUUIDList *r_uuids, F
 
 	if (r_entries->nbr_entries) {
 		BLI_assert(r_uuids->uuids == NULL);
-		r_uuids->uuids = MEM_mallocN(sizeof(*r_uuids->uuids) * nbr_entries, __func__);
+		r_uuids->uuids = MEM_callocN(sizeof(*r_uuids->uuids) * nbr_entries, __func__);
 		r_uuids->nbr_uuids = nbr_entries;
 		r_uuids->asset_engine_version = engine->type->version;
 
 		for (en = r_entries->entries.first, uuid = r_uuids->uuids; en; en = en->next, uuid++) {
-			FileDirEntryVariant *var = BLI_findlink(&en->variants, en->act_variant);
-
 			memcpy(uuid->uuid_repository, en->uuid_repository, sizeof(uuid->uuid_repository));
 
 			memcpy(uuid->uuid_asset, en->uuid, sizeof(uuid->uuid_asset));
 
+			FileDirEntryVariant *var = BLI_findlink(&en->variants, en->act_variant);
 			BLI_assert(var);
 			memcpy(uuid->uuid_variant, var->uuid, sizeof(uuid->uuid_variant));
 
+			FileDirEntryRevision *rev = BLI_findlink(&var->revisions, var->act_revision);
+			BLI_assert(rev);
+			memcpy(uuid->uuid_revision, rev->uuid, sizeof(uuid->uuid_revision));
+
 			memcpy(uuid->uuid_view, en->entry->uuid, sizeof(uuid->uuid_view));
 		}
 	}
@@ -401,7 +404,7 @@ FileDirEntry *BKE_filedir_entry_copy(FileDirEntry *entry)
 					rev_new->comment = MEM_dupallocN(rev->comment);
 				}
 
-				BLI_listbase_clear(&var_new->revisions);
+				BLI_listbase_clear(&rev_new->views);
 				FileDirEntryView *view;
 				int act_view;
 				for (act_view = 0, view = rev->views.first; view; act_view++, view = view->next) {
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 3e63f813734..d717f03e284 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1240,6 +1240,9 @@ void file_sfile_to_operator_ex(
 			RNA_property_string_set(op->ptr, prop, filepath);
 		}
 		if (ae && uuids) {
+			if ((prop = RNA_struct_find_property(op->ptr, "repository_uuid"))) {
+				RNA_property_int_set_array(op->ptr, prop, uuids->uuids[0].uuid_repository);
+			}
 			if ((prop = RNA_struct_find_property(op->ptr, "asset_uuid"))) {
 				RNA_property_int_set_array(op->ptr, prop, uuids->uuids[0].uuid_asset);
 			}
@@ -1249,6 +1252,9 @@ void file_sfile_to_operator_ex(
 			if ((prop = RNA_struct_find_property(op->ptr, "revision_uuid"))) {
 				RNA_property_int_set_array(op->ptr, prop, uuids->uuids[0].uuid_revision);
 			}
+			if ((prop = RNA_struct_find_property(op->ptr, "view_uuid"))) {
+				RNA_property_int_set_array(op->ptr, prop, uuids->uuids[0].uuid_view);
+			}
 		}
 
 		/* some ops have multiple files to select */
@@ -1267,9 +1273,11 @@ void file_sfile_to_operator_ex(
 						RNA_string_set(&itemptr, "name", entry->relpath);
 						if (ae) {
 							BLI_assert(i < uuids->nbr_uuids);
+							RNA_int_set_array(&itemptr, "repository_uuid", uuids->uuids[i].uuid_repository);
 							RNA_int_set_array(&itemptr, "asset_uuid", uuids->uuids[i].uuid_asset);
 							RNA_int_set_array(&itemptr, "variant_uuid", uuids->uuids[i].uuid_variant);
 							RNA_int_set_array(&itemptr, "revision_uuid", uuids->uuids[i].uuid_revision);
+							RNA_int_set_array(&itemptr, "view_uuid", uuids->uuids[i].uuid_view);
 						}
 					}
 				}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 49f21dc61b3..90b764f2e60 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1808,7 +1808,7 @@ FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid
 			uuids.asset_engine_version = engine->type->version;
 
 			memcpy(asset_uuid.uuid_asset, uuid, sizeof(asset_uuid.uuid_asset));
-			/* Variants and revision uuids remain NULL here. */
+			/* Variant, revision and view uuids remain NULL here. */
 
 			if (engine->type->entries_uuid_get(engine, &uuids, &r_entries)) {
 				en = r_entries.entries.first;
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 0caed0e0cb3..369fb0917a4 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -1680,6 +1680,9 @@ static void rna_def_operator_filelist_element(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
 
+	prop = RNA_def_int_vector(srna, "repository_uuid", 4, NULL, INT_MIN, INT_MAX,
+	                          "Repository UUID", "Identifier of this item's repository in current asset engine", INT_MIN, INT_MAX);
+	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	prop = RNA_def_int_vector(srna, "asset_uuid", 4, NULL, INT_MIN, INT_MAX,
 	                          "Asset UUID", "Identifier of this item in current asset engine", INT_MIN, INT_MAX);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
@@ -1689,6 +1692,9 @@ static void rna_def_operator_filelist_element(BlenderRNA *brna)
 	prop = RNA_def_int_vector(srna, "revision_uuid", 4, NULL, INT_MIN, INT_MAX,
 	                          "Revision UUID", "Identifier of this item's revision in current asset engine", INT_MIN, INT_MAX);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
+	prop = RNA_def_int_vector(srna, "view_uuid", 4, NULL, INT_MIN, INT_MAX,
+	                          "View UUID", "Identifier of this item's view in current asset engine", INT_MIN, INT_MAX);
+	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 }
 	
 static void rna_def_event(BlenderRNA *brna)
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index e477426c126..081a2cce92c 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -497,9 +497,11 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 				lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, libname));
 
 				if (aet) {
+					RNA_int_get_array(&itemptr, "repository_uuid", uuid.uuid_repository);
 					RNA_int_get_array(&itemptr, "asset_uuid", uuid.uuid_asset);
 					RNA_int_get_array(&itemptr, "variant_uuid", uuid.uuid_variant);
 					RNA_int_get_array(&itemptr, "revision_uuid", uuid.uuid_revision);
+					RNA_int_get_array(&itemptr, "view_uuid", uuid.uuid_view);
 				}
 
 				item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), &uuid, NULL);
@@ -512,9 +514,11 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 					WMLinkAppendDataItem *item;
 					lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, ""));
 
+					RNA_int_get_array(&itemptr, "repository_uuid", uuid.uuid_repository);
 					RNA_int_get_array(&itemptr, "asset_uuid", uuid.uuid_asset);
 					RNA_int_get_array(&itemptr, "variant_uuid", uuid.uuid_variant);
 					RNA_int_get_array(&itemptr, "revision_uuid", uuid.uuid_revision);
+					RNA_int_get_array(&itemptr, "view_uuid", uuid.uuid_view);
 
 					item = wm_link_append_data_item_add(lapp_data, path, idcode, &uuid, NULL);
 					BLI_BITMAP_ENABLE(item->libraries, lib_idx);
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index ab52760aa3f..5f71c95ccd3 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -77,6 +77,9 @@ void WM_operator_properties_filesel(
 		                      "Identifier of relevant asset engine (if any)");
 		RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 		if (flag & (WM_FILESEL_FILEPATH | WM_FILESEL_FILENAME)) {
+			prop = RNA_def_int_vector(ot->srna, "repository_uuid", 4, NULL, INT_MIN, INT_MAX,
+			                          "Repository UUID", "Identifier of this item's repository in current asset engine", INT_MIN, INT_MAX);
+			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 			prop = RNA_def_int_vector(ot->srna, "asset_uuid", 4, NULL, INT_MIN, INT_MAX,
 			                          "Asset UUID", "Identifier of this item in current asset engine", INT_MIN, INT_MAX);
 			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
@@ -86,6 +89,9 @@ void WM_operator_properties_filesel(
 			prop = RNA_def_int_vector(ot->srna, "revision_uuid", 4, NULL, INT_MIN, INT_MAX,
 			                          "Revision UUID", "Identifier of this item's revision in current asset engine", INT_MIN, INT_MAX);
 			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+			prop = RNA_def_int_vector(ot->srna, "view_uuid", 4, NULL, INT_MIN, INT_MAX,
+			                          "View UUID", "Identifier of this item's view in current asset engine", INT_MIN, INT_MAX);
+			RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 		}
 	}



More information about the Bf-blender-cvs mailing list