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

Function remapToLegacyVariableNames

src/IECoreScene/Primitive.cpp:186–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void remapToLegacyVariableNames( const IndexedIO::EntryIDList &requested, const IndexedIO::EntryIDList &existing, IndexedIO::EntryIDList &result )
187{
188 result.clear();
189
190 IndexedIO::EntryIDList extraUVs;
191 for( const auto &existingName : existing )
192 {
193 if( boost::ends_with( existingName.string(), "_s" ) || boost::ends_with( existingName.string(), "_t" ) )
194 {
195 extraUVs.push_back( existingName.string().substr( 0, existingName.string().length() - 2 ) );
196 }
197 }
198
199 for( const auto &name : requested )
200 {
201 if( name == "uv" )
202 {
203 result.push_back( "s" );
204 result.push_back( "t" );
205 result.push_back( "stIndices" );
206 }
207 else if( std::find( extraUVs.begin(), extraUVs.end(), name ) != extraUVs.end() )
208 {
209 result.push_back( name.string() + "_s" );
210 result.push_back( name.string() + "_t" );
211 result.push_back( name.string() + "Indices" );
212 }
213 else
214 {
215 result.push_back( name );
216 }
217 }
218}
219
220void convertLegacyVariables( PrimitiveVariableMap &variables )
221{

Callers 1

Calls 4

findFunction · 0.85
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected