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

Method numParticles

src/IECoreScene/NParticleReader.cpp:177–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177size_t NParticleReader::numParticles()
178{
179 if( !open() )
180 {
181 return 0;
182 }
183
184 int numParticles = 0;
185 int frameIndex = m_frameParameter->getNumericValue();
186 int frame = m_frames->readable()[frameIndex];
187 std::map<int, IFFFile::Chunk::ChunkIterator>::const_iterator frameIt = frameToRootChildren.find( frame );
188 if( frameIt == frameToRootChildren.end() )
189 {
190 msg( Msg::Warning, "NParticleReader::attributeNames()", boost::format( "Frame '%d' (index '%d') does not exist in '%s'." ) % frame % frameIndex % m_iffFileName );
191 return 0;
192 }
193
194 IFFFile::Chunk::ChunkIterator child = frameIt->second;
195 IFFFile::Chunk::ChunkIterator it = child->childrenBegin();
196
197 for ( ; it != child->childrenEnd(); it++ )
198 {
199 if ( it->type().id() == kSIZE )
200 {
201 it->read( numParticles );
202 break;
203 }
204 }
205
206 return numParticles;
207}
208
209void NParticleReader::attributeNames( std::vector<std::string> &names )
210{

Callers 10

testConversionMethod · 0.45
testFileNameChangeMethod · 0.45
testMultiFrameFilesMethod · 0.45
testConversionMethod · 0.45
testFileNameChangeMethod · 0.45
testNClothAsParticlesMethod · 0.45

Calls 9

getNumericValueMethod · 0.80
readableMethod · 0.80
childrenBeginMethod · 0.80
childrenEndMethod · 0.80
idMethod · 0.80
findMethod · 0.45
endMethod · 0.45
typeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected