MCPcopy Create free account
hub / github.com/christophhart/HISE / addConnectionFrom

Method addConnectionFrom

hi_scripting/scripting/scriptnode/api/NodeBase.cpp:1288–1327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286}
1287
1288var 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
1329bool NodeBase::Parameter::matchesConnection(const ValueTree& c) const
1330{

Callers 3

buttonClickedMethod · 0.80
itemDroppedMethod · 0.80
mouseDoubleClickMethod · 0.80

Calls 12

varFunction · 0.85
getIdFunction · 0.85
getNodeWithIdMethod · 0.80
getRootNetworkMethod · 0.80
isObjectMethod · 0.45
setPropertyMethod · 0.45
getUndoManagerMethod · 0.45
getIdMethod · 0.45
isValidMethod · 0.45
removeChildMethod · 0.45
getParentMethod · 0.45

Tested by

no test coverage detected