diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-09 13:41:50 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-09 13:43:41 +0300 |
commit | 0ad54b5ba3464856d72fde990773af950a27e986 (patch) | |
tree | b504836ef172b6ddcb6652c17f73afeaac1d1ff4 /source | |
parent | f30086b5b66b1f8f797a61d3506f97eda557d76a (diff) |
Depsgraph: Only build collections for current graph scene layer
Diffstat (limited to 'source')
6 files changed, 69 insertions, 71 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 4a311cec4bd..d03aaac0f16 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -201,13 +201,11 @@ struct DepsgraphNodeBuilder { int index; LayerCollection *parent; }; - void build_layer_collection(Scene *scene, - LayerCollection *layer_collection, + void build_layer_collection(LayerCollection *layer_collection, LayerCollectionState *state); - void build_layer_collections(Scene *scene, - ListBase *layer_collections, + void build_layer_collections(ListBase *layer_collections, LayerCollectionState *state); - void build_scene_layer_collections(Scene *scene); + void build_scene_layer_collections(SceneLayer *scene_layer); protected: /* State which never changes, same for the whole builder time. */ Main *bmain_; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc index 660d7fedb52..b3dc293b13b 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc @@ -59,14 +59,16 @@ extern "C" { namespace DEG { -void DepsgraphNodeBuilder::build_layer_collection(Scene *scene, - LayerCollection *layer_collection, - LayerCollectionState *state) +void DepsgraphNodeBuilder::build_layer_collection( + LayerCollection *layer_collection, + LayerCollectionState *state) { /* TODO(sergey): This will attempt to create component for each collection. * Harmless but could be optimized. */ - ComponentDepsNode *comp = add_component_node(&scene->id, DEG_NODE_TYPE_LAYER_COLLECTIONS); + ComponentDepsNode *comp = add_component_node( + &scene_->id, + DEG_NODE_TYPE_LAYER_COLLECTIONS); add_operation_node(comp, function_bind(BKE_layer_eval_layer_collection, @@ -81,47 +83,51 @@ void DepsgraphNodeBuilder::build_layer_collection(Scene *scene, /* Recurs into nested layer collections. */ LayerCollection *parent = state->parent; state->parent = layer_collection; - build_layer_collections(scene, &layer_collection->layer_collections, state); + build_layer_collections(&layer_collection->layer_collections, state); state->parent = parent; } -void DepsgraphNodeBuilder::build_layer_collections(Scene *scene, - ListBase *layer_collections, +void DepsgraphNodeBuilder::build_layer_collections(ListBase *layer_collections, LayerCollectionState *state) { LINKLIST_FOREACH (LayerCollection *, layer_collection, layer_collections) { - build_layer_collection(scene, layer_collection, state); + build_layer_collection(layer_collection, state); } } -void DepsgraphNodeBuilder::build_scene_layer_collections(Scene *scene) +void DepsgraphNodeBuilder::build_scene_layer_collections( + SceneLayer *scene_layer) { Scene *scene_cow; if (DEG_depsgraph_use_copy_on_write()) { - /* Make sure we've got ID node, so we can get pointer to CoW datablock. */ - scene_cow = expand_cow_datablock(scene); + /* Make sure we've got ID node, so we can get pointer to CoW datablock. + */ + scene_cow = expand_cow_datablock(scene_); } else { - scene_cow = scene; + scene_cow = scene_; } LayerCollectionState state; state.index = 0; - LINKLIST_FOREACH (SceneLayer *, scene_layer, &scene_cow->render_layers) { - ComponentDepsNode *comp = add_component_node(&scene->id, DEG_NODE_TYPE_LAYER_COLLECTIONS); - - add_operation_node(comp, - function_bind(BKE_layer_eval_layer_collection_pre, _1, scene_cow, scene_layer), - DEG_OPCODE_SCENE_LAYER_INIT, - scene_layer->name); - add_operation_node(comp, - function_bind(BKE_layer_eval_layer_collection_post, _1, scene_layer), - DEG_OPCODE_SCENE_LAYER_DONE, - scene_layer->name); - - state.parent = NULL; - build_layer_collections(scene, &scene_layer->layer_collections, &state); - } + ComponentDepsNode *comp = add_component_node( + &scene_->id, + DEG_NODE_TYPE_LAYER_COLLECTIONS); + add_operation_node(comp, + function_bind(BKE_layer_eval_layer_collection_pre, + _1, + scene_cow, + scene_layer), + DEG_OPCODE_SCENE_LAYER_INIT, + scene_layer->name); + add_operation_node(comp, + function_bind(BKE_layer_eval_layer_collection_post, + _1, + scene_layer), + DEG_OPCODE_SCENE_LAYER_DONE, + scene_layer->name); + state.parent = NULL; + build_layer_collections(&scene_layer->layer_collections, &state); } } // namespace DEG diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene_layer.cc index 8187adc7d15..1a0ce53d0c8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene_layer.cc @@ -141,7 +141,7 @@ void DepsgraphNodeBuilder::build_scene_layer(Scene *scene, } /* Collections. */ - build_scene_layer_collections(scene); + build_scene_layer_collections(scene_layer); /* Parameters evaluation for scene relations mainly. */ add_operation_node(&scene->id, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index e433d3a92e2..e24656ff067 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -247,13 +247,11 @@ struct DepsgraphRelationBuilder OperationKey done_key; OperationKey prev_key; }; - void build_layer_collection(Scene *scene, - LayerCollection *layer_collection, + void build_layer_collection(LayerCollection *layer_collection, LayerCollectionState *state); - void build_layer_collections(Scene *scene, - ListBase *layer_collections, + void build_layer_collections(ListBase *layer_collections, LayerCollectionState *state); - void build_scene_layer_collections(Scene *scene); + void build_scene_layer_collections(SceneLayer *scene_layer); void build_copy_on_write_relations(); void build_copy_on_write_relations(IDDepsNode *id_node); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_layer.cc index 1e57a98d6f7..0deed3ed4ed 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_layer.cc @@ -68,11 +68,11 @@ extern "C" { namespace DEG { -void DepsgraphRelationBuilder::build_layer_collection(Scene *scene, - LayerCollection *layer_collection, - LayerCollectionState *state) +void DepsgraphRelationBuilder::build_layer_collection( + LayerCollection *layer_collection, + LayerCollectionState *state) { - OperationKey layer_key(&scene->id, + OperationKey layer_key(&scene_->id, DEG_NODE_TYPE_LAYER_COLLECTIONS, DEG_OPCODE_SCENE_LAYER_EVAL, layer_collection->scene_collection->name, @@ -83,45 +83,41 @@ void DepsgraphRelationBuilder::build_layer_collection(Scene *scene, state->prev_key = layer_key; /* Recurs into nested layer collections. */ - build_layer_collections(scene, - &layer_collection->layer_collections, - state); + build_layer_collections(&layer_collection->layer_collections, state); } -void DepsgraphRelationBuilder::build_layer_collections(Scene *scene, - ListBase *layer_collections, - LayerCollectionState *state) +void DepsgraphRelationBuilder::build_layer_collections( + ListBase *layer_collections, + LayerCollectionState *state) { LINKLIST_FOREACH (LayerCollection *, layer_collection, layer_collections) { /* Recurs into the layer. */ - build_layer_collection(scene, layer_collection, state); + build_layer_collection(layer_collection, state); } } -void DepsgraphRelationBuilder::build_scene_layer_collections(Scene *scene) +void DepsgraphRelationBuilder::build_scene_layer_collections( + SceneLayer *scene_layer) { LayerCollectionState state; state.index = 0; - LINKLIST_FOREACH (SceneLayer *, scene_layer, &scene->render_layers) { - OperationKey init_key(&scene->id, - DEG_NODE_TYPE_LAYER_COLLECTIONS, - DEG_OPCODE_SCENE_LAYER_INIT, - scene_layer->name); - OperationKey done_key(&scene->id, - DEG_NODE_TYPE_LAYER_COLLECTIONS, - DEG_OPCODE_SCENE_LAYER_DONE, - scene_layer->name); - - state.init_key = init_key; - state.done_key = done_key; - state.prev_key = init_key; - - build_layer_collections(scene, - &scene_layer->layer_collections, - &state); - - add_relation(state.prev_key, done_key, "Layer collection order"); - } + + OperationKey init_key(&scene_->id, + DEG_NODE_TYPE_LAYER_COLLECTIONS, + DEG_OPCODE_SCENE_LAYER_INIT, + scene_layer->name); + OperationKey done_key(&scene_->id, + DEG_NODE_TYPE_LAYER_COLLECTIONS, + DEG_OPCODE_SCENE_LAYER_DONE, + scene_layer->name); + + state.init_key = init_key; + state.done_key = done_key; + state.prev_key = init_key; + + build_layer_collections(&scene_layer->layer_collections, &state); + + add_relation(state.prev_key, done_key, "Layer collection order"); } } // namespace DEG diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene_layer.cc index cbf4eddf13d..c0896638164 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene_layer.cc @@ -125,7 +125,7 @@ void DepsgraphRelationBuilder::build_scene_layer(Scene *scene, SceneLayer *scene } /* Collections. */ - build_scene_layer_collections(scene); + build_scene_layer_collections(scene_layer); /* TODO(sergey): Do this flush on CoW object? */ for (Depsgraph::OperationNodes::const_iterator it_op = graph_->operations.begin(); |