Fix #117795: Refactor code from 9 years ago forgot to cleanup flags of embedded IDs.

In 3fcf535d2e, the `ID.flag` data was split, keeping persisten flags in
`ID.flag`, and moving runtime ones into a new `ID.tag` data.

Some versionning code was then added to cleanup the existing `ID.flag`
on file read, but embedded IDs (root node trees only, back then) are not
stored in Main data-base, and were skipped.

Note that this fixes the conversion of older (2.76.4 and older) files.
There is no reliable way to cleanup files opened and saved from more
recent versions of Blender unfortunately.
This commit is contained in:
Bastien Montagne
2024-02-29 18:29:32 +01:00
parent 65f5e8b775
commit 05af72fc2e
@@ -1062,6 +1062,16 @@ void blo_do_versions_270(FileData *fd, Library * /*lib*/, Main *bmain)
while (a--) {
LISTBASE_FOREACH (ID *, id, lbarray[a]) {
id->flag &= LIB_FAKEUSER;
/* NOTE: This is added in 4.1 code.
*
* Original commit (3fcf535d2e) forgot to handle embedded IDs. Fortunately, back then, the
* only embedded IDs that existed were the NodeTree ones, and the current API to access
* them should still be valid on code from 9 years ago. */
bNodeTree *node_tree = ntreeFromID(id);
if (node_tree) {
node_tree->id.flag &= LIB_FAKEUSER;
}
}
}
}