Depsgraph: Silence relations builder errors
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 10:35:00 +0000 (12:35 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 10:36:52 +0000 (12:36 +0200)
Were caused by depsgraph trying to create relations between objects
which are coming from restricted collection.

source/blender/depsgraph/intern/builder/deg_builder_relations.cc

index 26f5c167627bc325b95f83562c5d9c6767f4b22b..f02a48e803e8e0a083fb6b635456f24ae706f1f4 100644 (file)
@@ -473,7 +473,12 @@ void DepsgraphRelationBuilder::build_collection(Object *object, Collection *coll
        }
        if (object != NULL) {
                const ListBase group_objects = BKE_collection_object_cache_get(collection);
+               const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
+                       BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER;
                LISTBASE_FOREACH (Base *, base, &group_objects) {
+                       if ((base->flag & base_flag) == 0) {
+                               continue;
+                       }
                        ComponentKey dupli_transform_key(&base->object->id, DEG_NODE_TYPE_TRANSFORM);
                        add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
                }