[Bf-blender-cvs] [f2e55db] asset-engine: Merge branch 'asset-experiments' into asset-engine

Bastien Montagne noreply at git.blender.org
Thu Apr 2 17:35:05 CEST 2015


Commit: f2e55db040c8c12eb9313e24b76bf0712e98784d
Author: Bastien Montagne
Date:   Thu Apr 2 17:34:47 2015 +0200
Branches: asset-engine
https://developer.blender.org/rBf2e55db040c8c12eb9313e24b76bf0712e98784d

Merge branch 'asset-experiments' into asset-engine

Conflicts:
	source/blender/editors/space_file/filelist.c

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



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

diff --cc source/blender/editors/space_file/filelist.c
index 34d3cc0,fce3b11..603e084
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -1438,123 -1435,101 +1438,105 @@@ bool filelist_file_cache_block(struct F
  	printf("%s: [%d:%d] around index %d (current cache: [%d:%d])\n", __func__,
  	       start_index, end_index, index, cache->block_start_index, cache->block_end_index);
  
- 	if ((start_index == cache->block_start_index) && (end_index == cache->block_end_index)) {
- 		/* Nothing to do! */
- 		return true;
- 	}
- 
- 	if ((start_index >= cache->block_end_index) || (end_index <= cache->block_start_index)) {
- //		printf("Full Recaching!\n");
- 
- 		/* New cached block does not overlap existing one, simple. */
- 		if (!filelist_file_cache_block_do(filelist, start_index, end_index - start_index, 0)) {
- 			return false;
- 		}
- 
- 		if (cache->previews_pool) {
- 			filelist_cache_previews_clear(cache);
- 		}
- 
- 		cache->block_start_index = start_index;
- 		cache->block_end_index = end_index;
- 		cache->block_cursor = 0;
- 	}
- 	else {
- //		printf("Partial Recaching!\n");
- 
- 		/* At this point, we know we keep part of currently cached entries, so update previews if needed,
- 		 * and remove everything from working queue - we'll add all newly needed entries at the end. */
- 		if (cache->previews_pool) {
- 			filelist_cache_previews_update(filelist);
- 			filelist_cache_previews_clear(cache);
- 		}
+ 	/* If we have something to (re)cache... */
+ 	if ((start_index != cache->block_start_index) || (end_index != cache->block_end_index)) {
+ 		if ((start_index >= cache->block_end_index) || (end_index <= cache->block_start_index)) {
+ 	//		printf("Full Recaching!\n");
  
- //		printf("\tpreview cleaned up...\n");
- 
- 		if (end_index > cache->block_end_index) {
- 			/* Add (request) needed entries after already cached ones. */
- 			/* Note: We need some index black magic to wrap around (cycle) inside our FILELIST_ENTRYCACHESIZE array... */
- 			int size1 = end_index - cache->block_end_index;
- 			int size2 = 0;
- 			int idx1, idx2;
- 
- 			idx1 = (cache->block_cursor + curr_block_size) % FILELIST_ENTRYCACHESIZE;
- 			if ((idx1 + size1) > FILELIST_ENTRYCACHESIZE) {
- 				size2 = size1;
- 				size1 = FILELIST_ENTRYCACHESIZE - idx1;
- 				size2 -= size1;
- 				idx2 = 0;
- 			}
- 
- 			if (size2) {
- 				if (!filelist_file_cache_block_do(filelist, end_index - size2, size2, idx2)) {
- 					return false;
- 				}
- 			}
- 			if (!filelist_file_cache_block_do(filelist, end_index - size1 - size2, size1, idx1)) {
+ 			/* New cached block does not overlap existing one, simple. */
 -			memcpy(cache->block_entries, &filelist->filelist_intern.filtered[start_index],
 -				   sizeof(cache->block_entries[0]) * (end_index - start_index));
++			if (!filelist_file_cache_block_do(filelist, start_index, end_index - start_index, 0)) {
 +				return false;
 +			}
  
  			if (cache->previews_pool) {
- 				i = size1 + size2;
- 				while (i--) {
- 					const int idx = (cache->block_cursor + end_index - start_index - i - 1) % FILELIST_ENTRYCACHESIZE;
- 					FileDirEntry *entry = cache->block_entries[idx];
- 
- 					filelist_cache_previews_push(filelist, entry, end_index - i);
- 				}
+ 				filelist_cache_previews_clear(cache);
  			}
- 		}
- 		cache->block_end_index = end_index;
- 
- //		printf("\tend-extended...\n");
  
- 		if (start_index < cache->block_start_index) {
- 			/* Add (request) needed entries before already cached ones. */
- 			/* Note: We need some index black magic to wrap around (cycle) inside our FILELIST_ENTRYCACHESIZE array... */
- 			int size1 = cache->block_start_index - start_index;
- 			int size2 = 0;
- 			int idx1, idx2;
- 
- 			if (size1 > cache->block_cursor) {
- 				size2 = size1;
- 				size1 -= cache->block_cursor;
- 				size2 -= size1;
- 				idx2 = 0;
- 				idx1 = FILELIST_ENTRYCACHESIZE - size1;
+ 			cache->block_start_index = start_index;
+ 			cache->block_end_index = end_index;
+ 			cache->block_cursor = 0;
+ 		}
+ 		else {
+ 	//		printf("Partial Recaching!\n");
  
- 			}
- 			else {
- 				idx1 = cache->block_cursor - size1;
+ 			/* At this point, we know we keep part of currently cached entries, so update previews if needed,
+ 			 * and remove everything from working queue - we'll add all newly needed entries at the end. */
+ 			if (cache->previews_pool) {
+ 				filelist_cache_previews_update(filelist);
+ 				filelist_cache_previews_clear(cache);
  			}
  
- 			if (size2) {
- 				if (!filelist_file_cache_block_do(filelist, start_index + size1, size2, idx2)) {
+ 	//		printf("\tpreview cleaned up...\n");
+ 
+ 			if (end_index > cache->block_end_index) {
+ 				/* Add (request) needed entries after already cached ones. */
+ 				/* Note: We need some index black magic to wrap around (cycle) inside our FILELIST_ENTRYCACHESIZE array... */
+ 				int size1 = end_index - cache->block_end_index;
+ 				int size2 = 0;
+ 				int idx1, idx2;
+ 
+ 				idx1 = (cache->block_cursor + curr_block_size) % FILELIST_ENTRYCACHESIZE;
+ 				if ((idx1 + size1) > FILELIST_ENTRYCACHESIZE) {
+ 					size2 = size1;
+ 					size1 = FILELIST_ENTRYCACHESIZE - idx1;
+ 					size2 -= size1;
+ 					idx2 = 0;
+ 				}
+ 
+ 				if (size2) {
 -					memcpy(&cache->block_entries[idx2], &filelist->filelist_intern.filtered[end_index - size2],
 -						   sizeof(cache->block_entries[0]) * size2);
++					if (!filelist_file_cache_block_do(filelist, end_index - size2, size2, idx2)) {
++						return false;
++					}
++				}
++				if (!filelist_file_cache_block_do(filelist, end_index - size1 - size2, size1, idx1)) {
 +					return false;
  				}
 -				memcpy(&cache->block_entries[idx1], &filelist->filelist_intern.filtered[end_index - size1 - size2],
 -					   sizeof(cache->block_entries[0]) * size1);
  			}
- 			if (!filelist_file_cache_block_do(filelist, start_index, size1, idx1)) {
- 				return false;
- 			}
- 
- 			cache->block_cursor = idx1;
- 
- 			if (cache->previews_pool) {
- 				i = -(size1 + size2);
- 				while (i++) {
- 					const int idx = (cache->block_cursor - i) % FILELIST_ENTRYCACHESIZE;
- 					FileDirEntry *entry = cache->block_entries[idx];
+ 			cache->block_end_index = end_index;
+ 
+ 	//		printf("\tend-extended...\n");
+ 
+ 			if (start_index < cache->block_start_index) {
+ 				/* Add (request) needed entries before already cached ones. */
+ 				/* Note: We need some index black magic to wrap around (cycle) inside our FILELIST_ENTRYCACHESIZE array... */
+ 				int size1 = cache->block_start_index - start_index;
+ 				int size2 = 0;
+ 				int idx1, idx2;
+ 
+ 				if (size1 > cache->block_cursor) {
+ 					size2 = size1;
+ 					size1 -= cache->block_cursor;
+ 					size2 -= size1;
+ 					idx2 = 0;
+ 					idx1 = FILELIST_ENTRYCACHESIZE - size1;
 -
+ 				}
+ 				else {
+ 					idx1 = cache->block_cursor - size1;
+ 				}
  
- 					filelist_cache_previews_push(filelist, entry, start_index - i);
+ 				if (size2) {
 -					memcpy(&cache->block_entries[idx2], &filelist->filelist_intern.filtered[start_index + size1],
 -						   sizeof(cache->block_entries[0]) * size2);
++					if (!filelist_file_cache_block_do(filelist, start_index + size1, size2, idx2)) {
++						return false;
++					}
++				}
++				if (!filelist_file_cache_block_do(filelist, start_index, size1, idx1)) {
++					return false;
  				}
 -				memcpy(&cache->block_entries[idx1], &filelist->filelist_intern.filtered[start_index],
 -					   sizeof(cache->block_entries[0]) * size1);
+ 
+ 				cache->block_cursor = idx1;
  			}
+ 			else if (start_index > cache->block_start_index) {
+ 				/* We do not free anything, just update start index and cursor. */
+ 				cache->block_cursor = (cache->block_cursor + start_index - cache->block_start_index) % FILELIST_ENTRYCACHESIZE;
+ 			}
+ 			cache->block_start_index = start_index;
+ 	//		printf("\tstart-extended...\n");
  		}
- 		else if (start_index > cache->block_start_index) {
- 			/* We do not free anything, just update start index and cursor. */
- 			cache->block_cursor = (cache->block_cursor + start_index - cache->block_start_index) % FILELIST_ENTRYCACHESIZE;
- 		}
- 		cache->block_start_index = start_index;
- //		printf("\tstart-extended...\n");
+ 	}
+ 	else if (cache->block_center_index != index && cache->previews_pool) {
+ 		/* We try to always preview visible entries first, so 'restart' preview background task. */
+ 		filelist_cache_previews_update(filelist);
+ 		filelist_cache_previews_clear(cache);
  	}
  
  //	printf("Re-queueing previews...\n");




More information about the Bf-blender-cvs mailing list