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

Method wrapIntoNetwork

hi_scripting/scripting/scriptnode/ui/NodeComponent.cpp:1197–1235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197void NodeComponent::PopupHelpers::wrapIntoNetwork(NodeBase* node, bool makeCompileable)
1198{
1199#if USE_BACKEND
1200 ValueTree nData(PropertyIds::Network);
1201
1202 auto rootTree = node->getRootNetwork()->getValueTree();
1203
1204
1205
1206 // mirror all properties from the parent network;
1207 for (int i = 0; i < rootTree.getNumProperties(); i++)
1208 nData.setProperty(rootTree.getPropertyName(i), rootTree.getProperty(rootTree.getPropertyName(i)), nullptr);
1209
1210 nData.setProperty(PropertyIds::ID, node->getId(), nullptr);
1211 nData.addChild(node->getValueTree().createCopy(), -1, nullptr);
1212
1213 auto ndir = BackendDllManager::getSubFolder(node->getScriptProcessor()->getMainController_(), BackendDllManager::FolderSubType::Networks);
1214
1215 auto tFile = ndir.getChildFile(node->getId()).withFileExtension("xml");
1216
1217 if (makeCompileable)
1218 {
1219 nData.setProperty(PropertyIds::AllowCompilation, makeCompileable, nullptr);
1220 nData.setProperty(PropertyIds::CompileChannelAmount, node->getCurrentChannelAmount(), nullptr);
1221 }
1222
1223 if (!tFile.existsAsFile() || PresetHandler::showYesNoWindow("Overwrite file", "Do you want to overwrite the file " + tFile.getFileName()))
1224 {
1225 auto xml = nData.createXml();
1226 tFile.replaceWithText(xml->createDocument(""));
1227
1228 auto newPath = "project." + node->getId();
1229 node->setValueTreeProperty(PropertyIds::FactoryPath, newPath);
1230
1231 PresetHandler::showMessageWindow("Exported chain as new network", "Reload this patch to apply the change");
1232 return;
1233 }
1234#endif
1235}
1236
1237void NodeComponent::PopupHelpers::wrapIntoChain(NodeBase* node, MenuActions result, String idToUse)
1238{

Callers

nothing calls this directly

Calls 15

getRootNetworkMethod · 0.80
getMainController_Method · 0.80
replaceWithTextMethod · 0.80
createDocumentMethod · 0.80
setValueTreePropertyMethod · 0.80
getValueTreeMethod · 0.45
setPropertyMethod · 0.45
getPropertyMethod · 0.45
getIdMethod · 0.45
addChildMethod · 0.45
createCopyMethod · 0.45

Tested by

no test coverage detected