diff options
author | Bastien Montagne <bastien@blender.org> | 2021-05-26 12:45:27 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-05-26 18:05:00 +0300 |
commit | ee849ca0f8f60c142dce7ecea1be74d382247c12 (patch) | |
tree | 2a97e1dddb70d668401fb740a97df1eab9c4746b /source/blender/blenkernel/intern/lib_query.c | |
parent | 8f9599d17e80254928d2d72081a4c7e0dee64038 (diff) |
ID management: Do not assume that `NO_MAIN` means `NO_USER_REFCOUNT`
While this is still very fuzzy in current code, this old behavior makes
it close to impossible to efficiently use out-of-main temp data, as it
implies that we'd need to update refcounts everytime we add something
back into BMain (an 'un-refcount' ID usages when removing from BMain).
Now that we have two separate flags/tags for those two different things,
let's not merge them anymore.
Note that this is somewhat on-going process, still needs more checks and
cleanup. Related to T88555.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_query.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index 3281783d81a..b748061ef8a 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -244,9 +244,10 @@ static void library_foreach_ID_link(Main *bmain, * (the node tree), but re-use those generated for the 'owner' ID (the material). */ if (inherit_data == NULL) { data.cb_flag = ID_IS_LINKED(id) ? IDWALK_CB_INDIRECT_USAGE : 0; - /* When an ID is not in Main database, it should never refcount IDs it is using. - * Exceptions: NodeTrees (yeah!) directly used by Materials. */ - data.cb_flag_clear = (id->tag & LIB_TAG_NO_MAIN) ? IDWALK_CB_USER | IDWALK_CB_USER_ONE : 0; + /* When an ID is defined as not refcounting its ID usages, it should never do it. */ + data.cb_flag_clear = (id->tag & LIB_TAG_NO_USER_REFCOUNT) ? + IDWALK_CB_USER | IDWALK_CB_USER_ONE : + 0; } else { data.cb_flag = inherit_data->cb_flag; |