[Bf-blender-cvs] [2d368366166] functions: cleanup dot export
Jacques Lucke
noreply at git.blender.org
Mon Feb 10 15:14:57 CET 2020
Commit: 2d368366166f1be74920e99b4e771df243b852df
Author: Jacques Lucke
Date: Mon Feb 10 14:46:44 2020 +0100
Branches: functions
https://developer.blender.org/rB2d368366166f1be74920e99b4e771df243b852df
cleanup dot export
===================================================================
M source/blender/blenlib/BLI_dot_export.h
M source/blender/blenlib/intern/dot_export.cc
M source/blender/functions/intern/multi_function_network.cc
M source/blender/functions/intern/node_tree.cc
===================================================================
diff --git a/source/blender/blenlib/BLI_dot_export.h b/source/blender/blenlib/BLI_dot_export.h
index cf081ec9763..74a31b8b42a 100644
--- a/source/blender/blenlib/BLI_dot_export.h
+++ b/source/blender/blenlib/BLI_dot_export.h
@@ -243,19 +243,17 @@ class UndirectedEdge : public Edge {
void export__as_edge_statement(std::stringstream &ss) const;
};
-namespace Utils {
-
std::string color_attr_from_hsv(float h, float s, float v);
-class NodeWithSocketsWrapper {
+class NodeWithSocketsRef {
private:
Node *m_node;
public:
- NodeWithSocketsWrapper(Node &node,
- StringRef name,
- ArrayRef<std::string> input_names,
- ArrayRef<std::string> output_names);
+ NodeWithSocketsRef(Node &node,
+ StringRef name,
+ ArrayRef<std::string> input_names,
+ ArrayRef<std::string> output_names);
NodePort input(uint index) const
{
@@ -270,8 +268,6 @@ class NodeWithSocketsWrapper {
}
};
-} // namespace Utils
-
} // namespace DotExport
} // namespace BLI
diff --git a/source/blender/blenlib/intern/dot_export.cc b/source/blender/blenlib/intern/dot_export.cc
index 372fc8d1950..67bd564af29 100644
--- a/source/blender/blenlib/intern/dot_export.cc
+++ b/source/blender/blenlib/intern/dot_export.cc
@@ -95,7 +95,7 @@ void Cluster::set_random_cluster_bgcolors()
float hue = rand() / (float)RAND_MAX;
float staturation = 0.3f;
float value = 0.8f;
- this->set_attribute("bgcolor", Utils::color_attr_from_hsv(hue, staturation, value));
+ this->set_attribute("bgcolor", color_attr_from_hsv(hue, staturation, value));
for (Cluster *cluster : m_children) {
cluster->set_random_cluster_bgcolors();
@@ -225,8 +225,6 @@ void NodePort::to_dot_string(std::stringstream &ss) const
}
}
-namespace Utils {
-
std::string color_attr_from_hsv(float h, float s, float v)
{
std::stringstream ss;
@@ -234,10 +232,10 @@ std::string color_attr_from_hsv(float h, float s, float v)
return ss.str();
}
-NodeWithSocketsWrapper::NodeWithSocketsWrapper(Node &node,
- StringRef name,
- ArrayRef<std::string> input_names,
- ArrayRef<std::string> output_names)
+NodeWithSocketsRef::NodeWithSocketsRef(Node &node,
+ StringRef name,
+ ArrayRef<std::string> input_names,
+ ArrayRef<std::string> output_names)
: m_node(&node)
{
std::stringstream ss;
@@ -287,7 +285,5 @@ NodeWithSocketsWrapper::NodeWithSocketsWrapper(Node &node,
m_node->set_shape(Attr_shape::Rectangle);
}
-} // namespace Utils
-
} // namespace DotExport
} // namespace BLI
diff --git a/source/blender/functions/intern/multi_function_network.cc b/source/blender/functions/intern/multi_function_network.cc
index fdf51afd062..ef22f435a66 100644
--- a/source/blender/functions/intern/multi_function_network.cc
+++ b/source/blender/functions/intern/multi_function_network.cc
@@ -318,11 +318,11 @@ Vector<MFBuilderNode *> MFNetworkBuilder::find_nodes_not_to_the_left_of__exclusi
std::string MFNetworkBuilder::to_dot(const Set<MFBuilderNode *> &marked_nodes)
{
- using BLI::DotExport::Utils::NodeWithSocketsWrapper;
+ using BLI::DotExport::NodeWithSocketsRef;
BLI::DotExport::DirectedGraph digraph;
digraph.set_rankdir(BLI::DotExport::Attr_rankdir::LeftToRight);
- Map<MFBuilderNode *, NodeWithSocketsWrapper> dot_nodes;
+ Map<MFBuilderNode *, NodeWithSocketsRef> dot_nodes;
Vector<MFBuilderNode *> all_nodes;
all_nodes.extend(m_function_nodes.as_ref());
@@ -347,8 +347,7 @@ std::string MFNetworkBuilder::to_dot(const Set<MFBuilderNode *> &marked_nodes)
dot_node.set_background_color("#99EE99");
}
- dot_nodes.add_new(node,
- NodeWithSocketsWrapper(dot_node, node->name(), input_names, output_names));
+ dot_nodes.add_new(node, NodeWithSocketsRef(dot_node, node->name(), input_names, output_names));
}
for (MFBuilderNode *to_node : all_nodes) {
diff --git a/source/blender/functions/intern/node_tree.cc b/source/blender/functions/intern/node_tree.cc
index 18f8f53c56e..d84acb5ad8a 100644
--- a/source/blender/functions/intern/node_tree.cc
+++ b/source/blender/functions/intern/node_tree.cc
@@ -388,8 +388,8 @@ std::string FunctionTree::to_dot() const
BLI::DotExport::DirectedGraph digraph;
digraph.set_rankdir(BLI::DotExport::Attr_rankdir::LeftToRight);
- Map<const FNode *, BLI::DotExport::Utils::NodeWithSocketsWrapper> dot_nodes;
- Map<const FGroupInput *, BLI::DotExport::Utils::NodeWithSocketsWrapper> dot_group_inputs;
+ Map<const FNode *, BLI::DotExport::NodeWithSocketsRef> dot_nodes;
+ Map<const FGroupInput *, BLI::DotExport::NodeWithSocketsRef> dot_group_inputs;
Map<const FParentNode *, BLI::DotExport::Cluster *> dot_clusters;
for (const FNode *fnode : m_node_by_id) {
@@ -407,7 +407,7 @@ std::string FunctionTree::to_dot() const
}
dot_nodes.add_new(fnode,
- BLI::DotExport::Utils::NodeWithSocketsWrapper(
+ BLI::DotExport::NodeWithSocketsRef(
dot_node, fnode->vnode().name(), input_names, output_names));
BLI::DotExport::Cluster *cluster = get_cluster_for_parent(
@@ -425,7 +425,7 @@ std::string FunctionTree::to_dot() const
dot_group_inputs.add_new(
group_input,
- BLI::DotExport::Utils::NodeWithSocketsWrapper(
+ BLI::DotExport::NodeWithSocketsRef(
dot_group_input_node, "Group Input", {}, {group_input_name}));
BLI::DotExport::Cluster *cluster = get_cluster_for_parent(
More information about the Bf-blender-cvs
mailing list