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>2022-01-05 18:14:26 +0300
committerBastien Montagne <bastien@blender.org>2022-01-05 19:30:22 +0300
commit1403f034ffd4b394fc8a9b8adec34698dcec891e (patch)
tree5ca6fbc5e84506f9d207d7320974ce720a5bd0d9
parentb63f375775b429d5a1b51c09671d8fe57aa39d89 (diff)
LibOverride: Cleanup some code.
No functional change.
-rw-r--r--source/blender/blenkernel/intern/lib_override.c88
1 files changed, 45 insertions, 43 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 81c290589a6..07ec8d32ad0 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -672,54 +672,56 @@ static void lib_override_linked_group_tag(LibOverrideGroupTagData *data)
id_root->tag |= data->tag;
}
- if (ELEM(GS(id_root->name), ID_OB, ID_GR)) {
- /* Tag all collections and objects. */
- lib_override_linked_group_tag_recursive(data);
+ /* Only objects and groups are currently considered as 'keys' in override hierarchies. */
+ if (!ELEM(GS(id_root->name), ID_OB, ID_GR)) {
+ return;
+ }
- /* Do not override objects used as bone shapes, nor their collections if possible. */
- lib_override_linked_group_tag_clear_boneshapes_objects(data);
+ /* Tag all collections and objects recursively. */
+ lib_override_linked_group_tag_recursive(data);
- /* For each object tagged for override, ensure we get at least one local or liboverride
- * collection to host it. Avoids getting a bunch of random object in the scene's master
- * collection when all objects' dependencies are not properly 'packed' into a single root
- * collection. */
- LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
- if (ID_IS_LINKED(ob) && (ob->id.tag & data->tag) != 0) {
- Collection *instantiating_collection = NULL;
- Collection *instantiating_collection_override_candidate = NULL;
- /* Loop over all collections instantiating the object, if we already have a 'locale' one we
- * have nothing to do, otherwise try to find a 'linked' one that we can override too. */
- LinkNodePair *instantiating_collection_linklist = BLI_ghash_lookup(
- data->linked_object_to_instantiating_collections, ob);
- if (instantiating_collection_linklist != NULL) {
- for (LinkNode *instantiating_collection_linknode =
- instantiating_collection_linklist->list;
- instantiating_collection_linknode != NULL;
- instantiating_collection_linknode = instantiating_collection_linknode->next) {
- instantiating_collection = instantiating_collection_linknode->link;
- /* In (recursive) resync case, if a collection of a 'parent' lib instantiates the
- * linked object, it is also fine. */
- if (!ID_IS_LINKED(instantiating_collection) ||
- (is_resync && ID_IS_LINKED(id_root) &&
- instantiating_collection->id.lib->temp_index < id_root->lib->temp_index)) {
- break;
- }
- if (ID_IS_LINKED(instantiating_collection) &&
- (!is_resync || instantiating_collection->id.lib == id_root->lib)) {
- instantiating_collection_override_candidate = instantiating_collection;
- }
- instantiating_collection = NULL;
- }
- }
+ /* Do not override objects used as bone shapes, nor their collections if possible. */
+ lib_override_linked_group_tag_clear_boneshapes_objects(data);
- if (instantiating_collection == NULL &&
- instantiating_collection_override_candidate != NULL) {
- if (instantiating_collection_override_candidate->id.tag & LIB_TAG_MISSING) {
- instantiating_collection_override_candidate->id.tag |= data->missing_tag;
+ /* For each object tagged for override, ensure we get at least one local or liboverride
+ * collection to host it. Avoids getting a bunch of random object in the scene's master
+ * collection when all objects' dependencies are not properly 'packed' into a single root
+ * collection. */
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ if (ID_IS_LINKED(ob) && (ob->id.tag & data->tag) != 0) {
+ Collection *instantiating_collection = NULL;
+ Collection *instantiating_collection_override_candidate = NULL;
+ /* Loop over all collections instantiating the object, if we already have a 'locale' one we
+ * have nothing to do, otherwise try to find a 'linked' one that we can override too. */
+ LinkNodePair *instantiating_collection_linklist = BLI_ghash_lookup(
+ data->linked_object_to_instantiating_collections, ob);
+ if (instantiating_collection_linklist != NULL) {
+ for (LinkNode *instantiating_collection_linknode = instantiating_collection_linklist->list;
+ instantiating_collection_linknode != NULL;
+ instantiating_collection_linknode = instantiating_collection_linknode->next) {
+ instantiating_collection = instantiating_collection_linknode->link;
+ /* In (recursive) resync case, if a collection of a 'parent' lib instantiates the
+ * linked object, it is also fine. */
+ if (!ID_IS_LINKED(instantiating_collection) ||
+ (is_resync && ID_IS_LINKED(id_root) &&
+ instantiating_collection->id.lib->temp_index < id_root->lib->temp_index)) {
+ break;
}
- else {
- instantiating_collection_override_candidate->id.tag |= data->tag;
+ if (ID_IS_LINKED(instantiating_collection) &&
+ (!is_resync || instantiating_collection->id.lib == id_root->lib)) {
+ instantiating_collection_override_candidate = instantiating_collection;
}
+ instantiating_collection = NULL;
+ }
+ }
+
+ if (instantiating_collection == NULL &&
+ instantiating_collection_override_candidate != NULL) {
+ if (instantiating_collection_override_candidate->id.tag & LIB_TAG_MISSING) {
+ instantiating_collection_override_candidate->id.tag |= data->missing_tag;
+ }
+ else {
+ instantiating_collection_override_candidate->id.tag |= data->tag;
}
}
}