From 367ecff15d74ed99a305cbfcd46599e59a75db02 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 19 Feb 2020 12:50:04 +0100 Subject: readfile: Move ID refcounting to libquery. Having that extra ID users handling at readfile level, besides generic one ensured by libquery, has been something bothering me for a long time (had to fix my share of bugs due to mismatches between those two areas). Further more, work on undo speedup will require even more complex ID refcount management if we want to keep it in readfile.c area. So idea is instead to generalize what we did for linked data already when undoing: recompute properly usercount numbers after liblink step, for all IDs. Note that extra time required here is neglectable in a whole .blend file reading (few extra milliseconds when loading a full production scene e.g.). Notes: * Some deprecated data (IPOs) are not refcounted at all anymore, this should not be an issue in pratice since the are supposed to get deleted after doversion anyway. * Refcounting happens after `do_versions_after_linking`, i.e those functions won't get valid ID usercounts currently. Again, this is not a problem in current code, if needed we could recompute refcount before, and then ensure `do_versions_after_linoiing()` actually handles properly usercount, which it does not currently. Differential Revision: https://developer.blender.org/D6881 --- source/blender/blenloader/intern/versioning_legacy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenloader/intern/versioning_legacy.c') diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 73cdd40c02c..f2a2ec0b21f 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -2489,8 +2489,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) MEM_freeN(fluidmd->fss); fluidmd->fss = MEM_dupallocN(ob->fluidsimSettings); - fluidmd->fss->ipo = blo_do_versions_newlibadr_us( - fd, ob->id.lib, ob->fluidsimSettings->ipo); + fluidmd->fss->ipo = blo_do_versions_newlibadr(fd, ob->id.lib, ob->fluidsimSettings->ipo); MEM_freeN(ob->fluidsimSettings); fluidmd->fss->lastgoodframe = INT_MAX; -- cgit v1.2.3