diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-22 18:05:28 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-23 12:33:24 +0300 |
commit | c8653e516dfaa8ba37638d6da0ea8ee747fadaac (patch) | |
tree | 3e58ff227a769834ffabe552769fbf3be5c096fb /source/blender/blenkernel | |
parent | 67002402bd60d701acaf9e22801bc4411ded21d7 (diff) |
LibOverride: Optimize/fix new generic 'relation-based' make override code.
This commit mostly avoids following 'loop back' ID pointers, since those
should never define an actual relationship.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 8e662892d30..9c543e99d74 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -362,7 +362,11 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain) static bool lib_override_hierarchy_recursive_tag(Main *bmain, ID *id, const uint tag) { - MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->id_user_to_used, id); + void **entry_vp = BLI_ghash_lookup_p(bmain->relations->id_user_to_used, id); + if (entry_vp == NULL) { + /* Already processed. */ + return (id->tag & tag) != 0; + } /* This way we won't process again that ID should we encounter it again through another * relationship hierarchy. @@ -370,7 +374,12 @@ static bool lib_override_hierarchy_recursive_tag(Main *bmain, ID *id, const uint */ BKE_main_relations_ID_remove(bmain, id); - for (; entry != NULL; entry = entry->next) { + for (MainIDRelationsEntry *entry = *entry_vp; entry != NULL; entry = entry->next) { + if ((entry->usage_flag & IDWALK_CB_LOOPBACK) != 0) { + /* Never consider 'loop back' relationships ('from', 'parents', 'owner' etc. pointers) as + * actual dependencies. */ + continue; + } /* We only consider IDs from the same library. */ if (entry->id_pointer != NULL && (*entry->id_pointer)->lib == id->lib) { if (lib_override_hierarchy_recursive_tag(bmain, *entry->id_pointer, tag)) { |