MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / initializeAsset

Method initializeAsset

Engine/source/T3D/assets/ScriptAsset.cpp:124–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124void ScriptAsset::initializeAsset()
125{
126 mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
127
128 if (Torque::FS::IsScriptFile(mScriptPath))
129 {
130 //We're initialized properly, so we'll go ahead and kick along any dependencies we may have as well
131 AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
132
133 // Does the asset have any dependencies?
134 if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
135 {
136 // Iterate all dependencies.
137 while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
138 {
139 AssetPtr<ScriptAsset> scriptAsset = assetDependenciesItr->value;
140
141 mScriptAssets.push_front(scriptAsset);
142
143 // Next dependency.
144 assetDependenciesItr++;
145 }
146 }
147
148 Con::executeFile(mScriptPath, false, false);
149 }
150}
151
152void ScriptAsset::onAssetRefresh()
153{

Callers

nothing calls this directly

Calls 6

IsScriptFileFunction · 0.85
executeFileFunction · 0.85
getDependedOnAssetsMethod · 0.80
findMethod · 0.45
endMethod · 0.45
push_frontMethod · 0.45

Tested by

no test coverage detected