| 2162 | } |
| 2163 | |
| 2164 | void |
| 2165 | Project::setOrAddProjectFormat(const Format & frmt, |
| 2166 | bool skipAdd) |
| 2167 | { |
| 2168 | if ( frmt.isNull() ) { |
| 2169 | return; |
| 2170 | } |
| 2171 | |
| 2172 | bool mustRefreshNodeFormats = false; |
| 2173 | Format dispW; |
| 2174 | { |
| 2175 | QMutexLocker l(&_imp->formatMutex); |
| 2176 | |
| 2177 | if (_imp->autoSetProjectFormat) { |
| 2178 | _imp->autoSetProjectFormat = false; |
| 2179 | dispW = frmt; |
| 2180 | |
| 2181 | Format df = appPTR->findExistingFormat( dispW.width(), dispW.height(), dispW.getPixelAspectRatio() ); |
| 2182 | if ( !df.isNull() ) { |
| 2183 | dispW.setName( df.getName() ); |
| 2184 | setProjectDefaultFormat(dispW); |
| 2185 | } else { |
| 2186 | setProjectDefaultFormat(dispW); |
| 2187 | } |
| 2188 | } else if (!skipAdd) { |
| 2189 | dispW = frmt; |
| 2190 | bool existed = false; |
| 2191 | tryAddProjectFormat(dispW, &existed); |
| 2192 | if (!existed) { |
| 2193 | mustRefreshNodeFormats = true; |
| 2194 | } |
| 2195 | } |
| 2196 | } |
| 2197 | if (mustRefreshNodeFormats) { |
| 2198 | // Refresh nodes with a format parameter |
| 2199 | NodesList nodes; |
| 2200 | getNodes_recursive(nodes, true); |
| 2201 | int index = _imp->formatKnob->getValue(); |
| 2202 | std::vector<ChoiceOption> entries = _imp->formatKnob->getEntries_mt_safe(); |
| 2203 | for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 2204 | (*it)->refreshFormatParamChoice(entries, index, false); |
| 2205 | } |
| 2206 | |
| 2207 | } |
| 2208 | } |
| 2209 | |
| 2210 | bool |
| 2211 | Project::tryLock() const |