MCPcopy Create free account
hub / github.com/ImageEngine/cortex / convertComponentSuffix

Function convertComponentSuffix

src/IECoreScene/ShaderNetworkAlgo.cpp:606–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604{
605
606ShaderNetwork::Parameter convertComponentSuffix( const ShaderNetwork::Parameter &parameter, const std::string &suffix )
607{
608 int index;
609 auto it = find( begin( g_vectorComponents ), end( g_vectorComponents ), suffix );
610 if( it != end( g_vectorComponents ) )
611 {
612 index = it - begin( g_vectorComponents );
613 }
614 else
615 {
616 auto cIt = find( begin( g_colorComponents ), end( g_colorComponents ), suffix );
617 assert( cIt != end( g_colorComponents ) );
618 index = cIt - begin( g_colorComponents );
619 }
620
621 return ShaderNetwork::Parameter(
622 parameter.shader,
623 boost::replace_last_copy( parameter.name.string(), "." + suffix, "[" + to_string( index ) + "]" )
624 );
625}
626
627void convertOSLComponentConnections( ShaderNetwork *network, int oslVersion )
628{

Callers 1

Calls 2

findFunction · 0.85
ParameterFunction · 0.85

Tested by

no test coverage detected