[Bf-blender-cvs] [f9dc4151141] asset-engine: Merge branch 'blender2.8' into asset-engine

Bastien Montagne noreply at git.blender.org
Wed Feb 7 22:39:51 CET 2018


Commit: f9dc41511418174d5fff7d141fcd357a0632683d
Author: Bastien Montagne
Date:   Wed Feb 7 22:30:05 2018 +0100
Branches: asset-engine
https://developer.blender.org/rBf9dc41511418174d5fff7d141fcd357a0632683d

Merge branch 'blender2.8' into asset-engine

Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c

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



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

diff --cc source/blender/windowmanager/intern/wm_files_link.c
index 08b7c871de8,a33df1bc1f2..f48f0a61644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@@ -431,14 -320,7 +431,11 @@@ static int wm_link_append_exec(bContex
  	char path[FILE_MAX_LIBEXTRA], root[FILE_MAXDIR], libname[FILE_MAX_LIBEXTRA], relname[FILE_MAX];
  	char *group, *name;
  	int totfiles = 0;
- 	short flag;
- 	bool has_item = false;
- 	bool do_append;
  
 +	char asset_engine[BKE_ST_MAXNAME];
 +	AssetEngineType *aet = NULL;
 +	AssetUUID uuid = {0};
 +
  	RNA_string_get(op->ptr, "filename", relname);
  	RNA_string_get(op->ptr, "directory", root);
  
@@@ -527,18 -403,8 +524,17 @@@
  					BLI_ghash_insert(libraries, BLI_strdup(libname), SET_INT_IN_POINTER(lib_idx));
  					lib_idx++;
  					wm_link_append_data_library_add(lapp_data, libname);
- 					has_item = true;
  				}
  			}
 +			/* Non-blend paths are only valid in asset engine context (virtual libraries). */
 +			else if (aet && path_to_idcode(path)) {
 +				if (!BLI_ghash_haskey(libraries, "")) {
 +					BLI_ghash_insert(libraries, BLI_strdup(""), SET_INT_IN_POINTER(lib_idx));
 +					lib_idx++;
 +					wm_link_append_data_library_add(lapp_data, "");
 +					has_item = true;
 +				}
 +			}
  		}
  		RNA_END;
  
@@@ -567,55 -422,25 +563,53 @@@
  				}
  
  				lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, libname));
 -
 -				item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
 +				item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), &uuid, NULL);
  				BLI_BITMAP_ENABLE(item->libraries, lib_idx);
- 				has_item = true;
  			}
 +			else if (aet) {  /* Non-blend paths are only valid in asset engine context (virtual libraries). */
 +				const int idcode = path_to_idcode(path);
 +
 +				if (idcode != 0) {
 +					lib_idx = GET_INT_FROM_POINTER(BLI_ghash_lookup(libraries, ""));
 +					item = wm_link_append_data_item_add(lapp_data, path, idcode, &uuid, NULL);
 +					BLI_BITMAP_ENABLE(item->libraries, lib_idx);
 +					has_item = true;
 +				}
 +			}
  		}
  		RNA_END;
  
  		BLI_ghash_free(libraries, MEM_freeN, NULL);
  	}
 -	else {
 +	else if ((group || aet) && path[0]) {
  		WMLinkAppendDataItem *item;
  
 -		wm_link_append_data_library_add(lapp_data, libname);
 -		item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), NULL);
 -		BLI_BITMAP_ENABLE(item->libraries, 0);
 +		if (aet) {
 +			RNA_int_get_array(op->ptr, "uuid_repository", uuid.uuid_repository);
 +			RNA_int_get_array(op->ptr, "uuid_asset", uuid.uuid_asset);
 +			RNA_int_get_array(op->ptr, "uuid_variant", uuid.uuid_variant);
 +			RNA_int_get_array(op->ptr, "uuid_revision", uuid.uuid_revision);
 +			RNA_int_get_array(op->ptr, "uuid_view", uuid.uuid_view);
 +		}
 +
 +		if (group) {
 +			wm_link_append_data_library_add(lapp_data, libname);
 +			item = wm_link_append_data_item_add(lapp_data, name, BKE_idcode_from_name(group), &uuid, NULL);
 +			BLI_BITMAP_ENABLE(item->libraries, 0);
- 			has_item = true;
 +		}
 +		else if (aet) {  /* Non-blend paths are only valid in asset engine context (virtual libraries). */
 +			const int idcode = path_to_idcode(path);
 +
 +			if (idcode != 0) {
 +				wm_link_append_data_library_add(lapp_data, "");
 +				item = wm_link_append_data_item_add(lapp_data, path, idcode, &uuid, NULL);
 +				BLI_BITMAP_ENABLE(item->libraries, 0);
- 				has_item = true;
 +			}
 +		}
  	}
  
- 	if (!has_item) {
+ 	if (lapp_data->num_items == 0) {
+ 		/* Early out in case there is nothing to link. */
  		wm_link_append_data_free(lapp_data);
  		return OPERATOR_CANCELLED;
  	}
@@@ -829,35 -609,31 +823,33 @@@ static void lib_relocate_do
  
  	LinkNode *itemlink;
  	int item_idx;
- 	bool has_item = false;
  
  	/* Remove all IDs to be reloaded from Main. */
 -	lba_idx = set_listbasepointers(bmain, lbarray);
 -	while (lba_idx--) {
 -		ID *id = lbarray[lba_idx]->first;
 -		const short idcode = id ? GS(id->name) : 0;
 -
 -		if (!id || !BKE_idcode_is_linkable(idcode)) {
 -			/* No need to reload non-linkable datatypes, those will get relinked with their 'users ID'. */
 -			continue;
 -		}
 +	if (library) {
 +		lba_idx = set_listbasepointers(bmain, lbarray);
 +		while (lba_idx--) {
 +			ID *id = lbarray[lba_idx]->first;
 +			const short idcode = id ? GS(id->name) : 0;
 +
 +			if (!id || !BKE_idcode_is_linkable(idcode)) {
 +				/* No need to reload non-linkable datatypes, those will get relinked with their 'users ID'. */
 +				continue;
 +			}
  
 -		for (; id; id = id->next) {
 -			if (id->lib == library) {
 -				WMLinkAppendDataItem *item;
 +			for (; id; id = id->next) {
 +				if (id->lib == library) {
 +					WMLinkAppendDataItem *item;
  
 -				/* We remove it from current Main, and add it to items to link... */
 -				/* Note that non-linkable IDs (like e.g. shapekeys) are also explicitly linked here... */
 -				BLI_remlink(lbarray[lba_idx], id);
 -				item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, id);
 -				BLI_BITMAP_SET_ALL(item->libraries, true, lapp_data->num_libraries);
 +					/* We remove it from current Main, and add it to items to link... */
 +					/* Note that non-linkable IDs (like e.g. shapekeys) are also explicitely linked here... */
 +					BLI_remlink(lbarray[lba_idx], id);
 +					item = wm_link_append_data_item_add(lapp_data, id->name + 2, idcode, NULL, id);
 +					BLI_BITMAP_SET_ALL(item->libraries, true, lapp_data->num_libraries);
- 					has_item = true;
  
 -#ifdef PRINT_DEBUG
 -				printf("\tdatablock to seek for: %s\n", id->name);
 +#ifdef DEBUG_LIBRARY
 +					printf("\tdatablock to seek for: %s\n", id->name);
  #endif
 +				}
  			}
  		}
  	}



More information about the Bf-blender-cvs mailing list