[Bf-blender-cvs] [6f87bb1] depsgraph_refactor: Depsgraph: Fix update not happening correct in certain circumstances

Sergey Sharybin noreply at git.blender.org
Wed Feb 25 20:42:28 CET 2015


Commit: 6f87bb1e598eb92eef2c4a4f9763167bd036e878
Author: Sergey Sharybin
Date:   Thu Feb 26 00:39:26 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB6f87bb1e598eb92eef2c4a4f9763167bd036e878

Depsgraph: Fix update not happening correct in certain circumstances

Because of the lack of real incremental updates it was possible that incorrect
object matrix was used by the constraint stack.

Now flush update will tag all operations within component for update, solving
the issue with lack of incremental updates.

It's not totally optimal implementation atm, but good enough for further tests
and improvements.

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

M	source/blender/depsgraph/intern/depsgraph_tag.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index 25060bc..7c64be6 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -235,6 +235,22 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 	if (graph == NULL)
 		return;
 
+	/* Nothing to update, early out. */
+	if (graph->entry_tags.size() == 0) {
+		return;
+	}
+
+	/* TODO(sergey): With a bit of flag magic we can get rid of this
+	 * extra loop.
+	 */
+	for (Depsgraph::OperationNodes::const_iterator it = graph->operations.begin();
+	     it != graph->operations.end();
+	     ++it)
+	{
+		OperationDepsNode *node = *it;
+		node->scheduled = false;
+	}
+
 	FlushQueue queue;
 	/* Starting from the tagged "entry" nodes, flush outwards... */
 	// NOTE: Also need to ensure that for each of these, there is a path back to
@@ -249,6 +265,7 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 		IDDepsNode *id_node = node->owner->owner;
 		queue.push(node);
 		deg_editors_id_update(bmain, id_node->id);
+		node->scheduled = true;
 	}
 
 	while (!queue.empty()) {
@@ -268,7 +285,7 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 			DepsRelation *rel = *it;
 			OperationDepsNode *to_node = (OperationDepsNode *)rel->to;
 			IDDepsNode *id_node = to_node->owner->owner;
-			if ((to_node->flag & DEPSOP_FLAG_NEEDS_UPDATE) == 0) {
+			if (to_node->scheduled == false) {
 				ID *id = id_node->id;
 				/* This code is used to preserve those areas which does direct
 				 * object update,
@@ -291,9 +308,23 @@ void DEG_graph_flush_updates(Main *bmain, Depsgraph *graph)
 				}
 				to_node->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
 				queue.push(to_node);
+				to_node->scheduled = true;
 				deg_editors_id_update(bmain, id_node->id);
 			}
 		}
+
+		/* TODO(sergey): For until incremental updates are possible
+		 * witin a component at least we tag the whole component
+		 * for update.
+		 */
+		for (ComponentDepsNode::OperationMap::iterator it = node->owner->operations.begin();
+		     it != node->owner->operations.end();
+		     ++it)
+		{
+			OperationDepsNode *op = it->second;
+			op->flag |= DEPSOP_FLAG_NEEDS_UPDATE;
+			graph->entry_tags.insert(op);
+		}
 	}
 }




More information about the Bf-blender-cvs mailing list