Connecting works again (almost). Connectors need to be copied when splitting edges.

This commit is contained in:
Sebastian
2024-12-05 01:25:00 +01:00
parent b6c2029386
commit 638df54ee6
7 changed files with 46 additions and 28 deletions
+4 -11
View File
@@ -63,7 +63,7 @@ namespace VISEQ::APP {
json graph = json::parse(f);
for(auto n : graph.at("gm").at("nodes")){
gm->addNodeAndUpdate(n.template get<std::shared_ptr<MidiNode>>());
gm->addNode(n.template get<std::shared_ptr<MidiNode>>());
}
int highest_id = 0;
@@ -81,13 +81,6 @@ namespace VISEQ::APP {
highest_id = e.at("id");
}
}
for(auto n : graph.at("gm").at("nodes")){
std::shared_ptr<MidiNode> mn = n;
gm->addNode(mn);
//app.gm->nodes.push_back(mn);
std::cout << std::format("adding node {}", mn->id) << std::endl;
}
for(auto e : graph.at("gm").at("edges")){
int start_id = e.at("start").get<int>();
@@ -126,10 +119,10 @@ namespace VISEQ::APP {
} else {
for(int i = 0; i < 4; ++i){
gm->addMidiNode(Vec2Df{(float)i * state->settings.grid*4 + 7 * state->settings.grid, 2 * state->settings.grid*4});
gm->createMidiNode(Vec2Df{(float)i * state->settings.grid*4 + 7 * state->settings.grid, 2 * state->settings.grid*4});
}
for(int i = 3; i >= 0; --i){
gm->addMidiNode(Vec2Df{(float)i * state->settings.grid*4 + 7 * state->settings.grid, 3 * state->settings.grid*4});
gm->createMidiNode(Vec2Df{(float)i * state->settings.grid*4 + 7 * state->settings.grid, 3 * state->settings.grid*4});
}
for(int i = 0; i < 8; ++i){
@@ -141,7 +134,7 @@ namespace VISEQ::APP {
}
void updateMidiPorts(){
for(auto&n : gm->getMidiNodes()){
for(auto& n : gm->getMidiNodes()){
auto nc = std::dynamic_pointer_cast<MidiNode>(n.lock());
for(auto& mo : sm->midi.midi_out_ports){
if(!nc->midi_outs.contains(mo.number) && mo.enabled){