2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-06-14 12:19:13 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
|
2025-03-29 15:18:50 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
2023-06-14 12:19:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2025-01-28 15:27:34 +01:00
|
|
|
#include <optional>
|
2023-06-14 12:19:13 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
|
2025-03-23 13:34:07 +01:00
|
|
|
namespace blender::dot_export {
|
2023-06-14 12:19:13 +02:00
|
|
|
class DirectedEdge;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace blender::bke {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allows customizing how the generated dot graph looks like.
|
|
|
|
|
*/
|
|
|
|
|
class bNodeTreeToDotOptions {
|
|
|
|
|
public:
|
|
|
|
|
virtual std::string socket_name(const bNodeSocket &socket) const;
|
|
|
|
|
virtual std::optional<std::string> socket_font_color(const bNodeSocket &socket) const;
|
2025-03-23 13:34:07 +01:00
|
|
|
virtual void add_edge_attributes(const bNodeLink &link,
|
|
|
|
|
dot_export::DirectedEdge &dot_edge) const;
|
2023-06-14 12:19:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert a node tree into the dot format. This can be visualized with tools like graphviz and is
|
|
|
|
|
* very useful for debugging purposes.
|
|
|
|
|
*/
|
|
|
|
|
std::string node_tree_to_dot(const bNodeTree &tree,
|
|
|
|
|
const bNodeTreeToDotOptions &options = bNodeTreeToDotOptions());
|
|
|
|
|
|
|
|
|
|
} // namespace blender::bke
|