| 1388 | } |
| 1389 | |
| 1390 | void ShaderNetworkAlgo::convertDeprecatedSplines( ShaderNetwork *network ) |
| 1391 | { |
| 1392 | for( const auto &s : network->shaders() ) |
| 1393 | { |
| 1394 | const CompoundDataMap &origParameters = s.second->parameters(); |
| 1395 | |
| 1396 | CompoundDataPtr newParametersData; |
| 1397 | CompoundDataMap *newParameters = nullptr; |
| 1398 | |
| 1399 | for( const auto &[name, value] : origParameters ) |
| 1400 | { |
| 1401 | if( const SplinefColor3fData *colorSpline = runTimeCast<const SplinefColor3fData>( value.get() ) ) |
| 1402 | { |
| 1403 | ensureParametersCopy( origParameters, newParametersData, newParameters ); |
| 1404 | RampfColor3fDataPtr rampData = new RampfColor3fData; |
| 1405 | rampData->writable().fromDeprecatedSpline( colorSpline->readable() ); |
| 1406 | (*newParameters)[ name ] = rampData; |
| 1407 | } |
| 1408 | else if( const SplineffData *floatSpline = runTimeCast<const SplineffData>( value.get() ) ) |
| 1409 | { |
| 1410 | ensureParametersCopy( origParameters, newParametersData, newParameters ); |
| 1411 | RampffDataPtr rampData = new RampffData; |
| 1412 | rampData->writable().fromDeprecatedSpline( floatSpline->readable() ); |
| 1413 | (*newParameters)[ name ] = rampData; |
| 1414 | } |
| 1415 | } |
| 1416 | |
| 1417 | if( newParameters ) |
| 1418 | { |
| 1419 | network->setShader( s.first, std::move( |
| 1420 | new Shader( s.second->getName(), s.second->getType(), newParametersData.get() ) |
| 1421 | ) ); |
| 1422 | } |
| 1423 | |
| 1424 | } |
| 1425 | } |
nothing calls this directly
no test coverage detected