[Bf-blender-cvs] [9948e26e144] blender2.8: Fix depsgrah copying and evaluating hidden collections.

Brecht Van Lommel noreply at git.blender.org
Thu May 31 11:46:06 CEST 2018


Commit: 9948e26e14408a24000667d46bcd0bce99e437ce
Author: Brecht Van Lommel
Date:   Thu May 31 11:30:36 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9948e26e14408a24000667d46bcd0bce99e437ce

Fix depsgrah copying and evaluating hidden collections.

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index e4cdbdadee5..fbf94293236 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -424,6 +424,13 @@ void DepsgraphNodeBuilder::build_collection(Collection *collection)
 	if (built_map_.checkIsBuiltAndTag(collection)) {
 		return;
 	}
+
+	const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
+		COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
+	if (collection->flag & restrict_flag) {
+		return;
+	}
+
 	/* Build collection objects. */
 	LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
 		build_object(-1, cob->ob, DEG_ID_LINKED_INDIRECTLY);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
index 35f01c19608..fd4b975e53f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
@@ -67,9 +67,17 @@ namespace DEG {
 
 void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb)
 {
+	const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
+		COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
+
 	for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
-		build_collection(lc->collection);
-		build_layer_collections(&lc->layer_collections);
+		if (!(lc->collection->flag & restrict_flag)) {
+			if (!(lc->flag & LAYER_COLLECTION_EXCLUDE)) {
+				build_collection(lc->collection);
+			}
+
+			build_layer_collections(&lc->layer_collections);
+		}
 	}
 }
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 64bdbe49dac..c4be03eee8c 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -427,6 +427,12 @@ void DepsgraphRelationBuilder::build_id(ID *id)
 
 void DepsgraphRelationBuilder::build_collection(Object *object, Collection *collection)
 {
+	const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
+		COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
+	if (collection->flag & restrict_flag) {
+		return;
+	}
+
 	const bool group_done = built_map_.checkIsBuiltAndTag(collection);
 	OperationKey object_local_transform_key(object != NULL ? &object->id : NULL,
 	                                        DEG_NODE_TYPE_TRANSFORM,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
index 4db72a349dc..0f159248ff4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
@@ -71,9 +71,17 @@ namespace DEG {
 
 void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
 {
+	const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
+		COLLECTION_RESTRICT_VIEW : COLLECTION_RESTRICT_RENDER;
+
 	for (LayerCollection *lc = (LayerCollection *)lb->first; lc; lc = lc->next) {
-		build_collection(NULL, lc->collection);
-		build_layer_collections(&lc->layer_collections);
+		if (!(lc->collection->flag & restrict_flag)) {
+			if (!(lc->flag & LAYER_COLLECTION_EXCLUDE)) {
+				build_collection(NULL, lc->collection);
+			}
+
+			build_layer_collections(&lc->layer_collections);
+		}
 	}
 }



More information about the Bf-blender-cvs mailing list