diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-14 12:38:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-14 15:51:13 +0300 |
commit | 140b26909ea9cf910aa39efd0c2f81a2a410bc84 (patch) | |
tree | 56a8398b0cdb417cdc9a4db2cba0132c22ce5859 /source/blender/editors/object | |
parent | 1e5ce391563f48c487862e5f05c6517e98a42e21 (diff) |
LibOverride: Move code tagging reauired dependencies of an override into BKE.
This is fairly generic code that can be re-used in other places.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b81fea1848c..6186eefb214 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2242,28 +2242,6 @@ void OBJECT_OT_make_local(wmOperatorType *ot) /** \name Make Library Override Operator * \{ */ -static bool make_override_hierarchy_recursive_tag(Main *bmain, ID *id) -{ - MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->id_user_to_used, id); - - /* This way we won't process again that ID should we encounter it again through another - * relationship hierarchy. - * Note that this does not free any memory from relations, so we can still use the entries. - */ - BKE_main_relations_ID_remove(bmain, id); - - for (; entry != NULL; entry = entry->next) { - /* We only consider IDs from the same library. */ - if (entry->id_pointer != NULL && (*entry->id_pointer)->lib == id->lib) { - if (make_override_hierarchy_recursive_tag(bmain, *entry->id_pointer)) { - id->tag |= LIB_TAG_DOIT; - } - } - } - - return (id->tag & LIB_TAG_DOIT) != 0; -} - static int make_override_tag_ids_cb(LibraryIDLinkCallbackData *cb_data) { if (cb_data->cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_LOOPBACK)) { @@ -2399,12 +2377,8 @@ static int make_override_library_exec(bContext *C, wmOperator *op) } } - /* Then we tag all intermediary data-blocks in-between two overridden ones (e.g. if a shapekey - * has a driver using an armature object's bone, we need to override the shapekey/obdata, the - * objects using them, etc.) */ - make_override_hierarchy_recursive_tag(bmain, id_root); - - BKE_main_relations_free(bmain); + /* Note that this call will also free the main relations data we created above. */ + BKE_lib_override_dependencies_tag(bmain, id_root, LIB_TAG_DOIT, false); ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { |