| 2825 | } |
| 2826 | |
| 2827 | void |
| 2828 | Project::extractTreesFromNodes(const NodesList& nodes, |
| 2829 | std::list<Project::NodesTree>& trees) |
| 2830 | { |
| 2831 | NodesList markedNodes; |
| 2832 | |
| 2833 | for (NodesList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 2834 | bool isOutput = !hasNodeOutputsInList(nodes, *it); |
| 2835 | if (isOutput) { |
| 2836 | NodesTree tree; |
| 2837 | tree.output.node = *it; |
| 2838 | const NodesWList& outputs = (*it)->getGuiOutputs(); |
| 2839 | for (NodesWList::const_iterator it2 = outputs.begin(); it2 != outputs.end(); ++it2) { |
| 2840 | NodePtr output = it2->lock(); |
| 2841 | if (!output) { |
| 2842 | continue; |
| 2843 | } |
| 2844 | int idx = output->inputIndex(*it); |
| 2845 | tree.output.outputs.push_back( std::make_pair(idx, *it2) ); |
| 2846 | } |
| 2847 | |
| 2848 | const std::vector<NodeWPtr>& inputs = (*it)->getGuiInputs(); |
| 2849 | for (U32 i = 0; i < inputs.size(); ++i) { |
| 2850 | NodePtr input = inputs[i].lock(); |
| 2851 | if (input) { |
| 2852 | addTreeInputs(nodes, input, tree, markedNodes); |
| 2853 | } |
| 2854 | } |
| 2855 | |
| 2856 | if ( tree.inputs.empty() ) { |
| 2857 | TreeInput input; |
| 2858 | input.node = *it; |
| 2859 | |
| 2860 | const std::vector<NodeWPtr>& inputs = (*it)->getGuiInputs(); |
| 2861 | input.inputs.resize( inputs.size() ); |
| 2862 | for (std::size_t i = 0; i < inputs.size(); ++i) { |
| 2863 | input.inputs[i] = inputs[i].lock(); |
| 2864 | } |
| 2865 | tree.inputs.push_back(input); |
| 2866 | } |
| 2867 | |
| 2868 | trees.push_back(tree); |
| 2869 | } |
| 2870 | } |
| 2871 | } |
| 2872 | |
| 2873 | bool |
| 2874 | Project::addFormat(const std::string& formatSpec) |
nothing calls this directly
no test coverage detected