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

Method connectToBypass

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

Source from the content-addressed store, hash-verified

1229};
1230
1231void 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
1288var NodeBase::Parameter::addConnectionFrom(var dragDetails)

Callers 2

itemDroppedMethod · 0.80
mouseDoubleClickMethod · 0.80

Calls 15

getIdFunction · 0.85
getChildWithNameMethod · 0.80
containsCharMethod · 0.80
getNodeWithIdMethod · 0.80
getParameterFromNameMethod · 0.80
getUndoManagerFunction · 0.50
isValidMethod · 0.45
setPropertyMethod · 0.45
toStringMethod · 0.45
addChildMethod · 0.45
upToFirstOccurrenceOfMethod · 0.45
fromFirstOccurrenceOfMethod · 0.45

Tested by

no test coverage detected