Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-06-05 19:31:04 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-06-06 10:58:09 +0300
commit2819b609339b907421dc25c00223950ccee381ab (patch)
treef2987e81d16d7772cdb1da404d7183fb69b4e810 /source/blender
parent0afa9d6ae650e10397b8e94e84ddd0fa764b7565 (diff)
Fix T63035: Undoing in pose mode destroys the entire pose
Respect do_time flag in on_visible_update, matching behavior of old dependency graph and avoids unwanted animation updates. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D5026
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc37
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c8
-rw-r--r--source/blender/windowmanager/intern/wm_files.c3
-rw-r--r--source/blender/windowmanager/wm_event_system.h2
6 files changed, 29 insertions, 25 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index c6a7cf9dcb7..bdcb4061096 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -106,7 +106,7 @@ void DEG_free_node_types(void);
/* Update Tagging -------------------------------- */
/* Update dependency graph when visible scenes/layers changes. */
-void DEG_graph_on_visible_update(struct Main *bmain, Depsgraph *depsgraph);
+void DEG_graph_on_visible_update(struct Main *bmain, Depsgraph *depsgraph, const bool do_time);
/* 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_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index bfb0a2aade4..d20bb000724 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -237,7 +237,7 @@ static void graph_build_finalize_common(DEG::Depsgraph *deg_graph, Main *bmain)
deg_graph->scene_cow = (Scene *)deg_graph->get_cow_id(&deg_graph->scene->id);
/* Flush visibility layer and re-schedule nodes for update. */
DEG::deg_graph_build_finalize(bmain, deg_graph);
- DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(deg_graph));
+ DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(deg_graph), false);
#if 0
if (!DEG_debug_consistency_check(deg_graph)) {
printf("Consistency validation failed, ABORTING!\n");
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 9f48dd2b47e..c5743e77d9a 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -460,30 +460,31 @@ void deg_graph_node_tag_zero(Main *bmain,
deg_graph_id_tag_legacy_compat(bmain, graph, id, (IDRecalcFlag)0, update_source);
}
-void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
+void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_time)
{
+ /* NOTE: It is possible to have this function called with `do_time=false` first and later (prior
+ * to evaluation though) with `do_time=true`. This means early output checks should be aware of
+ * this. */
for (DEG::IDNode *id_node : graph->id_nodes) {
if (!id_node->visible_components_mask) {
/* ID has no components which affects anything visible.
* No need bother with it to tag or anything. */
continue;
}
- if (id_node->visible_components_mask == id_node->previously_visible_components_mask) {
- /* The ID was already visible and evaluated, all the subsequent
- * updates and tags are to be done explicitly. */
- continue;
- }
int flag = 0;
if (!DEG::deg_copy_on_write_is_expanded(id_node->id_cow)) {
flag |= ID_RECALC_COPY_ON_WRITE;
- /* TODO(sergey): Shouldn't be needed, but currently we are lackign
- * some flushing of evaluated data to the original one, which makes,
- * for example, files saved with the rest pose.
- * Need to solve those issues carefully, for until then we evaluate
- * animation for datablocks which appears in the graph for the first
- * time. */
- if (BKE_animdata_from_id(id_node->id_orig) != NULL) {
- flag |= ID_RECALC_ANIMATION;
+ if (do_time) {
+ if (BKE_animdata_from_id(id_node->id_orig) != NULL) {
+ flag |= ID_RECALC_ANIMATION;
+ }
+ }
+ }
+ else {
+ if (id_node->visible_components_mask == id_node->previously_visible_components_mask) {
+ /* The ID was already visible and evaluated, all the subsequent
+ * updates and tags are to be done explicitly. */
+ continue;
}
}
/* We only tag components which needs an update. Tagging everything is
@@ -726,19 +727,19 @@ void DEG_graph_flush_update(Main *bmain, Depsgraph *depsgraph)
}
/* Update dependency graph when visible scenes/layers changes. */
-void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph)
+void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph, const bool do_time)
{
DEG::Depsgraph *graph = (DEG::Depsgraph *)depsgraph;
- DEG::deg_graph_on_visible_update(bmain, graph);
+ DEG::deg_graph_on_visible_update(bmain, graph, do_time);
}
-void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
+void DEG_on_visible_update(Main *bmain, const bool do_time)
{
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
Depsgraph *depsgraph = (Depsgraph *)BKE_scene_get_depsgraph(scene, view_layer, false);
if (depsgraph != NULL) {
- DEG_graph_on_visible_update(bmain, depsgraph);
+ DEG_graph_on_visible_update(bmain, depsgraph, do_time);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 952382c2e36..e38d8723e06 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -313,7 +313,7 @@ static void wm_notifier_clear(wmNotifier *note)
memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link));
}
-void wm_event_do_depsgraph(bContext *C)
+void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
{
wmWindowManager *wm = CTX_wm_manager(C);
/* The whole idea of locked interface is to prevent viewport and whatever
@@ -347,6 +347,10 @@ void wm_event_do_depsgraph(bContext *C)
* across visible view layers and has overrides on it.
*/
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ if (is_after_open_file) {
+ DEG_graph_relations_update(depsgraph, bmain, scene, view_layer);
+ DEG_graph_on_visible_update(bmain, depsgraph, true);
+ }
DEG_make_active(depsgraph);
BKE_scene_graph_update_tagged(depsgraph, bmain);
}
@@ -374,7 +378,7 @@ void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
}
}
- wm_event_do_depsgraph(C);
+ wm_event_do_depsgraph(C, false);
CTX_wm_window_set(C, NULL);
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 26130e8c3bd..f3aa5a1b6ca 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -557,8 +557,7 @@ static void wm_file_read_post(bContext *C,
/* After load post, so for example the driver namespace can be filled
* before evaluating the depsgraph. */
- DEG_on_visible_update(bmain, true);
- wm_event_do_depsgraph(C);
+ wm_event_do_depsgraph(C, true);
ED_editors_init(C);
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 55285b884da..53b25a80dce 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -140,7 +140,7 @@ void wm_event_do_handlers(bContext *C);
void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void *customdata);
-void wm_event_do_depsgraph(bContext *C);
+void wm_event_do_depsgraph(bContext *C, bool is_after_open_file);
void wm_event_do_refresh_wm_and_depsgraph(bContext *C);
void wm_event_do_notifiers(bContext *C);