| 127 | } |
| 128 | |
| 129 | void |
| 130 | JoinViewsNode::onProjectViewsChanged() |
| 131 | { |
| 132 | std::size_t nInputs, oldNInputs; |
| 133 | { |
| 134 | QMutexLocker k(&_imp->inputsMutex); |
| 135 | const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames(); |
| 136 | |
| 137 | //Reverse names |
| 138 | oldNInputs = _imp->inputs.size(); |
| 139 | nInputs = views.size(); |
| 140 | _imp->inputs.resize(nInputs); |
| 141 | for (std::size_t i = 0; i < nInputs; ++i) { |
| 142 | _imp->inputs[i] = views[nInputs - 1 - i]; |
| 143 | } |
| 144 | } |
| 145 | std::vector<NodePtr> inputs(oldNInputs); |
| 146 | NodePtr node = getNode(); |
| 147 | |
| 148 | for (std::size_t i = 0; i < oldNInputs; ++i) { |
| 149 | inputs[i] = node->getInput(i); |
| 150 | } |
| 151 | node->initializeInputs(); |
| 152 | |
| 153 | //Reconnect the inputs |
| 154 | int index = oldNInputs - 1; |
| 155 | if (index >= 0) { |
| 156 | node->beginInputEdition(); |
| 157 | |
| 158 | for (int i = (int)nInputs - 1; i >= 0; --i, --index) { |
| 159 | node->disconnectInput(i); |
| 160 | if (index >= 0) { |
| 161 | if (inputs[index]) { |
| 162 | node->connectInput(inputs[index], i); |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | node->endInputEdition(true); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | NATRON_NAMESPACE_EXIT |
| 172 |
nothing calls this directly
no test coverage detected