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

Method idAttribute

src/IECoreScene/PDCParticleReader.cpp:373–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373const Data * PDCParticleReader::idAttribute()
374{
375 if( !open() )
376 {
377 return nullptr;
378 }
379 if( !m_idAttribute )
380 {
381 map<string, Record>::const_iterator it = m_header.attributes.find( "particleId" );
382 if( it == m_header.attributes.end() )
383 {
384 it = m_header.attributes.find( "id" );
385 }
386
387 if( it!=m_header.attributes.end() )
388 {
389 if( it->second.type==DoubleArray )
390 {
391 DoubleVectorDataPtr doubleVec = new DoubleVectorData;
392 doubleVec->writable().resize( numParticles() );
393 readElements( &doubleVec->writable()[0], it->second.position, numParticles() );
394 m_idAttribute = doubleVec;
395 }
396 if( it->second.type==IntegerArray )
397 {
398 IntVectorDataPtr intVec = new IntVectorData;
399 intVec->writable().resize( numParticles() );
400 readElements( &intVec->writable()[0], it->second.position, numParticles() );
401 m_idAttribute = intVec;
402 }
403 }
404 }
405 return m_idAttribute.get();
406}
407
408std::string PDCParticleReader::positionPrimVarName()
409{

Callers

nothing calls this directly

Calls 5

findMethod · 0.45
endMethod · 0.45
resizeMethod · 0.45
writableMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected