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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-09-19 13:12:02 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-09-19 17:10:12 +0300
commit34c361db5a0515446bfc59c802a36e9b833523f3 (patch)
tree46f4c347ef1a05b6b3acb4b59a0a3dde34645587 /source/blender/depsgraph
parent3714c83441ab2c60f76fd8237303e007a62d0148 (diff)
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.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc38
1 files changed, 21 insertions, 17 deletions
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(