| 1286 | } |
| 1287 | |
| 1288 | var NodeBase::Parameter::addConnectionFrom(var dragDetails) |
| 1289 | { |
| 1290 | auto shouldAdd = dragDetails.isObject(); |
| 1291 | |
| 1292 | if (shouldAdd) |
| 1293 | { |
| 1294 | if (data[PropertyIds::Automated]) |
| 1295 | return var(); |
| 1296 | |
| 1297 | data.setProperty(PropertyIds::Automated, true, parent->getUndoManager()); |
| 1298 | |
| 1299 | auto sourceNodeId = DragHelpers::getSourceNodeId(dragDetails); |
| 1300 | auto parameterId = DragHelpers::getSourceParameterId(dragDetails); |
| 1301 | |
| 1302 | if (auto modSource = DragHelpers::getModulationSource(parent, dragDetails)) |
| 1303 | return modSource->addModulationConnection(0, this); |
| 1304 | |
| 1305 | if (sourceNodeId == parent->getId() && parameterId == getId()) |
| 1306 | return {}; |
| 1307 | |
| 1308 | if (auto sn = parent->getRootNetwork()->getNodeWithId(sourceNodeId)) |
| 1309 | return sn->addModulationConnection(var(parameterId), this); |
| 1310 | |
| 1311 | return {}; |
| 1312 | } |
| 1313 | else |
| 1314 | { |
| 1315 | auto c = getConnectionSourceTree(true); |
| 1316 | |
| 1317 | if (c.isValid()) |
| 1318 | { |
| 1319 | data.setProperty(PropertyIds::Automated, false, parent->getUndoManager()); |
| 1320 | c.getParent().removeChild(c, parent->getUndoManager()); |
| 1321 | } |
| 1322 | |
| 1323 | connectionSourceTree = {}; |
| 1324 | |
| 1325 | return {}; |
| 1326 | } |
| 1327 | } |
| 1328 | |
| 1329 | bool NodeBase::Parameter::matchesConnection(const ValueTree& c) const |
| 1330 | { |
no test coverage detected