| 1277 | } |
| 1278 | |
| 1279 | static void |
| 1280 | extractTreesFromNodes(const std::list<NodeGuiPtr> & nodes, |
| 1281 | std::list<ExtractedTree>& trees) |
| 1282 | { |
| 1283 | std::list<NodeGuiPtr> markedNodes; |
| 1284 | |
| 1285 | for (std::list<NodeGuiPtr> ::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 1286 | bool isOutput = !hasNodeOutputsInList(nodes, *it); |
| 1287 | if (isOutput) { |
| 1288 | ExtractedTree tree; |
| 1289 | tree.output.node = *it; |
| 1290 | NodePtr n = (*it)->getNode(); |
| 1291 | const NodesWList& outputs = n->getGuiOutputs(); |
| 1292 | for (NodesWList::const_iterator it2 = outputs.begin(); it2 != outputs.end(); ++it2) { |
| 1293 | NodePtr output = it2->lock(); |
| 1294 | if (!output) { |
| 1295 | continue; |
| 1296 | } |
| 1297 | int idx = output->inputIndex(n); |
| 1298 | tree.output.outputs.push_back( std::make_pair(idx, output) ); |
| 1299 | } |
| 1300 | |
| 1301 | const std::vector<Edge*>& inputs = (*it)->getInputsArrows(); |
| 1302 | for (U32 i = 0; i < inputs.size(); ++i) { |
| 1303 | NodeGuiPtr input = inputs[i]->getSource(); |
| 1304 | if (input) { |
| 1305 | addTreeInputs(nodes, input, tree, markedNodes); |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | if ( tree.inputs.empty() ) { |
| 1310 | ExtractedInput input; |
| 1311 | input.node = *it; |
| 1312 | input.inputs = n->getGuiInputs(); |
| 1313 | tree.inputs.push_back(input); |
| 1314 | } |
| 1315 | |
| 1316 | trees.push_back(tree); |
| 1317 | } |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | /////////////// |
| 1322 |
no test coverage detected