Improve handling of (in)direclty linked status for linked IDs.
This commit essentially ensures before writing .blend file that only actualy locally used linked IDs are tagged as `LIB_TAG_EXTERN` (and therefore get a reference stored in the .blend file). Previously, a linked ID tagged as directly linked would never get back to the indirectly linked status. Consequence was a lot of 'needless' references to linked data in .blend files. This commit also introduces a new flag for lib_query ID usage types, `IDWALK_CB_DIRECT_WEAK_LINK`, used currently for base's Object pointer, and for LayerCollection's Collection pointer. NOTE: A side-effect of this patch is that even IDs explicitely linked by the user won't be kept anymore when writing files, i.e. they will not be there anymore after a file reload, if they are not actually used. Overhead of new process is below 0.1% in whole file saving process in a Heist production file e.g. Reviewed By: brecht Differential Revision: https://developer.blender.org/D16605
This commit is contained in:
@@ -247,7 +247,7 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
|
||||
|
||||
assert material.users == 2
|
||||
# Currently linked data which has no more local user never gets reset to indirectly linked status.
|
||||
# ~ assert material.is_library_indirect == True
|
||||
assert material.is_library_indirect == True
|
||||
|
||||
bpy.ops.wm.open_mainfile(filepath=output_work_path, load_ui=False)
|
||||
|
||||
@@ -264,7 +264,7 @@ class TestBlendLibLinkIndirect(TestBlendLibLinkHelper):
|
||||
assert material.users == 2 # Fake user is not cleared when linking.
|
||||
# Currently even re-reading the .blend file will not properly reset tag for indirectly linked data,
|
||||
# if their reference was written in the .blend file.
|
||||
# ~ assert material.is_library_indirect == True
|
||||
assert material.is_library_indirect == True
|
||||
|
||||
assert mesh.library is not None
|
||||
assert mesh.use_fake_user is False
|
||||
|
||||
Reference in New Issue
Block a user