diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-23 17:17:06 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-08-23 17:40:35 +0300 |
commit | f97d61c4bd2a9ab3c1dd0ae4902778bc9703a716 (patch) | |
tree | 1d426512c88b369396cc6885523570606f57347f /source/blender/depsgraph/intern/builder/deg_builder.cc | |
parent | a9ecfc965349241b858b1b23d0a3d9b987600b5d (diff) |
Depsgraph: Bring back visibility checks based on collection restrict flags
The title says it all actually, the idea is to speedup the following case:
- Visible duplicator of a restricted collection (reported as T56512),
One of the questionable change is that none of the view layer bases is
ignored now. This ensures corresponding objects will have copy-on-write
component evaluated, making it possible to access those pointers. The
evaluation of those objects is skipped.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3641
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 8f5925a5ce3..0549ec76f3c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -34,6 +34,8 @@ #include "DNA_object_types.h" #include "DNA_ID.h" +#include "BLI_stack.h" + extern "C" { #include "BKE_animsys.h" } @@ -43,6 +45,8 @@ extern "C" { #include "intern/eval/deg_eval_copy_on_write.h" #include "intern/nodes/deg_node.h" #include "intern/nodes/deg_node_id.h" +#include "intern/nodes/deg_node_component.h" +#include "intern/nodes/deg_node_operation.h" #include "util/deg_util_foreach.h" @@ -50,8 +54,61 @@ extern "C" { namespace DEG { +namespace { + +void deg_graph_build_flush_layers(Depsgraph *graph) +{ + BLI_Stack *stack = BLI_stack_new(sizeof(OperationDepsNode*), + "DEG flush layers stack"); + foreach (OperationDepsNode *op_node, graph->operations) { + op_node->done = 0; + op_node->num_links_pending = 0; + foreach (DepsRelation *rel, op_node->outlinks) { + if ((rel->from->type == DEG_NODE_TYPE_OPERATION) && + (rel->flag & DEPSREL_FLAG_CYCLIC) == 0) + { + ++op_node->num_links_pending; + } + } + if (op_node->num_links_pending == 0) { + BLI_stack_push(stack, &op_node); + op_node->done = 1; + } + } + while (!BLI_stack_is_empty(stack)) { + OperationDepsNode *op_node; + BLI_stack_pop(stack, &op_node); + /* Flush layers to parents. */ + foreach (DepsRelation *rel, op_node->inlinks) { + if (rel->from->type == DEG_NODE_TYPE_OPERATION) { + OperationDepsNode *op_from = (OperationDepsNode *)rel->from; + op_from->owner->owner->is_visible |= + op_node->owner->owner->is_visible; + } + } + /* Schedule parent nodes. */ + foreach (DepsRelation *rel, op_node->inlinks) { + if (rel->from->type == DEG_NODE_TYPE_OPERATION) { + OperationDepsNode *op_from = (OperationDepsNode *)rel->from; + if ((rel->flag & DEPSREL_FLAG_CYCLIC) == 0) { + BLI_assert(op_from->num_links_pending > 0); + --op_from->num_links_pending; + } + if (op_from->num_links_pending == 0 && op_from->done == 0) { + BLI_stack_push(stack, &op_from); + op_from->done = 1; + } + } + } + } + BLI_stack_free(stack); +} + +} // namespace + void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) { + deg_graph_build_flush_layers(graph); /* Re-tag IDs for update if it was tagged before the relations * update tag. */ |