[Bf-blender-cvs] [476a1b9] asset-engine: Merge branch 'asset-experiments' into asset-engine
Bastien Montagne
noreply at git.blender.org
Mon Apr 13 22:14:34 CEST 2015
Commit: 476a1b9effdcad990511cde663f2bbb49c3092ba
Author: Bastien Montagne
Date: Mon Apr 13 22:13:16 2015 +0200
Branches: asset-engine
https://developer.blender.org/rB476a1b9effdcad990511cde663f2bbb49c3092ba
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 7b422ae,f675c96..824954f
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@@ -1473,21 -1438,22 +1489,23 @@@ static FileDirEntry *filelist_file_ex(s
/* Else, we have to add new entry to 'misc' cache - and possibly make room for it first! */
ret = filelist_file_create_entry(filelist, index);
- old_index = cache->misc_entries_indices[cache->misc_cursor];
- if ((old = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(old_index), NULL))) {
- BLI_ghash_remove(cache->uuids, old->uuid, NULL, NULL);
- filelist_file_release_entry(filelist, old);
- }
- BLI_ghash_insert(cache->misc_entries, SET_INT_IN_POINTER(index), ret);
- BLI_ghash_insert(cache->uuids, ret->uuid, ret);
-
- cache->misc_entries_indices[cache->misc_cursor] = index;
- cache->misc_cursor = (cache->misc_cursor + 1) % FILELIST_ENTRYCACHESIZE;
+ if (ret) {
+ old_index = cache->misc_entries_indices[cache->misc_cursor];
+ if ((old = BLI_ghash_popkey(cache->misc_entries, SET_INT_IN_POINTER(old_index), NULL))) {
++ BLI_ghash_remove(cache->uuids, old->uuid, NULL, NULL);
+ filelist_file_release_entry(filelist, old);
+ }
+ BLI_ghash_insert(cache->misc_entries, SET_INT_IN_POINTER(index), ret);
++ BLI_ghash_insert(cache->uuids, ret->uuid, ret);
+ cache->misc_entries_indices[cache->misc_cursor] = index;
+ cache->misc_cursor = (cache->misc_cursor + 1) % FILELIST_ENTRYCACHESIZE;
#if 0 /* Actually no, only block cached entries should have preview imho. */
- if (cache->previews_pool) {
- filelist_cache_previews_push(filelist, ret, index);
- }
+ if (cache->previews_pool) {
+ filelist_cache_previews_push(filelist, ret, index);
+ }
#endif
+ }
return ret;
}
@@@ -1526,12 -1490,21 +1542,24 @@@ FileDirEntry *filelist_entry_find_uuid(
return NULL;
}
- /* XXX TODO Cache could probably use a ghash on uuids too? Not really urgent though. */
+ if (filelist->filelist_cache.uuids) {
+ FileDirEntry *entry = BLI_ghash_lookup(filelist->filelist_cache.uuids, uuid);
+ if (entry) {
+ return entry;
+ }
+ }
+
- {
++ if (filelist->ae) {
++ /* TODO! */
++ }
++ else {
+ int fidx;
- for (fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
- FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
- if (memcmp(entry->uuid, uuid, sizeof(entry->uuid)) == 0) {
- return filelist_file(filelist, fidx);
+ for (fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
+ FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
+ if (memcmp(entry->uuid, uuid, sizeof(entry->uuid)) == 0) {
+ return filelist_file(filelist, fidx);
+ }
}
}
@@@ -1570,21 -1533,19 +1600,17 @@@ static bool filelist_file_cache_block_c
static void filelist_file_cache_block_release(struct FileList *filelist, const int size, int cursor)
{
FileListEntryCache *cache = &filelist->filelist_cache;
+ int i;
- {
- int i;
+ for (i = 0; i < size; i++, cursor++) {
++ FileDirEntry *entry = cache->block_entries[cursor];
+// printf("%s: release cacheidx %d (%%p %%s)\n", __func__, cursor/*, cache->block_entries[cursor], cache->block_entries[cursor]->relpath*/);
- if (filelist->ae) {
- BLI_remlink(&filelist->filelist.entries, cache->block_entries[cursor]);
- BKE_filedir_entry_free(cache->block_entries[cursor]);
- }
- else {
- filelist_file_release_entry(filelist, cache->block_entries[cursor]);
- }
++ BLI_ghash_remove(cache->uuids, entry->uuid, NULL, NULL);
++ filelist_file_release_entry(filelist, cache->block_entries[cursor]);
- for (i = 0; i < size; i++, cursor++) {
- FileDirEntry *entry = cache->block_entries[cursor];
-// printf("%s: release cacheidx %d (%%p %%s)\n", __func__, cursor/*, cache->block_entries[cursor], cache->block_entries[cursor]->relpath*/);
- BLI_ghash_remove(cache->uuids, entry->uuid, NULL, NULL);
- filelist_file_release_entry(filelist, entry);
#ifndef NDEBUG
- cache->block_entries[cursor] = NULL;
+ cache->block_entries[cursor] = NULL;
#endif
- }
}
}
More information about the Bf-blender-cvs
mailing list