31 if (
TNULL != a_pArray )
35 for (
TUINT i = 0; i < pArray->GetSize(); i++ )
49 if ( m_Libraries.IsValid( m_Libraries.Find( a_rLibraryName ) ) )
53 m_LibrariesRefs.Find( a_rLibraryName )->GetSecond() += 1;
59 auto pKeyFrameLibMngr = &pRenderInterface->GetKeyframeLibraryManager();
61 if (
TNULL == a_pTRB )
65 filePath.
Format(
"data/models/%s.tkl", a_rLibraryName.GetString() );
67 pKeyFrameLibrary = pKeyFrameLibMngr->LoadLibrary( filePath );
72 symbolname.
Format(
"%s_keylib", a_rLibraryName.GetString() );
76 goto LoadFromModelsFolder;
78 pKeyFrameLibrary = pKeyFrameLibMngr->LoadLibrary( a_pTRB, symbolname );
81 if ( !pKeyFrameLibrary )
82 goto LoadFromModelsFolder;
87 if (
TNULL != pKeyFrameLibrary )
88 m_Libraries.Insert( a_rLibraryName, pKeyFrameLibrary );
90 m_LibrariesRefs.Insert( a_rLibraryName, 1 );
99 auto pResultNode = m_Libraries.Find( a_rLibraryName );
101 if ( m_Libraries.IsValid( pResultNode ) )
103 auto pRefResultNode = m_LibrariesRefs.Find( pResultNode->GetFirst() );
105 if ( pRefResultNode != m_LibrariesRefs.End() )
107 auto& rNumRefs = pResultNode->GetSecond();
114 UnloadLibrary( pResultNode );
115 m_LibrariesRefs.Remove( pRefResultNode );
123void AKeyFrameLibraryManager::UnloadAllLibraries()
127 for (
auto it = m_Libraries.Begin(); it != m_Libraries.End(); )
129 auto pNext = it.Next();
135 m_LibrariesRefs.Clear();
138void AKeyFrameLibraryManager::UnloadLibrary( LibraryMap::Iterator& a_rLibrary )
142 if ( a_rLibrary != m_Libraries.End() )
145 pKeyFrameLibMngr->
UnloadLibrary( a_rLibrary.GetValue()->GetSecond() );
146 m_Libraries.Remove( a_rLibrary );
Rendering system interface for the Toshi engine.
#define TOSHI_NAMESPACE_USING
#define TPROFILER_SCOPE()
#define TDEFINE_CLASS(...)
ALoadScreen g_oLoadScreen
TTRBSymbol * GetSymbol(TINT index) const
const class PBPropertyValueArray * GetArray() const
void UnloadLibrary(TKeyframeLibrary *a_pLibrary)
TKeyframeLibraryManager & GetKeyframeLibraryManager()
static TFORCEINLINE TRenderInterface * GetSingleton()
TString8 & Format(const TCHAR *a_pcFormat,...)
void LoadLibrariesFromProperties(const PBPropertyValue *a_pArray, Toshi::TTRB *a_pTRB)
~AKeyFrameLibraryManager()
TBOOL UnrefLibrary(const Toshi::TPString8 &a_rLibraryName)
TBOOL LoadLibrary(const Toshi::TPString8 &a_rLibraryName, Toshi::TTRB *a_pTRB=nullptr)
AKeyFrameLibraryManager()