diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-08 19:43:53 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-09 12:33:44 +0300 |
commit | 887c2e5c0dead416c40fd6a0524a3da579aa24ae (patch) | |
tree | 79826bcf1c378dd81f19ee601cb928efed0c5c7c /source/blender/depsgraph | |
parent | 70e34ac186ebe86422a89fdccf8d20907743e503 (diff) |
Depsgraph: Make bmain part of builder state and remove bmain from public API
Diffstat (limited to 'source/blender/depsgraph')
7 files changed, 34 insertions, 31 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 98d2e8893c1..89a2dba87c8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -152,9 +152,9 @@ void constraint_walk(bConstraint * /*con*/, /* **** General purpose functions **** */ -DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph) : - bmain_(bmain), - graph_(graph) +DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph) + : bmain_(bmain), + graph_(graph) { } @@ -277,17 +277,17 @@ OperationDepsNode *DepsgraphNodeBuilder::find_operation_node( /* **** Build functions for entity nodes **** */ -void DepsgraphNodeBuilder::begin_build(Main *bmain) { +void DepsgraphNodeBuilder::begin_build() { /* LIB_TAG_DOIT is used to indicate whether node for given ID was already * created or not. This flag is being set in add_id_node(), so functions * shouldn't bother with setting it, they only might query this flag when * needed. */ - BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + BKE_main_id_tag_all(bmain_, LIB_TAG_DOIT, false); /* XXX nested node trees are not included in tag-clearing above, * so we need to do this manually. */ - FOREACH_NODETREE(bmain, nodetree, id) + FOREACH_NODETREE(bmain_, nodetree, id) { if (id != (ID *)nodetree) { nodetree->id.tag &= ~LIB_TAG_DOIT; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 2c698b3335d..db57b2921ea 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -70,7 +70,7 @@ struct DepsgraphNodeBuilder { DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph); ~DepsgraphNodeBuilder(); - void begin_build(Main *bmain); + void begin_build(); IDDepsNode *add_id_node(ID *id); TimeSourceDepsNode *add_time_source(); @@ -118,7 +118,7 @@ struct DepsgraphNodeBuilder { const char *name = "", int name_tag = -1); - void build_scene(Main *bmain, Scene *scene); + void build_scene(Scene *scene); void build_group(Scene *scene, Base *base, Group *group); void build_object(Scene *scene, Base *base, Object *ob); void build_object_transform(Scene *scene, Object *ob); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index 521276bc608..4d048d30d55 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -63,7 +63,7 @@ extern "C" { namespace DEG { -void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) +void DepsgraphNodeBuilder::build_scene(Scene *scene) { /* scene ID block */ add_id_node(&scene->id); @@ -75,7 +75,7 @@ void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) // XXX: depending on how this goes, that scene itself could probably store its // own little partial depsgraph? if (scene->set) { - build_scene(bmain, scene->set); + build_scene(scene->set); } /* scene objects */ @@ -113,17 +113,17 @@ void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) } /* Cache file. */ - LINKLIST_FOREACH (CacheFile *, cachefile, &bmain->cachefiles) { + LINKLIST_FOREACH (CacheFile *, cachefile, &bmain_->cachefiles) { build_cachefile(cachefile); } /* Masks. */ - LINKLIST_FOREACH (Mask *, mask, &bmain->mask) { + LINKLIST_FOREACH (Mask *, mask, &bmain_->mask) { build_mask(mask); } /* Movie clips. */ - LINKLIST_FOREACH (MovieClip *, clip, &bmain->movieclip) { + LINKLIST_FOREACH (MovieClip *, clip, &bmain_->movieclip) { build_movieclip(clip); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index bd6be70a831..072783a4320 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -193,8 +193,10 @@ RNAPathKey::RNAPathKey(ID *id, const char *path) : } } -DepsgraphRelationBuilder::DepsgraphRelationBuilder(Depsgraph *graph) : - graph_(graph) +DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, + Depsgraph *graph) + : bmain_(bmain), + graph_(graph) { } @@ -371,16 +373,16 @@ Depsgraph *DepsgraphRelationBuilder::getGraph() /* **** Functions to build relations between entities **** */ -void DepsgraphRelationBuilder::begin_build(Main *bmain) +void DepsgraphRelationBuilder::begin_build() { /* LIB_TAG_DOIT is used to indicate whether node for given ID was already * created or not. */ - BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + BKE_main_id_tag_all(bmain_, LIB_TAG_DOIT, false); /* XXX nested node trees are notr included in tag-clearing above, * so we need to do this manually. */ - FOREACH_NODETREE(bmain, nodetree, id) + FOREACH_NODETREE(bmain_, nodetree, id) { if (id != (ID *)nodetree) { nodetree->id.tag &= ~LIB_TAG_DOIT; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index da0d4b9f96b..4b1c6fd5562 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -165,9 +165,9 @@ struct RNAPathKey struct DepsgraphRelationBuilder { - DepsgraphRelationBuilder(Depsgraph *graph); + DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph); - void begin_build(Main *bmain); + void begin_build(); template <typename KeyFrom, typename KeyTo> void add_relation(const KeyFrom& key_from, @@ -184,7 +184,7 @@ struct DepsgraphRelationBuilder const DepsNodeHandle *handle, const char *description); - void build_scene(Main *bmain, Scene *scene); + void build_scene(Scene *scene); void build_group(Main *bmain, Scene *scene, Object *object, Group *group); void build_object(Main *bmain, Scene *scene, Object *ob); void build_object_parent(Object *ob); @@ -252,6 +252,7 @@ protected: bool needs_animdata_node(ID *id); private: + Main *bmain_; Depsgraph *graph_; }; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 318534d0b43..d5a8ead10dc 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -67,16 +67,16 @@ extern "C" { namespace DEG { -void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) +void DepsgraphRelationBuilder::build_scene(Scene *scene) { if (scene->set) { - build_scene(bmain, scene->set); + build_scene(scene->set); } /* scene objects */ LINKLIST_FOREACH (Base *, base, &scene->base) { Object *ob = base->object; - build_object(bmain, scene, ob); + build_object(bmain_, scene, ob); } /* rigidbody */ @@ -105,12 +105,12 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) } /* Masks. */ - LINKLIST_FOREACH (Mask *, mask, &bmain->mask) { + LINKLIST_FOREACH (Mask *, mask, &bmain_->mask) { build_mask(mask); } /* Movie clips. */ - LINKLIST_FOREACH (MovieClip *, clip, &bmain->movieclip) { + LINKLIST_FOREACH (MovieClip *, clip, &bmain_->movieclip) { build_movieclip(clip); } diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 47bf5e7ecbb..fb762505ed2 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -207,15 +207,15 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) /* 1) Generate all the nodes in the graph first */ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph); - node_builder.begin_build(bmain); - node_builder.build_scene(bmain, scene); + node_builder.begin_build(); + node_builder.build_scene(scene); /* 2) Hook up relationships between operations - to determine evaluation * order. */ - DEG::DepsgraphRelationBuilder relation_builder(deg_graph); - relation_builder.begin_build(bmain); - relation_builder.build_scene(bmain, scene); + DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph); + relation_builder.begin_build(); + relation_builder.build_scene(scene); /* Detect and solve cycles. */ DEG::deg_graph_detect_cycles(deg_graph); |