| 1229 | }; |
| 1230 | |
| 1231 | void NodeBase::connectToBypass(var dragDetails) |
| 1232 | { |
| 1233 | auto sourceParameterTree = DragHelpers::getValueTreeOfSourceParameter(this, dragDetails); |
| 1234 | |
| 1235 | if (sourceParameterTree.isValid()) |
| 1236 | { |
| 1237 | ValueTree newC(PropertyIds::Connection); |
| 1238 | newC.setProperty(PropertyIds::NodeId, getId(), nullptr); |
| 1239 | newC.setProperty(PropertyIds::ParameterId, PropertyIds::Bypassed.toString(), nullptr); |
| 1240 | |
| 1241 | String connectionId = DragHelpers::getSourceNodeId(dragDetails) + "." + |
| 1242 | DragHelpers::getSourceParameterId(dragDetails); |
| 1243 | |
| 1244 | ValueTree connectionTree = sourceParameterTree.getChildWithName(PropertyIds::Connections); |
| 1245 | connectionTree.addChild(newC, -1, getUndoManager()); |
| 1246 | } |
| 1247 | else |
| 1248 | { |
| 1249 | auto src = getDynamicBypassSource(true); |
| 1250 | |
| 1251 | if(src.containsChar('.')) |
| 1252 | { |
| 1253 | if (auto srcNode = getRootNetwork()->getNodeWithId(src.upToFirstOccurrenceOf(".", false, false))) |
| 1254 | { |
| 1255 | if (auto srcParameter = srcNode->getParameterFromName(src.fromFirstOccurrenceOf(".", false, false))) |
| 1256 | { |
| 1257 | for (auto c : srcParameter->data.getChildWithName(PropertyIds::Connections)) |
| 1258 | { |
| 1259 | if (c[PropertyIds::NodeId] == getId() && c[PropertyIds::ParameterId].toString() == "Bypassed") |
| 1260 | { |
| 1261 | c.getParent().removeChild(c, getUndoManager()); |
| 1262 | return; |
| 1263 | } |
| 1264 | } |
| 1265 | } |
| 1266 | } |
| 1267 | } |
| 1268 | else if (src.containsChar('[')) |
| 1269 | { |
| 1270 | if (auto srcNode = getRootNetwork()->getNodeWithId(src.upToFirstOccurrenceOf("[", false, false))) |
| 1271 | { |
| 1272 | auto stree = srcNode->getValueTree().getChildWithName(PropertyIds::SwitchTargets); |
| 1273 | auto slotIndex = src.fromFirstOccurrenceOf("[", false, false).getIntValue(); |
| 1274 | |
| 1275 | for (auto c : stree.getChild(slotIndex).getChildWithName(PropertyIds::Connections)) |
| 1276 | { |
| 1277 | if (c[PropertyIds::NodeId] == getId() && c[PropertyIds::ParameterId].toString() == "Bypassed") |
| 1278 | { |
| 1279 | c.getParent().removeChild(c, getUndoManager()); |
| 1280 | return; |
| 1281 | } |
| 1282 | } |
| 1283 | } |
| 1284 | } |
| 1285 | } |
| 1286 | } |
| 1287 | |
| 1288 | var NodeBase::Parameter::addConnectionFrom(var dragDetails) |
no test coverage detected