Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenloader/intern/readfile.c
| Show First 20 Lines • Show All 1,809 Lines • ▼ Show 20 Lines | static void blo_cache_storage_entry_clear_in_old(ID *UNUSED(id), | ||||
| } | } | ||||
| /* If that cache has been restored into some new ID, we want to remove it from old one, otherwise | /* If that cache has been restored into some new ID, we want to remove it from old one, otherwise | ||||
| * keep it there so that it gets properly freed together with its ID. */ | * keep it there so that it gets properly freed together with its ID. */ | ||||
| *cache_p = POINTER_AS_UINT(*value) != 0 ? NULL : key->cache_v; | *cache_p = POINTER_AS_UINT(*value) != 0 ? NULL : key->cache_v; | ||||
| } | } | ||||
| void blo_cache_storage_init(FileData *fd, Main *bmain) | void blo_cache_storage_init(FileData *fd, Main *bmain) | ||||
| { | { | ||||
| printf("CACHE INIT\n"); | |||||
| if (fd->flags & FD_FLAGS_IS_MEMFILE) { | if (fd->flags & FD_FLAGS_IS_MEMFILE) { | ||||
| BLI_assert(fd->cache_storage == NULL); | BLI_assert(fd->cache_storage == NULL); | ||||
| fd->cache_storage = MEM_mallocN(sizeof(*fd->cache_storage), __func__); | fd->cache_storage = MEM_mallocN(sizeof(*fd->cache_storage), __func__); | ||||
| fd->cache_storage->memarena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); | fd->cache_storage->memarena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); | ||||
| fd->cache_storage->cache_map = BLI_ghash_new( | fd->cache_storage->cache_map = BLI_ghash_new( | ||||
| BKE_idtype_cache_key_hash, BKE_idtype_cache_key_cmp, __func__); | BKE_idtype_cache_key_hash, BKE_idtype_cache_key_cmp, __func__); | ||||
| ListBase *lb; | ListBase *lb; | ||||
| Show All 20 Lines | void blo_cache_storage_init(FileData *fd, Main *bmain) | ||||
| } | } | ||||
| else { | else { | ||||
| fd->cache_storage = NULL; | fd->cache_storage = NULL; | ||||
| } | } | ||||
| } | } | ||||
| void blo_cache_storage_old_bmain_clear(FileData *fd, Main *bmain_old) | void blo_cache_storage_old_bmain_clear(FileData *fd, Main *bmain_old) | ||||
| { | { | ||||
| printf("CACHE CLEAR OLD BMAIN\n"); | |||||
| if (fd->cache_storage != NULL) { | if (fd->cache_storage != NULL) { | ||||
| ListBase *lb; | ListBase *lb; | ||||
| FOREACH_MAIN_LISTBASE_BEGIN (bmain_old, lb) { | FOREACH_MAIN_LISTBASE_BEGIN (bmain_old, lb) { | ||||
| ID *id = lb->first; | ID *id = lb->first; | ||||
| if (id == NULL) { | if (id == NULL) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,227 Lines • ▼ Show 20 Lines | case ID_LI: | ||||
| break; | break; | ||||
| default: | default: | ||||
| /* Do nothing. Handled by IDTypeInfo callback. */ | /* Do nothing. Handled by IDTypeInfo callback. */ | ||||
| break; | break; | ||||
| } | } | ||||
| /* try to restore (when undoing) or clear ID's cache pointers. */ | /* try to restore (when undoing) or clear ID's cache pointers. */ | ||||
| if (id_type->foreach_cache != NULL) { | if (id_type->foreach_cache != NULL) { | ||||
| if (id_type->id_code == ID_NT) { | |||||
| printf("CACHE RESTORE\n"); | |||||
| } | |||||
| BKE_idtype_id_foreach_cache( | BKE_idtype_id_foreach_cache( | ||||
| id, blo_cache_storage_entry_restore_in_new, reader.fd->cache_storage); | id, blo_cache_storage_entry_restore_in_new, reader.fd->cache_storage); | ||||
| } | } | ||||
| return success; | return success; | ||||
| } | } | ||||
| /* Read all data associated with a datablock into datamap. */ | /* Read all data associated with a datablock into datamap. */ | ||||
| ▲ Show 20 Lines • Show All 2,526 Lines • Show Last 20 Lines | |||||