Compositor: Graphviz improvements
Graphs are usually large, needing a lot of horizontal scrolling and they can include more information for debugging. This patch makes graph more compact horizontally by splitting labels in lines and removing namespaces. Furthermore it adds following information: - Operation ID. - SetValueOperation float value. - Optionally, operation node name. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D11720
This commit is contained in:
parent
5780de2ae0
commit
e2c4a4c510
|
@ -37,6 +37,7 @@ extern "C" {
|
|||
#include "COM_Node.h"
|
||||
|
||||
#include "COM_ReadBufferOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ViewerOperation.h"
|
||||
#include "COM_WriteBufferOperation.h"
|
||||
|
||||
|
@ -49,6 +50,15 @@ std::string DebugInfo::m_current_node_name;
|
|||
std::string DebugInfo::m_current_op_name;
|
||||
DebugInfo::GroupStateMap DebugInfo::m_group_states;
|
||||
|
||||
static std::string operation_class_name(NodeOperation *op)
|
||||
{
|
||||
std::string full_name = typeid(*op).name();
|
||||
/* Remove namespaces. */
|
||||
size_t pos = full_name.find_last_of(':');
|
||||
BLI_assert(pos != std::string::npos);
|
||||
return full_name.substr(pos + 1);
|
||||
}
|
||||
|
||||
std::string DebugInfo::node_name(const Node *node)
|
||||
{
|
||||
NodeNameMap::const_iterator it = m_node_names.find(node);
|
||||
|
@ -135,15 +145,23 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
|||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|");
|
||||
}
|
||||
|
||||
len += snprintf(str + len,
|
||||
maxlen > len ? maxlen - len : 0,
|
||||
"%s\\n(%s)",
|
||||
m_op_names[operation].c_str(),
|
||||
typeid(*operation).name());
|
||||
if (COM_GRAPHVIZ_SHOW_NODE_NAME) {
|
||||
std::string op_node_name = operation->get_name();
|
||||
if (!op_node_name.empty()) {
|
||||
len += snprintf(
|
||||
str + len, maxlen > len ? maxlen - len : 0, "%s\\n", (op_node_name + " Node").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
len += snprintf(str + len,
|
||||
maxlen > len ? maxlen - len : 0,
|
||||
" (%u,%u)",
|
||||
"%s\\n",
|
||||
operation_class_name(operation).c_str());
|
||||
|
||||
len += snprintf(str + len,
|
||||
maxlen > len ? maxlen - len : 0,
|
||||
"#%d (%u,%u)",
|
||||
operation->get_id(),
|
||||
operation->getWidth(),
|
||||
operation->getHeight());
|
||||
|
||||
|
@ -159,7 +177,13 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system,
|
|||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<OUT_%p>", socket);
|
||||
switch (socket->getDataType()) {
|
||||
case DataType::Value:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value");
|
||||
if (typeid(*operation) == typeid(SetValueOperation)) {
|
||||
const float value = ((SetValueOperation *)operation)->getValue();
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value\\n%12.4g", value);
|
||||
}
|
||||
else {
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value");
|
||||
}
|
||||
break;
|
||||
case DataType::Vector:
|
||||
len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Vector");
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
namespace blender::compositor {
|
||||
|
||||
static constexpr bool COM_EXPORT_GRAPHVIZ = false;
|
||||
static constexpr bool COM_GRAPHVIZ_SHOW_NODE_NAME = false;
|
||||
|
||||
class Node;
|
||||
class ExecutionSystem;
|
||||
class ExecutionGroup;
|
||||
|
|
Loading…
Reference in New Issue