[Bf-blender-cvs] [3f78569c3e6] master: Fix (unreported) liboverride of an object hiding its dependencies.

Bastien Montagne noreply at git.blender.org
Tue Oct 13 13:08:47 CEST 2020


Commit: 3f78569c3e62ea3a184c7e0854e6e699c814cc72
Author: Bastien Montagne
Date:   Tue Oct 13 13:05:19 2020 +0200
Branches: master
https://developer.blender.org/rB3f78569c3e62ea3a184c7e0854e6e699c814cc72

Fix (unreported) liboverride of an object hiding its dependencies.

When we override a whole collection, we want to add non-instantiated
objects to a hidden sub-collection at the end of the process.

However, this makes no sense when instantiating an object, if other
dependencies objects get also overridden on the process, we should just
add them to the same collection owning the root object.

===================================================================

M	source/blender/blenkernel/intern/lib_override.c

===================================================================

diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index a989a865994..e008058ae39 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -597,32 +597,30 @@ static void lib_override_library_create_post_process(
             case ID_GR: {
               default_instantiating_collection = BKE_collection_add(
                   bmain, (Collection *)id_root, "OVERRIDE_HIDDEN");
+              /* Hide the collection from viewport and render. */
+              default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
+                                                        COLLECTION_RESTRICT_RENDER;
               break;
             }
             case ID_OB: {
-              /* Add the new container collection to one of the collections instantiating the
+              /* Add the other objects to one of the collections instantiating the
                * root object, or scene's master collection if none found. */
               Object *ob_root = (Object *)id_root;
               LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
                 if (BKE_collection_has_object(collection, ob_root) &&
                     BKE_view_layer_has_collection(view_layer, collection) &&
                     !ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection)) {
-                  default_instantiating_collection = BKE_collection_add(
-                      bmain, collection, "OVERRIDE_HIDDEN");
+                  default_instantiating_collection = collection;
                 }
               }
               if (default_instantiating_collection == NULL) {
-                default_instantiating_collection = BKE_collection_add(
-                    bmain, scene->master_collection, "OVERRIDE_HIDDEN");
+                default_instantiating_collection = scene->master_collection;
               }
               break;
             }
             default:
               BLI_assert(0);
           }
-          /* Hide the collection from viewport and render. */
-          default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
-                                                    COLLECTION_RESTRICT_RENDER;
         }
 
         BKE_collection_object_add(bmain, default_instantiating_collection, ob_new);



More information about the Bf-blender-cvs mailing list