diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-24 11:54:09 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-24 12:19:48 +0300 |
commit | 93f6a9d65220f9c43dc6dde7886880d77015eb8c (patch) | |
tree | 33152527781504a9ae645bd84479b22cd1e404dc /source | |
parent | d2679b3e420320c646be2dabf311fca83721de65 (diff) |
Depsgraph: Add special cases to deal with multiple objects selection update
The idea then is to avoid doing depsgraph tag for each of the object which
selection is changed (which could be tricky to do anyway due to lots of areas
of selection code where this could happen), and simply tag scene's with
selection update tag.
This will involve synchronization of flags from base to objects, which is
rather cheap anyway.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 968be5269c4..2e6d5043336 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -284,13 +284,34 @@ void id_tag_update_copy_on_write(Depsgraph *graph, IDDepsNode *id_node) void id_tag_update_select_update(Depsgraph *graph, IDDepsNode *id_node) { - ComponentDepsNode *batch_cache_comp = - id_node->find_component(DEG_NODE_TYPE_BATCH_CACHE); - OperationDepsNode *select_update_node = - batch_cache_comp->find_operation(DEG_OPCODE_GEOMETRY_SELECT_UPDATE, - "", -1); - if (select_update_node != NULL) { - select_update_node->tag_update(graph); + ComponentDepsNode *component; + OperationDepsNode *node = NULL; + const ID_Type id_type = GS(id_node->id_orig->name); + + if (id_type == ID_SCE) { + /* We need to flush base flags to all objects in a scene since we + * don't know which ones changed. However, we don't want to update + * the whole scene, so pick up some operation which will do as less + * as possible. + * + * TODO(sergey): We can introduce explicit exit operation which + * does nothing and which is only used to cascade flush down the + * road. + */ + component = id_node->find_component(DEG_NODE_TYPE_LAYER_COLLECTIONS); + node = component->find_operation(DEG_OPCODE_VIEW_LAYER_DONE); + } + else if (id_type == ID_OB) { + component = id_node->find_component(DEG_NODE_TYPE_LAYER_COLLECTIONS); + node = component->find_operation(DEG_OPCODE_OBJECT_BASE_FLAGS); + } + else { + component = id_node->find_component(DEG_NODE_TYPE_BATCH_CACHE); + node = component->find_operation(DEG_OPCODE_GEOMETRY_SELECT_UPDATE, + "", -1); + } + if (node != NULL) { + node->tag_update(graph); } } |