| 1360 | } |
| 1361 | |
| 1362 | std::list<ImagePlaneDesc> |
| 1363 | Project::getProjectDefaultLayers() const |
| 1364 | { |
| 1365 | std::list<ImagePlaneDesc> ret; |
| 1366 | std::list<std::vector<std::string> > table; |
| 1367 | |
| 1368 | _imp->defaultLayersList->getTable(&table); |
| 1369 | for (std::list<std::vector<std::string> >::iterator it = table.begin(); |
| 1370 | it != table.end(); ++it) { |
| 1371 | |
| 1372 | const std::string& planeLabel = (*it)[0]; |
| 1373 | std::string planeID = planeLabel; |
| 1374 | std::string componentsLabel; |
| 1375 | |
| 1376 | // The layers knob only propose the user to display the label of the plane desc, |
| 1377 | // but we need to recover the ID for the built-in planes to ensure compatibility |
| 1378 | // with the old Nuke multi-plane suite. |
| 1379 | if (planeID == kNatronColorPlaneLabel) { |
| 1380 | planeID = kNatronColorPlaneID; |
| 1381 | } else if (planeID == kNatronBackwardMotionVectorsPlaneLabel) { |
| 1382 | planeID = kNatronBackwardMotionVectorsPlaneID; |
| 1383 | componentsLabel = kNatronMotionComponentsLabel; |
| 1384 | } else if (planeID == kNatronForwardMotionVectorsPlaneLabel) { |
| 1385 | planeID = kNatronForwardMotionVectorsPlaneID; |
| 1386 | componentsLabel = kNatronMotionComponentsLabel; |
| 1387 | } else if (planeID == kNatronDisparityLeftPlaneLabel) { |
| 1388 | planeID = kNatronDisparityLeftPlaneID; |
| 1389 | componentsLabel = kNatronDisparityComponentsLabel; |
| 1390 | } else if (planeID == kNatronDisparityRightPlaneLabel) { |
| 1391 | planeID = kNatronDisparityRightPlaneID; |
| 1392 | componentsLabel = kNatronDisparityComponentsLabel; |
| 1393 | } |
| 1394 | |
| 1395 | bool found = false; |
| 1396 | for (std::list<ImagePlaneDesc>::const_iterator it2 = ret.begin(); it2 != ret.end(); ++it2) { |
| 1397 | if (it2->getPlaneID() == planeID) { |
| 1398 | found = true; |
| 1399 | break; |
| 1400 | } |
| 1401 | } |
| 1402 | if (!found) { |
| 1403 | std::vector<std::string> componentsName; |
| 1404 | QString str = QString::fromUtf8( (*it)[1].c_str() ); |
| 1405 | QStringList channels = str.split( QLatin1Char(' ') ); |
| 1406 | componentsName.resize( channels.size() ); |
| 1407 | for (int i = 0; i < channels.size(); ++i) { |
| 1408 | componentsName[i] = channels[i].toStdString(); |
| 1409 | } |
| 1410 | ImagePlaneDesc c( planeID, planeLabel, componentsLabel, componentsName ); |
| 1411 | ret.push_back(c); |
| 1412 | } |
| 1413 | } |
| 1414 | |
| 1415 | return ret; |
| 1416 | } |
| 1417 | |
| 1418 | void |
| 1419 | Project::addProjectDefaultLayer(const ImagePlaneDesc& comps) |
no test coverage detected