Skip to content

Commit

Permalink
merian-nodes: Graph: attempt to sort connections for better git diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Sep 13, 2024
1 parent a5b553c commit 818b2c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/merian-nodes/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,7 @@ class Graph : public std::enable_shared_from_this<Graph<ITERATIONS_IN_FLIGHT>> {

if (!nodes.empty()) {
// go into "loading" mode
SPDLOG_INFO(
"Attempt to reconstruct the graph from properties. Fingers crossed!");
SPDLOG_INFO("Reconstructing graph from properties.");
loading = true;
reset(); // never know...
}
Expand Down Expand Up @@ -913,7 +912,9 @@ class Graph : public std::enable_shared_from_this<Graph<ITERATIONS_IN_FLIGHT>> {
if (!props.is_ui()) {
nlohmann::json connections;
if (!loading) {
for (const auto& [node, data] : node_data) {
for (const auto& identifier : identifiers()) {
const NodeHandle& node = node_for_identifier.at(identifier);
const auto& data = node_data.at(node);
for (const OutgoingNodeConnection& con : data.desired_outgoing_connections) {
nlohmann::json j_con;
j_con["src"] = data.identifier;
Expand All @@ -925,6 +926,7 @@ class Graph : public std::enable_shared_from_this<Graph<ITERATIONS_IN_FLIGHT>> {
}
}
}
std::sort(connections.begin(), connections.end());
props.serialize_json("connections", connections);
if (loading) {
for (auto& j_con : connections) {
Expand Down

0 comments on commit 818b2c6

Please sign in to comment.