MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetAnimationNames

Method GetAnimationNames

trinity/Tr2GrannyAnimation.cpp:2249–2323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2247}
2248
2249std::vector<std::string> Tr2GrannyAnimation::GetAnimationNames() const
2250{
2251 if( IsUsingCMF() )
2252 {
2253 std::vector<std::string> names;
2254
2255 if( auto cmfData = GetCMFData() )
2256 {
2257 for( auto& animation : cmfData->animations )
2258 {
2259 names.push_back( cmf::ToStdString( animation.name ) );
2260 }
2261 }
2262
2263 for( auto& [resPath, res] : m_secondaryGrannyRes )
2264 {
2265 if( !res )
2266 {
2267 continue;
2268 }
2269
2270 CCP_ASSERT_M( res->IsUsingCMF(), "Tr2GrannyAnimation::GetAnimationNames: main data is cmf, secondary data is granny!" );
2271
2272 if( auto cmfData = GetSecondaryCMFFileInfo( resPath, res ) )
2273 {
2274 for( auto& animation : cmfData->animations )
2275 {
2276 names.push_back( cmf::ToStdString( animation.name ) );
2277 }
2278 }
2279 }
2280
2281 return names;
2282 }
2283#if WITH_GRANNY
2284 else
2285 {
2286 std::vector<std::string> names;
2287
2288 auto CopyNames = [&]( granny_file_info* f ) {
2289 for( granny_int32 i = 0; i < f->AnimationCount; ++i )
2290 {
2291 names.push_back( f->Animations[i]->Name );
2292 }
2293 };
2294
2295 if( auto fi = GetFileInfo() )
2296 {
2297 CopyNames( fi );
2298 }
2299
2300 for( auto it = begin( m_secondaryGrannyRes ); it != end( m_secondaryGrannyRes ); ++it )
2301 {
2302 if( !it->second )
2303 {
2304 continue;
2305 }
2306

Callers

nothing calls this directly

Calls 6

IsUsingCMFFunction · 0.85
GetSecondaryCMFFileInfoFunction · 0.85
GetSecondaryFileInfoFunction · 0.85
beginFunction · 0.70
endFunction · 0.70
IsUsingCMFMethod · 0.45

Tested by

no test coverage detected