MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / setOrAddProjectFormat

Method setOrAddProjectFormat

Engine/Project.cpp:2164–2208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2162}
2163
2164void
2165Project::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
2210bool
2211Project::tryLock() const

Callers 3

TEST_FFunction · 0.80
renderRoIInternalMethod · 0.80
createNewFormatMethod · 0.80

Calls 12

findExistingFormatMethod · 0.80
getNameMethod · 0.80
getEntries_mt_safeMethod · 0.80
isNullMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
getPixelAspectRatioMethod · 0.45
setNameMethod · 0.45
getValueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TEST_FFunction · 0.64