Parametrize script extension, default to 'tscript'

This commit is contained in:
Lukas Aldershaab 2020-12-12 16:54:16 +01:00
parent b8b62292bd
commit 099dd4f1f3
542 changed files with 774 additions and 783 deletions

View file

@ -46,13 +46,13 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this)
%moduleFilePath = "data/" @ %newModuleName;
%moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module";
%moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".cs";
%moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".tscript";
%newModule = new ModuleDefinition()
{
ModuleId = %newModuleName;
versionId = 1;
ScriptFile = %newModuleName @ ".cs";
ScriptFile = %newModuleName @ ".tscript";
CreateFunction="onCreate";
DestroyFunction="onDestroy";
Group = "Game";
@ -70,7 +70,7 @@ function AssetBrowser_addModuleWindow::CreateNewModule(%this)
%file = new FileObject();
%templateFile = new FileObject();
%moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.cs.template";
%moduleTemplateCodeFilePath = AssetBrowser.templateFilesPath @ "module.tscript.template";
if(%file.openForWrite(%moduleScriptFilePath) && %templateFile.openForRead(%moduleTemplateCodeFilePath))
{

View file

@ -41,13 +41,13 @@ function AssetBrowser_addPackageWindow::CreateNewPackage(%this)
%moduleFilePath = "data/" @ %newPackageName;
%moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".module";
%moduleScriptFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".cs";
%moduleScriptFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".tscript";
%newPackage = new ModuleDefinition()
{
ModuleId = %newPackageName;
versionId = 1;
ScriptFile = %newPackageName @ ".cs";
ScriptFile = %newPackageName @ ".tscript";
CreateFunction="onCreate";
DestroyFunction="onDestroy";
Group = "Game";

View file

@ -984,7 +984,7 @@ function AssetBrowser::deleteMaterial( %this, %materialName, %secondFilter, %sec
if( %materialName.getFilename() !$= "" &&
%materialName.getFilename() !$= "tools/gui/AssetBrowser.ed.gui" &&
%materialName.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.cs" )
%materialName.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed." @ $TorqueScriptFileExtension )
{
AssetBrowserPerMan.removeObjectFromFile(%materialName);
AssetBrowserPerMan.saveDirty();

View file

@ -151,7 +151,7 @@ function getAssetTypeByFilename(%filePath)
return "ShapeAsset";
else if( isSoundFormat(%fileExt))
return "SoundAsset";
else if( %fileExt $= ".cs" || %fileExt $= ".cs.dso" )
else if( %fileExt $= ".tscript" || %fileExt $= ".tscript.dso" )
return "ScriptAsset";
else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" )
return "GUIAsset";
@ -188,7 +188,7 @@ function AssetBrowser::onDropFile( %this, %filePath )
%assetItem = %this.addImportingAsset("ShapeAsset", %filePath);
else if( isSoundFormat(%fileExt))
%assetItem = %this.addImportingAsset("SoundAsset", %filePath);
else if( %fileExt $= ".cs" || %fileExt $= ".cs.dso" )
else if( %fileExt $= ".tscript" || %fileExt $= ".tscript.dso" )
%assetItem = %this.addImportingAsset("ScriptAsset", %filePath);
else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" )
%assetItem = %this.addImportingAsset("GUIAsset", %filePath);
@ -238,13 +238,13 @@ function AssetBrowser::onDropZipFile(%this, %filePath)
%this.importAssetListArray.add("SoundAsset", %filePath);
else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso"))
%this.importAssetListArray.add("GUIAsset", %filePath);
//else if( (%fileExt $= ".cs") || (%fileExt $= ".dso"))
//else if( (%fileExt $= ".tscript") || (%fileExt $= ".dso"))
// %this.importAssetListArray.add("Script", %filePath);
else if( (%fileExt $= ".mis"))
%this.importAssetListArray.add("LevelAsset", %filePath);*/
// For now, if it's a .cs file, we'll assume it's a behavior.
//if (fileExt(%fileFrom) !$= ".cs")
// For now, if it's a .tscript file, we'll assume it's a behavior.
//if (fileExt(%fileFrom) !$= ".tscript")
// continue;
%fileTo = expandFilename("^tools/assetBrowser/importTemp/") @ %fileFrom;
@ -286,13 +286,13 @@ function AssetBrowser::onDropFolder(%this, %filePath)
%this.importAssetListArray.add("SoundAsset", %filePath);
else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso"))
%this.importAssetListArray.add("GUIAsset", %filePath);
//else if( (%fileExt $= ".cs") || (%fileExt $= ".dso"))
//else if( (%fileExt $= ".tscript") || (%fileExt $= ".dso"))
// %this.importAssetListArray.add("Script", %filePath);
else if( (%fileExt $= ".mis"))
%this.importAssetListArray.add("LevelAsset", %filePath);
// For now, if it's a .cs file, we'll assume it's a behavior.
if (fileExt(%fileFrom) !$= ".cs")
// For now, if it's a .tscript file, we'll assume it's a behavior.
if (fileExt(%fileFrom) !$= ".tscript")
continue;
%fileTo = expandFilename("^game/behaviors/") @ fileName(%fileFrom);
@ -942,7 +942,7 @@ function ImportAssetWindow::addNewImportingAsset(%this, %filterType)
%type = "ShapeAsset";
else if( isSoundFormat(%fileExt))
%type = "SoundAsset";
else if( %fileExt $= ".cs" || %fileExt $= ".cs.dso" )
else if( %fileExt $= ".tscript" || %fileExt $= ".tscript.dso" )
%type = "ScriptAsset";
else if( %fileExt $= ".gui" || %fileExt $= ".gui.dso" )
%type = "GUIAsset";

View file

@ -6,7 +6,7 @@ function AssetBrowser::createComponentAsset(%this)
%assetName = AssetBrowser.newAssetSettings.assetName;
%tamlpath = %modulePath @ "/components/" @ %assetName @ ".asset.taml";
%scriptPath = %modulePath @ "/components/" @ %assetName @ ".cs";
%scriptPath = %modulePath @ "/components/" @ %assetName @ ".tscript";
%asset = new ComponentAsset()
{
@ -17,7 +17,7 @@ function AssetBrowser::createComponentAsset(%this)
friendlyName = AssetBrowser.newAssetSettings.friendlyName;
componentType = AssetBrowser.newAssetSettings.componentGroup;
description = AssetBrowser.newAssetSettings.description;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
};
TamlWrite(%asset, %tamlpath);
@ -25,7 +25,7 @@ function AssetBrowser::createComponentAsset(%this)
%file = new FileObject();
%templateFile = new FileObject();
%templateCodeFilePath = %this.templateFilesPath @ "componentFile.cs.template";
%templateCodeFilePath = %this.templateFilesPath @ "componentFile.tscript.template";
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%templateCodeFilePath))
{

View file

@ -9,13 +9,13 @@ function AssetBrowser::createGUIAsset(%this)
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%guipath = %assetPath @ %assetName @ ".gui";
%scriptPath = %assetPath @ %assetName @ ".cs";
%scriptPath = %assetPath @ %assetName @ ".tscript";
%asset = new GUIAsset()
{
AssetName = %assetName;
versionId = 1;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
guiFile = %assetName @ ".gui";
};
@ -48,7 +48,7 @@ function AssetBrowser::createGUIAsset(%this)
warnf("CreateGUIAsset - Something went wrong and we couldn't write the GUI file!");
}
%scriptTemplateCodeFilePath = %this.templateFilesPath @ "guiFile.cs.template";
%scriptTemplateCodeFilePath = %this.templateFilesPath @ "guiFile.tscript.template";
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%scriptTemplateCodeFilePath))
{

View file

@ -29,7 +29,7 @@ function AssetBrowser::createLevelAsset(%this)
versionId = 1;
LevelFile = %assetName @ ".mis";
DecalsFile = %assetName @ ".mis.decals";
PostFXPresetFile = %assetName @ ".postfxpreset.cs";
PostFXPresetFile = %assetName @ ".postfxpreset.tscript";
ForestFile = %assetName @ ".forest";
NavmeshFile = %assetName @ ".nav";
LevelName = AssetBrowser.newAssetSettings.levelName;

View file

@ -323,14 +323,14 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%sgfPath = %assetPath @ %assetName @ ".sgf";
%scriptPath = %assetPath @ %assetName @ ".cs";
%scriptPath = %assetPath @ %assetName @ ".tscript";
%newAsset = new MaterialAsset()
{
assetName = %assetName;
versionId = 1;
shaderGraph = %sgfPath;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
originalFilePath = %filePath;
materialDefinitionName = %assetName;
};

View file

@ -6,7 +6,7 @@ function AssetBrowser::createPostEffectAsset(%this)
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%scriptPath = %assetPath @ %assetName @ ".cs";
%scriptPath = %assetPath @ %assetName @ ".tscript";
%hlslPath = %assetPath @ %assetName @ "P.hlsl";
%glslPath = %assetPath @ %assetName @ "P.glsl";
@ -14,7 +14,7 @@ function AssetBrowser::createPostEffectAsset(%this)
{
AssetName = %assetName;
versionId = 1;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
hlslShader = %assetName @ "P.hlsl";
glslShader = %assetName @ "P.glsl";
};
@ -27,7 +27,7 @@ function AssetBrowser::createPostEffectAsset(%this)
%file = new FileObject();
%templateFile = new FileObject();
%postFXTemplateCodeFilePath = %this.templateFilesPath @ "postFXFile.cs.template";
%postFXTemplateCodeFilePath = %this.templateFilesPath @ "postFXFile.tscript.template";
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%postFXTemplateCodeFilePath))
{

View file

@ -8,13 +8,13 @@ function AssetBrowser::createScriptAsset(%this)
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%scriptPath = %assetPath @ %assetName @ ".cs";
%scriptPath = %assetPath @ %assetName @ ".tscript";
%asset = new ScriptAsset()
{
AssetName = %assetName;
versionId = 1;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
};
TamlWrite(%asset, %tamlpath);

View file

@ -9,13 +9,13 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%scriptPath = %assetPath @ %assetName @ ".cs";
%scriptPath = %assetPath @ %assetName @ ".tscript";
%asset = new TerrainMaterialAsset()
{
AssetName = %assetName;
versionId = 1;
scriptFile = %assetName @ ".cs";
scriptFile = %assetName @ ".tscript";
materialDefinitionName = %assetName;
};
@ -33,7 +33,7 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
%file = new FileObject();
%templateFile = new FileObject();
%templateFilePath = %this.templateFilesPath @ "terrainMaterial.cs.template";
%templateFilePath = %this.templateFilesPath @ "terrainMaterial.tscript.template";
if(%file.openForWrite(%scriptPath) && %templateFile.openForRead(%templateFilePath))
{

View file

@ -301,7 +301,7 @@ function AssetBrowser::doDuplicateAsset(%this)
{
//this acts as a redirect based on asset type and will enact the appropriate function
//so for a GameObjectAsset, it'll become %this.duplicateGameObjectAsset(%assetDef, %targetModule);
//and call to the tools/assetBrowser/scripts/assetTypes/gameObject.cs file for implementation
//and call to the tools/assetBrowser/scripts/assetTypes/gameObject.tscript file for implementation
if(%this.isMethod("duplicate"@%assetType))
eval(%this @ ".duplicate"@%assetType@"("@%assetDef@","@AssetBrowser_assetNameEditTxt.text@");");

View file

@ -232,7 +232,7 @@ function AssetBrowser::RefreshModuleDependencies(%this, %moduleDef)
//AssetBrowser.RefreshModuleDependencies(16823);
%modulePath = filePath(%moduleDef.ModuleFilePath);
%filePattern = "*.cs" TAB "*.taml" TAB "*.mis";
%filePattern = "*.tscript" TAB "*.taml" TAB "*.mis";
//First, wipe out any files inside the folder first
%file = makeFullPath(findFirstFileMultiExpr( %filePattern, true));

View file

@ -74,7 +74,7 @@ function GameObjectCreateBtn::onClick(%this)
%file = new FileObject();
if(%file.openForWrite(%path @ "\\" @ %className @ ".cs"))
if(%file.openForWrite(%path @ "\\" @ %className @ ".tscript"))
{
%file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n");
%file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n");
@ -86,7 +86,7 @@ function GameObjectCreateBtn::onClick(%this)
//set up the paths
%tamlPath = %path @ %className @ ".taml";
%scriptPath = %path @ %className @ ".cs";
%scriptPath = %path @ %className @ ".tscript";
saveGameObject(%className, %tamlPath, %scriptPath);
%asset = new GameObjectAsset()

View file

@ -15,7 +15,7 @@ function LooseFileAuditWindow::buildPopupMenus(%this)
};
}
//Done with .cs files
//Done with .tscript files
if( !isObject( ScriptLooseFilePopup ) )
{
%this.ImportAssetActions = new PopupMenu( ScriptLooseFilePopup )
@ -159,7 +159,7 @@ function LooseFileList::onRightMouseDown(%this, %itemId)
{
ImageLooseFilePopup.showPopup(Canvas);
}
else if(%ext $= ".cs")
else if(%ext $= ".tscript")
{
ScriptLooseFilePopup.showPopup(Canvas);
}