[Bf-blender-cvs] [843be910021] master: Depsgraph: Fix missing updates when in local view

Sergey Sharybin noreply at git.blender.org
Thu Mar 30 14:43:04 CEST 2017


Commit: 843be9100218ff36223de1500da742eb7963dd38
Author: Sergey Sharybin
Date:   Thu Mar 30 14:38:25 2017 +0200
Branches: master
https://developer.blender.org/rB843be9100218ff36223de1500da742eb7963dd38

Depsgraph: Fix missing updates when in local view

This area is a subject of reconsideration, so for now used simplest
way possible -- ensure depsgraph's nodes have proper layer flags
when going in and out of local mode.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder.cc
M	source/blender/depsgraph/intern/builder/deg_builder.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/editors/space_view3d/view3d_view.c

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc
index 3ce3ec7a27a..828da6cb056 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -77,28 +77,8 @@ static bool check_object_needs_evaluation(Object *object)
 	return false;
 }
 
-void deg_graph_build_finalize(Depsgraph *graph)
+void deg_graph_build_flush_layers(Depsgraph *graph)
 {
-	/* STEP 1: Make sure new invisible dependencies are ready for use.
-	 *
-	 * TODO(sergey): This might do a bit of extra tagging, but it's kinda nice
-	 * to do it ahead of a time and don't spend time on flushing updates on
-	 * every frame change.
-	 */
-	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
-	{
-		if (id_node->layers == 0) {
-			ID *id = id_node->id;
-			if (GS(id->name) == ID_OB) {
-				Object *object = (Object *)id;
-				if (check_object_needs_evaluation(object)) {
-					id_node->tag_update(graph);
-				}
-			}
-		}
-	}
-	GHASH_FOREACH_END();
-	/* STEP 2: Flush visibility layers from children to parent. */
 	std::stack<OperationDepsNode *> stack;
 	foreach (OperationDepsNode *node, graph->operations) {
 		IDDepsNode *id_node = node->owner->owner;
@@ -143,6 +123,31 @@ void deg_graph_build_finalize(Depsgraph *graph)
 			}
 		}
 	}
+}
+
+void deg_graph_build_finalize(Depsgraph *graph)
+{
+	/* STEP 1: Make sure new invisible dependencies are ready for use.
+	 *
+	 * TODO(sergey): This might do a bit of extra tagging, but it's kinda nice
+	 * to do it ahead of a time and don't spend time on flushing updates on
+	 * every frame change.
+	 */
+	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, graph->id_hash)
+	{
+		if (id_node->layers == 0) {
+			ID *id = id_node->id;
+			if (GS(id->name) == ID_OB) {
+				Object *object = (Object *)id;
+				if (check_object_needs_evaluation(object)) {
+					id_node->tag_update(graph);
+				}
+			}
+		}
+	}
+	GHASH_FOREACH_END();
+	/* STEP 2: Flush visibility layers from children to parent. */
+	deg_graph_build_flush_layers(graph);
 	/* STEP 3: Re-tag IDs for update if it was tagged before the relations
 	 * update tag.
 	 */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.h b/source/blender/depsgraph/intern/builder/deg_builder.h
index bdc030e3810..3cc51a2d7db 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder.h
@@ -42,5 +42,6 @@ struct Depsgraph;
 string deg_fcurve_id_name(const FCurve *fcu);
 
 void deg_graph_build_finalize(struct Depsgraph *graph);
+void deg_graph_build_flush_layers(struct Depsgraph *graph);
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index e8ed03666a6..ad73a2db826 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -56,8 +56,8 @@ extern "C" {
 #include "DEG_depsgraph.h"
 } /* extern "C" */
 
+#include "intern/builder/deg_builder.h"
 #include "intern/eval/deg_eval_flush.h"
-
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
 #include "intern/nodes/deg_node_operation.h"
@@ -346,6 +346,18 @@ void DEG_graph_on_visible_update(Main *bmain, Scene *scene)
 		GHASH_FOREACH_END();
 	}
 	scene->lay_updated |= graph->layers;
+	/* Special trick to get local view to work.  */
+	LINKLIST_FOREACH (Base *, base, &scene->base) {
+		Object *object = base->object;
+		DEG::IDDepsNode *node = graph->find_id_node(&object->id);
+		node->layers = 0;
+	}
+	LINKLIST_FOREACH (Base *, base, &scene->base) {
+		Object *object = base->object;
+		DEG::IDDepsNode *node = graph->find_id_node(&object->id);
+		node->layers |= base->lay;
+	}
+	DEG::deg_graph_build_flush_layers(graph);
 }
 
 void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 8230a0de6b9..fe8274064e5 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1405,6 +1405,8 @@ static bool view3d_localview_init(
 		}
 	}
 
+	DAG_on_visible_update(bmain, false);
+
 	return ok;
 }




More information about the Bf-blender-cvs mailing list