mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Implemented proper ScriptAsset execution on load
Implemented script dependency handling Added test-case of script dependency handling in ExampleModule Cleanup of redundant getSceneCount calls Properly get scene count in callGamemodeFunction Remove unneeded TODO comment in shaders Converted onMissionEnded gamemode func call to use callGameModeFunction function Convert ExampleGameMode to be container-object based, and updated callGamemodeFunction to handle that Correct import settings typoe so image suffixes are read correctly Largely fixed companion image scanning when importing images and streamlined image-material interop during import preprocessing Added handling for reading in PBR maps and creating a composite image + asset Added WIP of Cubemap asset, and editing integration with a standalone cubemap editor Added ability to create new Cubemap asset in Asset Browser
This commit is contained in:
parent
7c3bd49615
commit
9db95f4fb2
28 changed files with 1325 additions and 746 deletions
|
|
@ -123,6 +123,50 @@ void ScriptAsset::copyTo(SimObject* object)
|
|||
Parent::copyTo(object);
|
||||
}
|
||||
|
||||
void ScriptAsset::initializeAsset()
|
||||
{
|
||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
||||
|
||||
if (Platform::isFile(mScriptFile))
|
||||
{
|
||||
//We're initialized properly, so we'll go ahead and kick along any dependencies we may have as well
|
||||
AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId);
|
||||
|
||||
// Does the asset have any dependencies?
|
||||
if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end())
|
||||
{
|
||||
// Iterate all dependencies.
|
||||
while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId)
|
||||
{
|
||||
AssetPtr<ScriptAsset> scriptAsset = assetDependenciesItr->value;
|
||||
|
||||
mScriptAssets.push_front(scriptAsset);
|
||||
|
||||
// Next dependency.
|
||||
assetDependenciesItr++;
|
||||
}
|
||||
}
|
||||
|
||||
Con::executeFile(mScriptFile, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptAsset::onAssetRefresh()
|
||||
{
|
||||
mScriptFile = expandAssetFilePath(mScriptFile);
|
||||
|
||||
if (Platform::isFile(mScriptFile))
|
||||
{
|
||||
//Refresh any dependencies we may have
|
||||
for (U32 i = 0; i < mScriptAssets.size(); i++)
|
||||
{
|
||||
mScriptAssets[i]->onAssetRefresh();
|
||||
}
|
||||
|
||||
Con::executeFile(mScriptFile, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptAsset::setScriptFile(const char* pScriptFile)
|
||||
{
|
||||
// Sanity!
|
||||
|
|
@ -144,6 +188,13 @@ void ScriptAsset::setScriptFile(const char* pScriptFile)
|
|||
|
||||
bool ScriptAsset::execScript()
|
||||
{
|
||||
AssetBase* handle = mpOwningAssetManager->acquireAsset<AssetBase>(getAssetId());
|
||||
|
||||
if (handle)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
if (Platform::isFile(mScriptFile))
|
||||
{
|
||||
return Con::executeFile(mScriptFile, false, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue