[Bf-blender-cvs] [85fda8f] depsgraph_refactor: Depsgraph: Code cleanup, whitespace and wrapping
Sergey Sharybin
noreply at git.blender.org
Mon Jan 5 17:34:20 CET 2015
Commit: 85fda8ff117e2b1c6cd86c0c138a6f2f0bb41af8
Author: Sergey Sharybin
Date: Mon Jan 5 19:57:07 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB85fda8ff117e2b1c6cd86c0c138a6f2f0bb41af8
Depsgraph: Code cleanup, whitespace and wrapping
===================================================================
M source/blender/depsgraph/intern/depsgraph_debug.cpp
M source/blender/depsgraph/intern/depsgraph_debug.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index f17b540..807d00e 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -26,34 +26,23 @@
* Implementation of tools for debugging the depsgraph
*/
-#include <stdlib.h>
+//#include <stdlib.h>
#include <string.h>
extern "C" {
-#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_ghash.h"
-#include "BLI_utildefines.h"
-#include "DNA_action_types.h"
-#include "DNA_ID.h"
-#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_sequence_types.h"
#include "DNA_userdef_types.h"
-#include "BKE_idcode.h"
-
-#include "DEG_depsgraph.h"
#include "DEG_depsgraph_debug.h"
#include "DEG_depsgraph_build.h"
-#include "RNA_access.h"
-#include "RNA_types.h"
-
#include "WM_api.h"
#include "WM_types.h"
-} /* extern "C" */
+} /* extern "C" */
#include "depsgraph_debug.h"
#include "depsnode.h"
@@ -71,17 +60,20 @@ static const char *deg_debug_graphviz_fontname = "helvetica";
static float deg_debug_graphviz_graph_label_size = 20.0f;
static float deg_debug_graphviz_node_label_size = 14.0f;
static const int deg_debug_max_colors = 12;
-static const char *deg_debug_colors_dark[] = {"#6e8997","#144f77","#76945b","#216a1d",
- "#a76665","#971112","#a87f49","#a9540",
- "#86768e","#462866","#a9a965","#753b1a"};
-static const char *deg_debug_colors[] = {"#a6cee3","#1f78b4","#b2df8a","#33a02c",
- "#fb9a99","#e31a1c","#fdbf6f","#ff7f00",
- "#cab2d6","#6a3d9a","#ffff99","#b15928"};
-static const char *deg_debug_colors_light[] = {"#8dd3c7","#ffffb3","#bebada","#fb8072",
- "#80b1d3","#fdb462","#b3de69","#fccde5",
- "#d9d9d9","#bc80bd","#ccebc5","#ffed6f"};
-
-/* only one should be enabled, defines whether graphviz nodes
+static const char *deg_debug_colors_dark[] = {"#6e8997", "#144f77", "#76945b",
+ "#216a1d", "#a76665", "#971112",
+ "#a87f49", "#0a9540", "#86768e",
+ "#462866", "#a9a965", "#753b1a"};
+static const char *deg_debug_colors[] = {"#a6cee3", "#1f78b4", "#b2df8a",
+ "#33a02c", "#fb9a99", "#e31a1c",
+ "#fdbf6f", "#ff7f00", "#cab2d6",
+ "#6a3d9a", "#ffff99", "#b15928"};
+static const char *deg_debug_colors_light[] = {"#8dd3c7", "#ffffb3", "#bebada",
+ "#fb8072", "#80b1d3", "#fdb462",
+ "#b3de69", "#fccde5", "#d9d9d9",
+ "#bc80bd", "#ccebc5","#ffed6f"};
+
+/* Only one should be enabled, defines whether graphviz nodes
* get colored by individual types or classes.
*/
#define COLOR_SCHEME_NODE_CLASS 1
@@ -93,7 +85,7 @@ static const int deg_debug_node_type_color_map[][2] = {
{DEPSNODE_TYPE_TIMESOURCE, 1},
{DEPSNODE_TYPE_ID_REF, 2},
{DEPSNODE_TYPE_SUBGRAPH, 3},
-
+
/* Outer Types */
{DEPSNODE_TYPE_PARAMETERS, 4},
{DEPSNODE_TYPE_PROXY, 5},
@@ -126,7 +118,7 @@ static const int deg_debug_relation_type_color_map[][2] = {
static int deg_debug_node_color_index(const DepsNode *node)
{
#ifdef COLOR_SCHEME_NODE_CLASS
- /* some special types */
+ /* Some special types. */
switch (node->type) {
case DEPSNODE_TYPE_ID_REF:
return 5;
@@ -136,11 +128,11 @@ static int deg_debug_node_color_index(const DepsNode *node)
if (op_node->is_noop())
return 8;
}
-
+
default:
break;
}
- /* do others based on class */
+ /* Do others based on class. */
switch (node->tclass) {
case DEPSNODE_CLASS_OPERATION:
return 4;
@@ -150,12 +142,14 @@ static int deg_debug_node_color_index(const DepsNode *node)
return 9;
}
#endif
-
+
#ifdef COLOR_SCHEME_NODE_TYPE
const int (*pair)[2];
- for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair)
- if ((*pair)[0] == node->type)
+ for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair) {
+ if ((*pair)[0] == node->type) {
return (*pair)[1];
+ }
+ }
return -1;
#endif
}
@@ -170,13 +164,13 @@ static void deg_debug_printf(const DebugContext &ctx, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
-
vfprintf(ctx.file, fmt, args);
-
va_end(args);
}
-static void deg_debug_graphviz_legend_color(const DebugContext &ctx, const char *name, const char *color)
+static void deg_debug_graphviz_legend_color(const DebugContext &ctx,
+ const char *name,
+ const char *color)
{
deg_debug_printf(ctx, "<TR>");
deg_debug_printf(ctx, "<TD>%s</TD>", name);
@@ -185,13 +179,19 @@ static void deg_debug_graphviz_legend_color(const DebugContext &ctx, const char
}
#if 0
-static void deg_debug_graphviz_legend_line(const DebugContext &ctx, const char *name, const char *color, const char *style)
+static void deg_debug_graphviz_legend_line(const DebugContext &ctx,
+ const char *name,
+ const char *color,
+ const char *style)
{
/* XXX TODO */
deg_debug_printf(ctx, "" NL);
}
-static void deg_debug_graphviz_legend_cluster(const DebugContext &ctx, const char *name, const char *color, const char *style)
+static void deg_debug_graphviz_legend_cluster(const DebugContext &ctx,
+ const char *name,
+ const char *color,
+ const char *style)
{
deg_debug_printf(ctx, "<TR>");
deg_debug_printf(ctx, "<TD>%s</TD>", name);
@@ -209,7 +209,7 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
deg_debug_printf(ctx, "Legend [shape=none, margin=0, label=<" NL);
deg_debug_printf(ctx, " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">" NL);
deg_debug_printf(ctx, "<TR><TD COLSPAN=\"2\"><B>Legend</B></TD></TR>" NL);
-
+
#ifdef COLOR_SCHEME_NODE_CLASS
const char **colors = deg_debug_colors_light;
deg_debug_graphviz_legend_color(ctx, "Operation", colors[4]);
@@ -217,15 +217,17 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
deg_debug_graphviz_legend_color(ctx, "ID Node", colors[5]);
deg_debug_graphviz_legend_color(ctx, "NOOP", colors[8]);
#endif
-
+
#ifdef COLOR_SCHEME_NODE_TYPE
const int (*pair)[2];
for (pair = deg_debug_node_type_color_map; (*pair)[0] >= 0; ++pair) {
DepsNodeFactory *nti = DEG_get_node_factory((eDepsNode_Type)(*pair)[0]);
- deg_debug_graphviz_legend_color(ctx, nti->tname().c_str(), deg_debug_colors_light[(*pair)[1] % deg_debug_max_colors]);
+ deg_debug_graphviz_legend_color(ctx,
+ nti->tname().c_str(),
+ deg_debug_colors_light[(*pair)[1] % deg_debug_max_colors]);
}
#endif
-
+
deg_debug_printf(ctx, "</TABLE>" NL);
deg_debug_printf(ctx, ">" NL);
deg_debug_printf(ctx, ",fontname=\"%s\"", deg_debug_graphviz_fontname);
@@ -237,79 +239,82 @@ static void deg_debug_graphviz_legend(const DebugContext &ctx)
static int deg_debug_relation_type_color_index(eDepsRelation_Type type)
{
const int (*pair)[2];
- for (pair = deg_debug_relation_type_color_map; (*pair)[0] >= 0; ++pair)
- if ((*pair)[0] == type)
+ for (pair = deg_debug_relation_type_color_map; (*pair)[0] >= 0; ++pair) {
+ if ((*pair)[0] == type) {
return (*pair)[1];
+ }
+ }
return -1;
}
#endif
-static void deg_debug_graphviz_node_color(const DebugContext &ctx, const DepsNode *node)
+static void deg_debug_graphviz_node_color(const DebugContext &ctx,
+ const DepsNode *node)
{
const char *color_default = "black";
const char *color_modified = "orangered4";
const char *color_update = "dodgerblue3";
-
const char *color = color_default;
if (ctx.show_tags) {
if (node->tclass == DEPSNODE_CLASS_OPERATION) {
OperationDepsNode *op_node = (OperationDepsNode *)node;
- if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED)
+ if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
color = color_modified;
- else if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE)
+ }
+ else if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
color = color_update;
+ }
}
}
-
deg_debug_printf(ctx, "\"%s\"", color);
}
-static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx, const DepsNode *node)
+static void deg_debug_graphviz_node_penwidth(const DebugContext &ctx,
+ const DepsNode *node)
{
float penwidth_default = 1.0f;
float penwidth_modified = 4.0f;
float penwidth_update = 4.0f;
-
float penwidth = penwidth_default;
if (ctx.show_tags) {
if (node->tclass == DEPSNODE_CLASS_OPERATION) {
OperationDepsNode *op_node = (OperationDepsNode *)node;
- if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED)
+ if (op_node->flag & DEPSOP_FLAG_DIRECTLY_MODIFIED) {
penwidth = penwidth_modified;
- else if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE)
+ }
+ else if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
penwidth = penwidth_update;
+ }
}
}
-
deg_debug_printf(ctx, "\"%f\"", penwidth);
}
-static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx, const DepsNode *node)
+static void deg_debug_graphviz_node_fillcolor(const DebugContext &ctx,
+ const DepsNode *node)
{
const char *defaultcolor = "gainsboro";
-
int color_index = deg_debug_node_color_index(node);
const char *fillcolor = color_index < 0 ? defaultcolor : deg_debug_colors_light[color_index % deg_debug_max_co
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list