diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-01-25 14:28:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-01-25 14:28:27 +0300 |
commit | e4de6e87e1bb91c072ac2bb800214de006942801 (patch) | |
tree | 9e0ed7b84b28d416b46f3f8c3e975e0314ff1580 /source/blender/depsgraph/intern/builder | |
parent | 8ea09252c8261c7057a130763c7f44bd45c9f9d2 (diff) |
Depsgraph: Do ID tag outside of build_scene
Otherwise it was possible to get ID tags cleared in the middle
of DEG construction when there are set scenes used.
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
6 files changed, 37 insertions, 26 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index e312c4e0dcb..3a9ae490c0a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -320,6 +320,23 @@ OperationDepsNode *DepsgraphNodeBuilder::find_operation_node( /* **** Build functions for entity nodes **** */ +void DepsgraphNodeBuilder::begin_build(Main *bmain) { + /* 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); + /* XXX nested node trees are not included in tag-clearing above, + * so we need to do this manually. + */ + FOREACH_NODETREE(bmain, nodetree, id) { + if (id != (ID *)nodetree) { + nodetree->id.tag &= ~LIB_TAG_DOIT; + } + } FOREACH_NODETREE_END +} + void DepsgraphNodeBuilder::build_group(Scene *scene, Base *base, Group *group) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 9cb8bc5d45c..803110c9c80 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -72,6 +72,8 @@ struct DepsgraphNodeBuilder { DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph); ~DepsgraphNodeBuilder(); + void begin_build(Main *bmain); + RootDepsNode *add_root_node(); IDDepsNode *add_id_node(ID *id); TimeSourceDepsNode *add_time_source(ID *id); 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 bcd4bc51448..99e61692231 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -65,20 +65,6 @@ namespace DEG { void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) { - /* 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); - /* XXX nested node trees are not included in tag-clearing above, - * so we need to do this manually. - */ - FOREACH_NODETREE(bmain, nodetree, id) { - if (id != (ID *)nodetree) - nodetree->id.tag &= ~LIB_TAG_DOIT; - } FOREACH_NODETREE_END - /* scene ID block */ add_id_node(&scene->id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index b5272d3acf2..644f74e006a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -339,6 +339,22 @@ void DepsgraphRelationBuilder::add_forcefield_relations(const OperationKey &key, /* **** Functions to build relations between entities **** */ +void DepsgraphRelationBuilder::begin_build(Main *bmain) +{ + /* 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); + /* XXX nested node trees are notr included in tag-clearing above, + * so we need to do this manually. + */ + FOREACH_NODETREE(bmain, nodetree, id) { + if (id != (ID *)nodetree) { + nodetree->id.tag &= ~LIB_TAG_DOIT; + } + } FOREACH_NODETREE_END +} + void DepsgraphRelationBuilder::build_group(Main *bmain, Scene *scene, Object *object, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 6e8485bee30..7595a4488b9 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -171,6 +171,8 @@ struct DepsgraphRelationBuilder { DepsgraphRelationBuilder(Depsgraph *graph); + void begin_build(Main *bmain); + template <typename KeyFrom, typename KeyTo> void add_relation(const KeyFrom& key_from, const KeyTo& key_to, 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 6b51a957da0..57429417357 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -69,18 +69,6 @@ namespace DEG { void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) { - /* 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); - /* XXX nested node trees are not included in tag-clearing above, - * so we need to do this manually. - */ - FOREACH_NODETREE(bmain, nodetree, id) { - if (id != (ID *)nodetree) - nodetree->id.tag &= ~LIB_TAG_DOIT; - } FOREACH_NODETREE_END - if (scene->set) { // TODO: link set to scene, especially our timesource... } |