MCPcopy Create free account
hub / github.com/MrKepzie/Natron / getProjectDefaultLayers

Method getProjectDefaultLayers

Engine/Project.cpp:1262–1316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1260}
1261
1262std::list<ImagePlaneDesc>
1263Project::getProjectDefaultLayers() const
1264{
1265 std::list<ImagePlaneDesc> ret;
1266 std::list<std::vector<std::string> > table;
1267
1268 _imp->defaultLayersList->getTable(&table);
1269 for (std::list<std::vector<std::string> >::iterator it = table.begin();
1270 it != table.end(); ++it) {
1271
1272 const std::string& planeLabel = (*it)[0];
1273 std::string planeID = planeLabel;
1274 std::string componentsLabel;
1275
1276 // The layers knob only propose the user to display the label of the plane desc,
1277 // but we need to recover the ID for the built-in planes to ensure compatibility
1278 // with the old Nuke multi-plane suite.
1279 if (planeID == kNatronColorPlaneLabel) {
1280 planeID = kNatronColorPlaneID;
1281 } else if (planeID == kNatronBackwardMotionVectorsPlaneLabel) {
1282 planeID = kNatronBackwardMotionVectorsPlaneID;
1283 componentsLabel = kNatronMotionComponentsLabel;
1284 } else if (planeID == kNatronForwardMotionVectorsPlaneLabel) {
1285 planeID = kNatronForwardMotionVectorsPlaneID;
1286 componentsLabel = kNatronMotionComponentsLabel;
1287 } else if (planeID == kNatronDisparityLeftPlaneLabel) {
1288 planeID = kNatronDisparityLeftPlaneID;
1289 componentsLabel = kNatronDisparityComponentsLabel;
1290 } else if (planeID == kNatronDisparityRightPlaneLabel) {
1291 planeID = kNatronDisparityRightPlaneID;
1292 componentsLabel = kNatronDisparityComponentsLabel;
1293 }
1294
1295 bool found = false;
1296 for (std::list<ImagePlaneDesc>::const_iterator it2 = ret.begin(); it2 != ret.end(); ++it2) {
1297 if (it2->getPlaneID() == planeID) {
1298 found = true;
1299 break;
1300 }
1301 }
1302 if (!found) {
1303 std::vector<std::string> componentsName;
1304 QString str = QString::fromUtf8( (*it)[1].c_str() );
1305 QStringList channels = str.split( QLatin1Char(' ') );
1306 componentsName.resize( channels.size() );
1307 for (int i = 0; i < channels.size(); ++i) {
1308 componentsName[i] = channels[i].toStdString();
1309 }
1310 ImagePlaneDesc c( planeID, planeLabel, componentsLabel, componentsName );
1311 ret.push_back(c);
1312 }
1313 }
1314
1315 return ret;
1316}
1317
1318void
1319Project::addProjectDefaultLayer(const ImagePlaneDesc& comps)

Callers 3

EffectInstance.cppFile · 0.80
getAvailableLayersMethod · 0.80

Calls 7

toStdStringMethod · 0.80
getTableMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected