23int DebugInfo::file_index_ = 0;
26std::string DebugInfo::current_node_name_;
27std::string DebugInfo::current_op_name_;
31 std::string full_name =
typeid(*op).name();
35 size_t pos = full_name.find_last_of(
':');
36 if (
pos == std::string::npos) {
39 return full_name.substr(
pos + 1);
44 NodeNameMap::const_iterator it = node_names_.find(node);
45 if (it != node_names_.end()) {
53 OpNameMap::const_iterator it = op_names_.find(op);
54 if (it != op_names_.end()) {
67 std::string fillcolor =
"gainsboro";
71 fillcolor =
"lightskyblue1";
74 fillcolor =
"lightskyblue3";
78 fillcolor =
"dodgerblue1";
84 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"// OPERATION: %p\r\n", operation);
85 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"\"O_%p\"", operation);
87 maxlen >
len ? maxlen -
len : 0,
88 " [fillcolor=%s,style=filled,shape=record,label=\"{",
94 for (
int k = 0; k < totinputs; k++) {
99 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"<IN_%p>", socket);
121 std::string op_node_name = operation->
get_name();
122 if (!op_node_name.empty()) {
124 str +
len, maxlen >
len ? maxlen -
len : 0,
"%s\\n", (op_node_name +
" Node").c_str());
129 maxlen >
len ? maxlen -
len : 0,
134 maxlen >
len ? maxlen -
len : 0,
135 "#%d (%i,%i) (%u,%u)",
143 if (totoutputs != 0) {
146 for (
int k = 0; k < totoutputs; k++) {
151 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"<OUT_%p>", socket);
159 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"Value\\n%12.4g", value);
192 maxlen >
len ? maxlen -
len : 0,
193 "<TR><TD>%s</TD><TD BGCOLOR=\"%s\"></TD></TR>\r\n",
200 const char * ,
const char * ,
const char * ,
char *
str,
int maxlen)
209 const char *name,
const char *color,
const char * ,
char *
str,
int maxlen)
213 maxlen >
len ? maxlen -
len : 0,
214 "<TR><TD>%s</TD><TD CELLPADDING=\"4\"><TABLE BORDER=\"1\" CELLBORDER=\"0\" "
215 "CELLSPACING=\"0\" CELLPADDING=\"0\"><TR><TD "
216 "BGCOLOR=\"%s\"></TD></TR></TABLE></TD></TR>\r\n",
228 str +
len, maxlen >
len ? maxlen -
len : 0,
"Legend [shape=none, margin=0, label=<\r\n");
232 maxlen >
len ? maxlen -
len : 0,
233 " <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">\r\n");
235 maxlen >
len ? maxlen -
len : 0,
236 "<TR><TD COLSPAN=\"2\"><B>Legend</B></TD></TR>\r\n");
239 "NodeOperation",
"gainsboro",
str +
len, maxlen >
len ? maxlen -
len : 0);
241 "Output",
"dodgerblue1",
str +
len, maxlen >
len ? maxlen -
len : 0);
243 "Viewer",
"lightskyblue3",
str +
len, maxlen >
len ? maxlen -
len : 0);
245 "Active Viewer",
"lightskyblue1",
str +
len, maxlen >
len ? maxlen -
len : 0);
247 "Input Value",
"khaki1",
str +
len, maxlen >
len ? maxlen -
len : 0);
249 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"</TABLE>\r\n");
250 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
">];\r\n");
260 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"digraph compositorexecution {\r\n");
261 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"ranksep=1.5\r\n");
262 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"rankdir=LR\r\n");
263 len += snprintf(
str +
len, maxlen >
len ? maxlen -
len : 0,
"splines=false\r\n");
265 std::map<NodeOperation *, std::vector<std::string>> op_groups;
268 if (op_groups.find(operation) != op_groups.end()) {
272 op_groups[operation].push_back(std::string(
""));
286 switch (from->get_data_type()) {
304 std::vector<std::string> &from_groups = op_groups[from_op];
305 std::vector<std::string> &to_groups = op_groups[to_op];
308 maxlen >
len ? maxlen -
len : 0,
309 "// CONNECTION: %p.%p -> %p.%p\r\n",
314 for (
int k = 0; k < from_groups.size(); k++) {
315 for (
int l = 0;
l < to_groups.size();
l++) {
317 maxlen >
len ? maxlen -
len : 0,
318 R
"("O_%p%s":"OUT_%p":e -> "O_%p%s":"IN_%p":w)",
320 from_groups[k].c_str(),
323 to_groups[l].c_str(),
326 str + len, maxlen > len ? maxlen - len : 0, " [color=%s]", color.c_str());
337 return (
len < maxlen);
345 const int max_textlength = 1000000;
351 if (name.is_empty()) {
352 SNPRINTF(basename,
"compositor_%d.dot", file_index_);
355 STRNCPY(basename, (name +
".dot").c_str());
360 std::cout <<
"Writing compositor debug to: " << filepath <<
"\n";
376 const int width = render->get_width();
377 const int height = render->get_height();
378 const int num_channels = render->get_num_channels();
382 mem_ibuf.
copy_from(render, render->get_rect(), 0, num_channels, 0);
398 for (
int i = 0; i < file_list_num; i++) {
#define BLI_assert_unreachable()
File and directory operations.
eFileAttributes BLI_file_attributes(const char *path)
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define FILE_ATTR_ANY_LINK
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
int BLI_delete(const char *path, bool dir, bool recursive) ATTR_NONNULL()
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
bool BLI_file_ensure_parent_dir_exists(const char *filepath) ATTR_NONNULL(1)
#define BLI_path_join(...)
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
#define STRNCPY(dst, src)
#define SNPRINTF(dst, format,...)
Contains defines and structs used throughout the imbuf module.
ATTR_WARN_UNUSED_RESULT const BMLoop * l
bool is_rendering() const
get the rendering field of the context
virtual const float * get_constant_elem()=0
bool can_get_constant_elem() const
static std::string node_name(const Node *node)
static void delete_operation_exports()
static int graphviz_operation(const ExecutionSystem *system, NodeOperation *operation, char *str, int maxlen)
static std::string operation_name(const NodeOperation *op)
static int graphviz_legend_line(const char *name, const char *color, const char *style, char *str, int maxlen)
static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen)
std::map< const Node *, std::string > NodeNameMap
static void export_operation(const NodeOperation *op, MemoryBuffer *render)
std::map< const NodeOperation *, std::string > OpNameMap
static int graphviz_legend(char *str, int maxlen)
static int graphviz_legend_color(const char *name, const char *color, char *str, int maxlen)
static void graphviz(const ExecutionSystem *system, StringRefNull name="")
static int graphviz_legend_group(const char *name, const char *color, const char *style, char *str, int maxlen)
the ExecutionSystem contains the whole compositor tree.
const CompositorContext & get_context() const
get the reference to the compositor context
a MemoryBuffer contains access to the data
void copy_from(const MemoryBuffer *src, const rcti &area)
DataType get_data_type() const
NodeOperation contains calculation logic.
unsigned int get_height() const
unsigned int get_number_of_output_sockets() const
virtual bool is_output_operation(bool) const
is_output_operation determines whether this operation is an output of the ExecutionSystem during rend...
const NodeOperationFlags get_flags() const
unsigned int get_number_of_input_sockets() const
unsigned int get_width() const
NodeOperationOutput * get_output_socket(unsigned int index=0)
const rcti & get_canvas() const
NodeOperationInput * get_input_socket(unsigned int index)
const std::string get_name() const
bool is_active_viewer_output() const override
is this operation the active viewer output user can select an ViewerNode to be active (the result of ...
struct ImBuf * IMB_allocImBuf(unsigned int, unsigned int, unsigned char, unsigned int)
bool IMB_saveiff(struct ImBuf *, const char *, int)
void IMB_freeImBuf(ImBuf *)
@ Vector
Vector data type.
@ Float2
Float2 data type.
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
static constexpr bool COM_EXPORT_GRAPHVIZ
static std::string get_operations_export_dir()
static std::string operation_class_name(const NodeOperation *op)
static constexpr bool COM_GRAPHVIZ_SHOW_NODE_NAME
ImBufFloatBuffer float_buffer
bool is_constant_operation
void * BKE_tempdir_session