Console Refactor

This commit is contained in:
Lukas Aldershaab 2023-04-23 10:39:54 +02:00
parent 626de074cc
commit 89b0c7f73b
89 changed files with 1883 additions and 1553 deletions

View file

@ -41,6 +41,7 @@
#endif
// Debug Profiling.
#include "console/script.h"
#include "platform/profiler.h"
//-----------------------------------------------------------------------------
@ -140,7 +141,7 @@ void CubemapAsset::initializeAsset()
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}
@ -148,7 +149,7 @@ void CubemapAsset::onAssetRefresh()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}

View file

@ -41,6 +41,7 @@
#endif
// Debug Profiling.
#include "console/script.h"
#include "platform/profiler.h"
//-----------------------------------------------------------------------------
@ -118,12 +119,12 @@ void GUIAsset::initializeAsset()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath;
if (Torque::FS::IsScriptFile(mGUIPath))
if (Con::isScriptFile(mGUIPath))
Con::executeFile(mGUIPath, false, false);
}
@ -131,12 +132,12 @@ void GUIAsset::onAssetRefresh()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
mGUIPath = getOwned() ? expandAssetFilePath(mGUIFile) : mGUIPath;
if (Torque::FS::IsScriptFile(mGUIPath))
if (Con::isScriptFile(mGUIPath))
Con::executeFile(mGUIPath, false, false);
}

View file

@ -41,6 +41,7 @@
#endif
// Debug Profiling.
#include "console/script.h"
#include "platform/profiler.h"
//-----------------------------------------------------------------------------
@ -134,7 +135,7 @@ void GameObjectAsset::initializeAsset()
//Ensure we have an expanded filepath
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
mTAMLPath = getOwned() ? expandAssetFilePath(mTAMLFile) : mTAMLPath;
@ -145,7 +146,7 @@ void GameObjectAsset::onAssetRefresh()
//Ensure we have an expanded filepath
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
mTAMLPath = getOwned() ? expandAssetFilePath(mTAMLFile) : mTAMLPath;

View file

@ -40,6 +40,7 @@
#include "assets/assetPtr.h"
#endif
#include "console/script.h"
#include "T3D/assets/assetImporter.h"
StringTableEntry MaterialAsset::smNoMaterialAssetFallback = NULL;
@ -179,7 +180,7 @@ void MaterialAsset::initializeAsset()
{
mLoadedState = EmbeddedDefinition;
}
else if (Torque::FS::IsScriptFile(mScriptPath))
else if (Con::isScriptFile(mScriptPath))
{
if (!Sim::findObject(mMatDefinitionName))
{
@ -211,7 +212,7 @@ void MaterialAsset::onAssetRefresh()
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
{
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
//But that definition, whatever it is, is the 'correct' one, so we enable the Replace Existing behavior

View file

@ -41,6 +41,7 @@
#endif
// Debug Profiling.
#include "console/script.h"
#include "platform/profiler.h"
//-----------------------------------------------------------------------------
@ -137,7 +138,7 @@ void PostEffectAsset::initializeAsset()
mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath;
mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}
@ -147,7 +148,7 @@ void PostEffectAsset::onAssetRefresh()
mHLSLShaderPath = getOwned() ? expandAssetFilePath(mHLSLShaderFile) : mHLSLShaderPath;
mGLSLShaderPath = getOwned() ? expandAssetFilePath(mGLSLShaderFile) : mGLSLShaderPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
Con::executeFile(mScriptPath, false, false);
}

View file

@ -40,6 +40,7 @@
#endif
// Debug Profiling.
#include "console/script.h"
#include "platform/profiler.h"
//-----------------------------------------------------------------------------
@ -140,7 +141,7 @@ void ScriptAsset::initializeAsset()
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
{
//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);
@ -170,7 +171,7 @@ void ScriptAsset::onAssetRefresh()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
{
//Refresh any dependencies we may have
for (U32 i = 0; i < mScriptAssetDependencies.size(); i++)
@ -215,7 +216,7 @@ bool ScriptAsset::execScript()
if (handle)
return true;
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
{
return Con::executeFile(mScriptPath, false, false);
}

View file

@ -40,6 +40,7 @@
#include "assets/assetPtr.h"
#endif
#include "console/script.h"
#include "T3D/assets/assetImporter.h"
StringTableEntry TerrainMaterialAsset::smNoTerrainMaterialAssetFallback = NULL;
@ -182,7 +183,7 @@ void TerrainMaterialAsset::initializeAsset()
{
mLoadedState = EmbeddedDefinition;
}
else if (Torque::FS::IsScriptFile(mScriptPath))
else if (Con::isScriptFile(mScriptPath))
{
if (!Sim::findObject(mMatDefinitionName))
{
@ -214,7 +215,7 @@ void TerrainMaterialAsset::onAssetRefresh()
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
if (Con::isScriptFile(mScriptPath))
{
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
//But that definition, whatever it is, is the 'correct' one, so we enable the Replace Existing behavior

View file

@ -31,6 +31,7 @@
#include "console/consoleTypes.h"
#include "core/volume.h"
#include "console/engineAPI.h"
#include "console/script.h"
#include "T3D/physics/physicsShape.h"
#include "core/util/path.h"
@ -344,7 +345,7 @@ void Prefab::_loadFile( bool addFileNotify )
if ( mFilename == StringTable->EmptyString())
return;
if ( !Torque::FS::IsScriptFile( mFilename ) )
if ( !Con::isScriptFile( mFilename ) )
{
Con::errorf( "Prefab::_loadFile() - file %s was not found.", mFilename );
return;

View file

@ -27,6 +27,7 @@
#include "console/consoleTypes.h"
#include "console/engineAPI.h"
#include "collision/boxConvex.h"
#include "console/script.h"
#include "core/stream/bitStream.h"
#include "math/mathIO.h"