| 5140 | } |
| 5141 | |
| 5142 | void |
| 5143 | Node::initializeInputs() |
| 5144 | { |
| 5145 | ////Only called by the main-thread |
| 5146 | assert( QThread::currentThread() == qApp->thread() ); |
| 5147 | const int inputCount = getMaxInputCount(); |
| 5148 | InputsV oldInputs; |
| 5149 | { |
| 5150 | QMutexLocker k(&_imp->inputsLabelsMutex); |
| 5151 | _imp->inputLabels.resize(inputCount); |
| 5152 | _imp->inputHints.resize(inputCount); |
| 5153 | for (int i = 0; i < inputCount; ++i) { |
| 5154 | _imp->inputLabels[i] = _imp->effect->getInputLabel(i); |
| 5155 | _imp->inputHints[i] = _imp->effect->getInputHint(i); |
| 5156 | } |
| 5157 | } |
| 5158 | { |
| 5159 | QMutexLocker l(&_imp->lastRenderStartedMutex); |
| 5160 | _imp->inputIsRenderingCounter.resize(inputCount); |
| 5161 | } |
| 5162 | { |
| 5163 | QMutexLocker l(&_imp->inputsMutex); |
| 5164 | oldInputs = _imp->inputs; |
| 5165 | |
| 5166 | std::vector<bool> oldInputsVisibility = _imp->inputsVisibility; |
| 5167 | _imp->inputIsRenderingCounter.resize(inputCount); |
| 5168 | _imp->inputs.resize(inputCount); |
| 5169 | _imp->guiInputs.resize(inputCount); |
| 5170 | _imp->inputsVisibility.resize(inputCount); |
| 5171 | ///if we added inputs, just set to NULL the new inputs, and add their label to the labels map |
| 5172 | for (int i = 0; i < inputCount; ++i) { |
| 5173 | if ( i < (int)oldInputs.size() ) { |
| 5174 | _imp->inputs[i] = oldInputs[i]; |
| 5175 | _imp->guiInputs[i] = oldInputs[i]; |
| 5176 | } else { |
| 5177 | _imp->inputs[i].reset(); |
| 5178 | _imp->guiInputs[i].reset(); |
| 5179 | } |
| 5180 | if (i < (int) oldInputsVisibility.size()) { |
| 5181 | _imp->inputsVisibility[i] = oldInputsVisibility[i]; |
| 5182 | } else { |
| 5183 | _imp->inputsVisibility[i] = true; |
| 5184 | } |
| 5185 | } |
| 5186 | |
| 5187 | |
| 5188 | ///Set the components the plug-in accepts |
| 5189 | _imp->inputsComponents.resize(inputCount); |
| 5190 | for (int i = 0; i < inputCount; ++i) { |
| 5191 | _imp->inputsComponents[i].clear(); |
| 5192 | if ( _imp->effect->isInputMask(i) ) { |
| 5193 | //Force alpha for masks |
| 5194 | _imp->inputsComponents[i].push_back( ImagePlaneDesc::getAlphaComponents() ); |
| 5195 | } else { |
| 5196 | _imp->effect->addAcceptedComponents(i, &_imp->inputsComponents[i]); |
| 5197 | } |
| 5198 | } |
| 5199 | _imp->outputComponents.clear(); |
no test coverage detected