[Bf-blender-cvs] [4140b9d] depsgraph_refactor: Depsgraph: Resolve missing object update after loading the file
Sergey Sharybin
noreply at git.blender.org
Thu Jan 8 16:11:38 CET 2015
Commit: 4140b9d0ca9c34c31dc1916ff3e6774ae7495d61
Author: Sergey Sharybin
Date: Thu Jan 8 20:04:16 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB4140b9d0ca9c34c31dc1916ff3e6774ae7495d61
Depsgraph: Resolve missing object update after loading the file
This is a bit of experiment and will need to re-think it again tomorrow
because currently running out of energy after hunting the previous fix.
It seems to work now so Joshua could continue being happy coder :)
===================================================================
M source/blender/depsgraph/DEG_depsgraph.h
M source/blender/depsgraph/intern/depsgraph_tag.cpp
M source/blender/makesrna/intern/rna_depsgraph.c
===================================================================
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 3316aab..e89312f 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -96,7 +96,7 @@ void DEG_free_node_types(void);
void DEG_scene_update_flags(Depsgraph *graph, const bool do_time);
/* Update dependency graph when visible scenes/layers changes. */
-void DEG_graph_on_visible_update(struct Main *bmain, Depsgraph *graph);
+void DEG_graph_on_visible_update(struct Main *bmain, struct Scene *scene);
/* Update all dependency graphs when visible scenes/layers changes. */
void DEG_on_visible_update(struct Main *bmain, const bool do_time);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index e2c1b4d..a42e43d 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -268,8 +268,9 @@ void DEG_graph_clear_tags(Depsgraph *graph)
}
/* Update dependency graph when visible scenes/layers changes. */
-void DEG_graph_on_visible_update(Main *bmain, Depsgraph *graph)
+void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
{
+ Depsgraph *graph = scene->depsgraph;
wmWindowManager *wm = (wmWindowManager *)bmain->wm.first;
int old_layers = graph->layers;
if (wm != NULL) {
@@ -307,7 +308,24 @@ void DEG_graph_on_visible_update(Main *bmain, Depsgraph *graph)
graph->add_entry_tag(node);
}
graph->invisible_entry_tags.clear();
+ /* Tag all objects which becomes visible (or which becomes needed for dependencies)
+ * for recalc.
+ *
+ * This is mainly needed on file load only, after that updates of invisible objects
+ * will be stored in the pending list.
+ */
+ for (Depsgraph::OperationNodes::const_iterator it = graph->operations.begin();
+ it != graph->operations.end();
+ ++it)
+ {
+ OperationDepsNode *node = *it;
+ IDDepsNode *id_node = node->owner->owner;
+ if ((id_node->layers & scene->lay_updated) == 0) {
+ id_node->tag_update(graph);
+ }
+ }
}
+ scene->lay_updated |= graph->layers;
}
void DEG_on_visible_update(Main *bmain, const bool do_time)
@@ -317,7 +335,7 @@ void DEG_on_visible_update(Main *bmain, const bool do_time)
scene = (Scene*)scene->id.next)
{
if (scene->depsgraph != NULL) {
- DEG_graph_on_visible_update(bmain, scene->depsgraph);
+ DEG_graph_on_visible_update(bmain, scene);
}
}
}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 685d5bf..8ac1e2a 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -61,7 +61,7 @@ static void rna_Depsgraph_debug_rebuild(Depsgraph *UNUSED(graph), Main *bmain)
DAG_relations_tag_update(bmain);
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
DAG_scene_relations_rebuild(bmain, sce);
- DEG_graph_on_visible_update(bmain, sce->depsgraph);
+ DEG_graph_on_visible_update(bmain, sce);
}
}
More information about the Bf-blender-cvs
mailing list