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.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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...
|
||||
}
|
||||
|
||||
@@ -209,6 +209,7 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
|
||||
* - this way it should be the first in the graph,
|
||||
* reflecting its role as the entrypoint
|
||||
*/
|
||||
node_builder.begin_build(bmain);
|
||||
node_builder.add_root_node();
|
||||
node_builder.build_scene(bmain, scene);
|
||||
|
||||
@@ -221,6 +222,7 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene)
|
||||
* it doesnt add any operations anyway and is not clear what part of the
|
||||
* scene is to be connected.
|
||||
*/
|
||||
relation_builder.begin_build(bmain);
|
||||
#if 0
|
||||
relation_builder.add_relation(RootKey(),
|
||||
IDKey(scene),
|
||||
|
||||
Reference in New Issue
Block a user