diff options
author | Bastien Montagne <bastien@blender.org> | 2021-02-09 18:31:09 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-02-09 18:52:53 +0300 |
commit | 4e92be6d720162c1463d8bcc41a9474e9a10f1ff (patch) | |
tree | 69db7f71d78e0aabc77504a6cc76eef152a3949f /source | |
parent | 9e1065ead2aceeaa99a708f0cb1b65fbd771d50a (diff) |
LibOverride: Verious minor cleanups and fixes to code tagging IDs in an override hierarchy.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 576fac8a641..f3f524cf9ad 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -370,8 +370,9 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain) /* Tag all IDs in dependency relationships within an override hierarchy/group. * + * Requires existing `Main.relations`. + * * Note: this is typically called to complete `lib_override_linked_group_tag()`. - * Note: BMain's relations mapping won't be valid anymore after that call. */ static bool lib_override_hierarchy_dependencies_recursive_tag(Main *bmain, ID *id, @@ -464,19 +465,19 @@ static int lib_override_linked_group_tag_cb(LibraryIDLinkCallbackData *cb_data) /* This will tag at least all 'boundary' linked IDs for a potential override group. * + * Requires existing `Main.relations`. + * * Note that you will then need to call #lib_override_hierarchy_dependencies_recursive_tag to * complete tagging of all dependencies within the override group. * * We currently only consider Collections and Objects (that are not used as bone shapes) as valid * boundary IDs to define an override group. */ -static void lib_override_linked_group_tag( - Main *bmain, ID *id, const uint tag, const uint missing_tag, const bool create_bmain_relations) +static void lib_override_linked_group_tag(Main *bmain, + ID *id, + const uint tag, + const uint missing_tag) { - if (create_bmain_relations) { - BKE_main_relations_create(bmain, 0); - } - if ((id->tag & LIB_TAG_MISSING)) { id->tag |= missing_tag; } @@ -502,10 +503,6 @@ static void lib_override_linked_group_tag( } } } - - if (create_bmain_relations) { - BKE_main_relations_free(bmain); - } } static int lib_override_local_group_tag_cb(LibraryIDLinkCallbackData *cb_data) @@ -564,14 +561,7 @@ static int lib_override_local_group_tag_cb(LibraryIDLinkCallbackData *cb_data) return IDWALK_RET_NOP; } -/* This will tag at least all 'boundary' linked IDs for a potential override group. - * - * Note that you will then need to call #lib_override_hierarchy_dependencies_recursive_tag to - * complete tagging of all dependencies within the override group. - * - * We currently only consider Collections and Objects (that are not used as bone shapes) as valid - * boundary IDs to define an override group. - */ +/* This will tag all override IDs of an override group defined by the given `id_root`. */ static void lib_override_local_group_tag(Main *bmain, ID *id, const uint tag, @@ -589,7 +579,7 @@ static bool lib_override_library_create_do(Main *bmain, ID *id_root) { BKE_main_relations_create(bmain, 0); - lib_override_linked_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING, false); + lib_override_linked_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING); lib_override_hierarchy_dependencies_recursive_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING); BKE_main_relations_free(bmain); @@ -791,7 +781,7 @@ bool BKE_lib_override_library_resync(Main *bmain, Scene *scene, ViewLayer *view_ lib_override_local_group_tag(bmain, id_root, LIB_TAG_DOIT, LIB_TAG_MISSING); - lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING, false); + lib_override_linked_group_tag(bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING); lib_override_hierarchy_dependencies_recursive_tag( bmain, id_root_reference, LIB_TAG_DOIT, LIB_TAG_MISSING); |