Skip to content

Commit

Permalink
fixup! 3Delight ShaderNetworkAlgo : Convert <UDIM> tokens to UDIM
Browse files Browse the repository at this point in the history
Use boost::replace_last
  • Loading branch information
murraystevenson committed Apr 26, 2024
1 parent aa17cc7 commit 645052f
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/IECoreDelight/ShaderNetworkAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#endif

#include "boost/algorithm/string/predicate.hpp"
#include "boost/algorithm/string/replace.hpp"

using namespace Imath;
using namespace IECore;
Expand Down Expand Up @@ -753,11 +754,7 @@ void convertUSDUVTextures( ShaderNetwork *network )
ShaderPtr imageShader = new Shader( "__usd/__usdUVTexture", "osl:shader" );
// Replace `<UDIM>` with 3Delight's `UDIM` convention.
std::string path = parameterValue( shader.get(), g_fileParameter, std::string() );
const auto p = path.rfind( "<UDIM>" );
if( p != std::string::npos )
{
path.replace( p, 6, "UDIM" );
}
boost::replace_last( path, "<UDIM>", "UDIM" );
imageShader->parameters()[g_fileParameter] = new StringData( path );
transferUSDParameter( network, handle, shader.get(), g_sourceColorSpaceParameter, imageShader.get(), g_fileMetaColorSpaceParameter, std::string( "auto" ) );

Expand Down

0 comments on commit 645052f

Please sign in to comment.