diff options
Diffstat (limited to 'NT/src/rotor.cpp')
| -rw-r--r-- | NT/src/rotor.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/NT/src/rotor.cpp b/NT/src/rotor.cpp index 5225c02..1b75187 100644 --- a/NT/src/rotor.cpp +++ b/NT/src/rotor.cpp @@ -7,13 +7,18 @@ using namespace std; using namespace Rotor; +string Variable::get_connection_id(){ + if (connection) return connection->get_id(); + return ""; +} + template <class T> Json::Value Variable_type<T>::to_json(){ Json::Value json; json["type"]=get_type(); json["name"]=name; json["connectable"]=connectable?"yes":"no"; - json["input"]=connection?connection->id:""; + json["input"]=connection?connection->get_id():""; return json; } @@ -25,7 +30,7 @@ Json::Value Variable_array_type<T>::to_json(){ json["connectable"]=connectable?"yes":"no"; json["input"]=Json::arrayValue; for (auto& input: values) { - json["input"].append(input.connection?input.connection->id:""); + json["input"].append(input.is_connected()?input.get_connection_id():""); } return json; } @@ -42,7 +47,7 @@ Json::Value Node::to_json(){ node["type"]=type; node["type_id"]=type_id; node["title"]=title; - node["output_type"]=output_type(); + node["output_type"]=get_type(); node["description"]=description; node["id"]=id; node["ui_type"]=ui_type; |
