[Bf-blender-cvs] [34c361db5a0] blender2.8: Depsgraph: Correct early output in collections
Sergey Sharybin
noreply at git.blender.org
Wed Sep 19 16:10:20 CEST 2018
Commit: 34c361db5a0515446bfc59c802a36e9b833523f3
Author: Sergey Sharybin
Date: Wed Sep 19 12:12:02 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB34c361db5a0515446bfc59c802a36e9b833523f3
Depsgraph: Correct early output in collections
Need to ensure objects from collection which was built but
is became visible in the new "context" are poked for re-built.
This should be rather cheap, since this only will update
their visibility flag.
Can not rely on visibility flush here, since there is no
relations between collection and its objects.
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 243039fafba..0b072256dba 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -481,15 +481,28 @@ void DepsgraphNodeBuilder::build_id(ID *id)
void DepsgraphNodeBuilder::build_collection(Collection *collection)
{
+ const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
+ ? COLLECTION_RESTRICT_VIEW
+ : COLLECTION_RESTRICT_RENDER;
+ const bool is_collection_restricted = (collection->flag & restrict_flag);
+ const bool is_collection_visible =
+ !is_collection_restricted && is_parent_collection_visible_;
if (built_map_.checkIsBuiltAndTag(collection)) {
- /* NOTE: Currently collections restrict flags only depend on collection
- * itself and do not depend on a "context" (like, particle system
- * visibility).
- *
- * If we ever change this, we need to update restrict flag here for an
- * already built collection.
- */
- return;
+ IDDepsNode *id_node = find_id_node(&collection->id);
+ if (is_collection_visible && !id_node->is_visible) {
+ /* Collection became visible, make sure nested collections and
+ * objects are poked with the new visibility flag, since they
+ * might become visible too.
+ */
+ }
+ else {
+ return;
+ }
+ }
+ else {
+ /* Collection itself. */
+ IDDepsNode *id_node = add_id_node(&collection->id);
+ id_node->is_visible = is_collection_visible;
}
/* Backup state. */
Collection *current_state_collection = collection_;
@@ -497,16 +510,7 @@ void DepsgraphNodeBuilder::build_collection(Collection *collection)
is_parent_collection_visible_;
/* Modify state as we've entered new collection/ */
collection_ = collection;
- const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
- ? COLLECTION_RESTRICT_VIEW
- : COLLECTION_RESTRICT_RENDER;
- const bool is_collection_restricted = (collection->flag & restrict_flag);
- const bool is_collection_visible =
- !is_collection_restricted && is_parent_collection_visible_;
is_parent_collection_visible_ = is_collection_visible;
- /* Collection itself. */
- IDDepsNode *id_node = add_id_node(&collection->id);
- id_node->is_visible = is_collection_visible;
/* Build collection objects. */
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
build_object(
More information about the Bf-blender-cvs
mailing list