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
+3 -6
View File
@@ -59,8 +59,9 @@ namespace VISEQ::GRAPH {
return nodes.size();
}
void addMidiNode(Vec2Df position){
void createMidiNode(Vec2Df position){
nodes.emplace_back(std::make_shared<MidiNode>(position));
nodes.back()->update();
}
void setMidiPortForAll(int number, bool _state){
@@ -71,10 +72,6 @@ namespace VISEQ::GRAPH {
void addNode(SPTR_Node node){
nodes.insert(nodes.end(), node);
}
void addNodeAndUpdate(SPTR_Node node){
addNode(node);
node->update();
}
@@ -242,7 +239,7 @@ namespace VISEQ::GRAPH {
void splitEdges(){
for(auto s : split_edges){
Vec2Df center = s.lock()->end.lock()->position.center(s.lock()->start.lock()->position);
SPTR_Node cn = copyNode(std::dynamic_pointer_cast<MidiNode>(s.lock()->start.lock()), center);
SPTR_Node cn = copyNode(std::dynamic_pointer_cast<MidiNode>(s.lock()->start.lock()), center); // TODO: copy connectors
addConnection(s.lock()->start.lock(), cn);
addConnection(cn, s.lock()->end.lock());
remove_edges.push_back(s);