Working on config nodes. They exist now, but do nothing yet.
This commit is contained in:
+14
-9
@@ -63,16 +63,25 @@ namespace VISEQ::APP {
|
||||
json graph = json::parse(f);
|
||||
|
||||
for(auto n : graph.at("gm").at("nodes")){
|
||||
gm->addNode(n.template get<std::shared_ptr<MidiNode>>());
|
||||
std::cout << "object? " << n.is_object() << std::endl;
|
||||
if(n.is_object()){
|
||||
std::cout << "nodeType = " << n.at("nodeType").get<int>() << std::endl;
|
||||
|
||||
if(n.at("nodeType").get<int>() == NodeType::MIDINODE) gm->addNode(n.template get<std::shared_ptr<MidiNode>>());
|
||||
if(n.at("nodeType").get<int>() == NodeType::CONFIGNODE) gm->addNode(n.template get<std::shared_ptr<ConfigNode>>());
|
||||
}
|
||||
}
|
||||
|
||||
int highest_id = 0;
|
||||
Node hid;
|
||||
for(auto n : graph.at("gm").at("nodes")){
|
||||
MidiNode mn = n.template get<MidiNode>();
|
||||
if(mn.id > highest_id) {
|
||||
highest_id = mn.id;
|
||||
hid = mn;
|
||||
std::cout << n << std::endl;
|
||||
if(n.is_object()){
|
||||
Node mn = n.template get<Node>();
|
||||
if(mn.id > highest_id) {
|
||||
highest_id = mn.id;
|
||||
hid = mn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,14 +98,10 @@ namespace VISEQ::APP {
|
||||
VEC_WPTR_Node start = gm->getNodesByID(start_id);
|
||||
VEC_WPTR_Node end = gm->getNodesByID(end_id);
|
||||
|
||||
// VEC_SPTR_Node start = gm->nodes | RANGE_FILTER([start_id](SPTR_Node n){return n->id == start_id;}) | std::ranges::to<VEC_SPTR_Node>();
|
||||
// VEC_SPTR_Node end = gm->nodes | RANGE_FILTER([end_id](SPTR_Node n){return n->id == end_id;}) | std::ranges::to<VEC_SPTR_Node>();
|
||||
|
||||
if(!start.empty() && !end.empty()) {
|
||||
std::cout << std::format("connection {} to {}", start_id, end_id) << std::endl;
|
||||
gm->addConnection(start.front(), end.front());
|
||||
}
|
||||
|
||||
}
|
||||
gm->lastEdge().lock()->newId(highest_id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user