[Bf-blender-cvs] [141bb6a] depsgraph_refactor: Depsgraph WIP: Ensure edges get added between nodes to show ownership hierarchies

Joshua Leung noreply at git.blender.org
Thu Jan 29 14:44:53 CET 2015


Commit: 141bb6a29dd55e1aaf90f1fbe4ef6bca918e1ac1
Author: Joshua Leung
Date:   Fri Jan 30 02:44:43 2015 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rB141bb6a29dd55e1aaf90f1fbe4ef6bca918e1ac1

Depsgraph WIP: Ensure edges get added between nodes to show ownership hierarchies

We can't really test that this looks right yet, since we don't have a layout
algorithm working, but when this works, it will be necessary for identifying
what an opnode is for.

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

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

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

diff --git a/source/blender/depsgraph/intern/depsgraph_debug_ogdf.cpp b/source/blender/depsgraph/intern/depsgraph_debug_ogdf.cpp
index 23583c6..d517cb7 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug_ogdf.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug_ogdf.cpp
@@ -177,12 +177,29 @@ static const char *deg_debug_ogdf_node_color(const DebugContext &ctx, const Deps
 	return fillcolor;
 }
 
+/* ----------------------------------- */
+
+static void deg_debug_ogdf_owner_relations(const DebugContext &ctx,
+                                               const DepsNode *parent,
+                                               const DepsNode *child)
+{
+	/* Node ownership hierarchy */
+	ogdf::node head_node = ctx.node_map[parent];
+	ogdf::node tail_node = ctx.node_map[child];
+	
+	ogdf::edge e = ctx.G->newEdge(head_node, tail_node);
+
+	//ctx.GA->arrowEdge(e) = ogdf::GraphAttributes::EdgeArrow::last;
+	ctx.GA->colorEdge(e) = ogdf::String("#CCCCCC");
+}
+
+/* ----------------------------------- */
+
 static void deg_debug_ogdf_node_single(const DebugContext &ctx, const DepsNode *node)
 {
 	string name = node->identifier();
 	//float priority = -1.0f;
 
-#if 0 // XXX: crashes for now
 	if (node->type == DEPSNODE_TYPE_ID_REF) {
 		IDDepsNode *id_node = (IDDepsNode *)node;
 
@@ -191,7 +208,6 @@ static void deg_debug_ogdf_node_single(const DebugContext &ctx, const DepsNode *
 
 		name += buf;
 	}
-#endif
 	//if (ctx.show_eval_priority && node->tclass == DEPSNODE_CLASS_OPERATION) {
 	//	priority = ((OperationDepsNode *)node)->eval_priority;
 	//}
@@ -217,12 +233,16 @@ static void deg_debug_ogdf_node(const DebugContext &ctx, const DepsNode *node)
 				deg_debug_ogdf_node_single(ctx, node);
 			}
 			else {
+				deg_debug_ogdf_node_single(ctx, node);
+				
 				for (IDDepsNode::ComponentMap::const_iterator it = id_node->components.begin();
 					it != id_node->components.end();
 					++it)
 				{
 					const ComponentDepsNode *comp = it->second;
 					deg_debug_ogdf_node(ctx, comp);
+					
+					deg_debug_ogdf_owner_relations(ctx, node, comp);
 				}
 			}
 			break;
@@ -252,12 +272,16 @@ static void deg_debug_ogdf_node(const DebugContext &ctx, const DepsNode *node)
 		{
 			ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
 			if (!comp_node->operations.empty()) {
+				deg_debug_ogdf_node_single(ctx, node);
+				
 				for (ComponentDepsNode::OperationMap::const_iterator it = comp_node->operations.begin();
 					it != comp_node->operations.end();
 					++it)
 				{
 					const DepsNode *op_node = it->second;
 					deg_debug_ogdf_node(ctx, op_node);
+					
+					deg_debug_ogdf_owner_relations(ctx, node, op_node);
 				}
 			}
 			else {
@@ -441,6 +465,7 @@ void DEG_debug_ogdf(const Depsgraph *graph, const char *filename)
 							 ogdf::GraphAttributes::nodeLabel |
 							 ogdf::GraphAttributes::nodeColor |
 							 ogdf::GraphAttributes::edgeLabel |
+							 ogdf::GraphAttributes::edgeColor |
 		                     ogdf::GraphAttributes::edgeArrow);
 
 	/* build OGDF graph from depsgraph */




More information about the Bf-blender-cvs mailing list