static id fixed

This commit is contained in:
Sebastian
2024-11-05 00:51:25 +01:00
parent dc7eae1931
commit 4a346350f4
3 changed files with 31 additions and 8 deletions
+15 -5
View File
@@ -9,6 +9,7 @@
#include "graph-manager.h"
#include "node.h"
#include "vmath.h"
#include <alsa/hwdep.h>
#include <filesystem>
#include <fstream>
#define RAYGUI_IMPLEMENTATION
@@ -29,8 +30,6 @@
#include <iterator>
#include <memory>
#include "state-io.h"
using json = nlohmann::json;
VISEQ::APP::AppState app;
@@ -85,16 +84,25 @@ int main(){
app.settings = graph.at("settings");
// app.gm = graph["graphmanager"].get<VISEQ::GRAPH::GraphManager>();
int highest_id = 0;
std::shared_ptr<Node> hid;
for(auto n : graph.at("graphmanager").at("nodes")){
std::shared_ptr<MidiNode> mn = n;
app.gm.nodes.push_back(mn);
if(mn->id > highest_id) {
highest_id = mn->id;
hid = mn;
}
}
for(auto e : graph.at("graphmanager").at("edges")){
if(e.at("id") > highest_id){
highest_id = e.at("id");
}
}
for(auto n : graph.at("graphmanager").at("nodes")){
std::shared_ptr<MidiNode> mn = n;
app.gm.nodes.push_back(mn);
std::cout << std::format("adding node {}", mn->id) << std::endl;
}
@@ -111,7 +119,9 @@ int main(){
}
}
app.gm.edges.back()->newId(highest_id); // reset static id counter in base class
for(auto s : graph.at("signalmanager").at("signals")){
int start_id = s.at("start").get<int>();
int next_id = s.at("next").get<int>();