Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-02-01 19:39:00 +0300
committerBastien Montagne <bastien@blender.org>2021-02-02 19:26:59 +0300
commit2262e18269bf93a5b93ad0f36020cef69b728f43 (patch)
tree3e230a182b5be5dba42772fb57c82f08fcb3908c
parent198ff4703f84d0c32674d9a2b4be3121586fb083 (diff)
Cleanup: LibOverride: group logically utils static functions.
-rw-r--r--source/blender/blenkernel/intern/lib_override.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 7ccf53546b8..9e8e515e1a3 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -368,6 +368,46 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain)
return success;
}
+/* Tag all IDs in dependency relationships within an override hierarchy/group.
+ *
+ * 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,
+ const uint tag,
+ const uint missing_tag)
+{
+ MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->relations_from_pointers, id);
+ BLI_assert(entry != NULL);
+
+ if (entry->tags & MAINIDRELATIONS_ENTRY_TAGS_PROCESSED) {
+ /* This ID has already been processed. */
+ return (*(uint *)&id->tag & tag) != 0;
+ }
+ /* This way we won't process again that ID, should we encounter it again through another
+ * relationship hierarchy. */
+ entry->tags |= MAINIDRELATIONS_ENTRY_TAGS_PROCESSED;
+
+ for (MainIDRelationsEntryItem *to_id_entry = entry->to_ids; to_id_entry != NULL;
+ to_id_entry = to_id_entry->next) {
+ if ((to_id_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. */
+ ID *to_id = *to_id_entry->id_pointer.to;
+ if (to_id != NULL && to_id->lib == id->lib) {
+ if (lib_override_hierarchy_dependencies_recursive_tag(bmain, to_id, tag, missing_tag)) {
+ id->tag |= tag;
+ }
+ }
+ }
+
+ return (*(uint *)&id->tag & tag) != 0;
+}
+
typedef struct LibOverrideGroupTagData {
ID *id_root;
uint tag;
@@ -422,46 +462,6 @@ static int lib_override_linked_group_tag_cb(LibraryIDLinkCallbackData *cb_data)
return IDWALK_RET_NOP;
}
-/* Tag all IDs in dependency relationships within an override hierarchy/group.
- *
- * 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,
- const uint tag,
- const uint missing_tag)
-{
- MainIDRelationsEntry *entry = BLI_ghash_lookup(bmain->relations->relations_from_pointers, id);
- BLI_assert(entry != NULL);
-
- if (entry->tags & MAINIDRELATIONS_ENTRY_TAGS_PROCESSED) {
- /* This ID has already been processed. */
- return (*(uint *)&id->tag & tag) != 0;
- }
- /* This way we won't process again that ID, should we encounter it again through another
- * relationship hierarchy. */
- entry->tags |= MAINIDRELATIONS_ENTRY_TAGS_PROCESSED;
-
- for (MainIDRelationsEntryItem *to_id_entry = entry->to_ids; to_id_entry != NULL;
- to_id_entry = to_id_entry->next) {
- if ((to_id_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. */
- ID *to_id = *to_id_entry->id_pointer.to;
- if (to_id != NULL && to_id->lib == id->lib) {
- if (lib_override_hierarchy_dependencies_recursive_tag(bmain, to_id, tag, missing_tag)) {
- id->tag |= tag;
- }
- }
- }
-
- return (*(uint *)&id->tag & tag) != 0;
-}
-
/* 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