more torquescript template fixes.

This commit is contained in:
Jeff Hutchinson 2021-05-04 22:49:19 -04:00
parent 6f7fdca87d
commit b2bbd771f6
54 changed files with 122 additions and 99 deletions

View file

@ -242,6 +242,8 @@ function AssetBrowser::selectAsset( %this, %asset )
//eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";");
if( AssetBrowser.returnType $= "name" )
{
// TODO!
%name = "";
eval( "" @ AssetBrowser.selectCallback @ "(" @ %name @ ");");
}
else
@ -663,6 +665,7 @@ function AssetBrowser::loadDirectories( %this )
//Remove any modules that have no assets if we have that filter on
if(%this.onlyShowModulesWithAssets)
{
%modulesList = ModuleDatabase.findModules();
for(%i=0; %i < getWordCount(%modulesList); %i++)
{
%moduleName = getWord(%modulesList, %i).ModuleId;
@ -905,6 +908,8 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc)
if ( %name $= "" )
%name = %class;
// TODO
%group = "";
if ( %this.currentCreatorGroup !$= "" && %group $= "" )
%group = %this.currentCreatorGroup;
@ -1048,6 +1053,13 @@ function AssetBrowser::toggleTagFilterPopup(%this)
//now, add the asset's category
%assetType = AssetDatabase.getAssetCategory(%assetId);
// TODO?
%text = "";
%var = "";
%cmd = "";
%textLength = strlen(%text);
// end todo
%checkBox = new GuiCheckBoxCtrl()
{
canSaveDynamicFields = "0";
@ -1108,6 +1120,9 @@ function AssetBrowser::reImportAsset(%this)
//if(%assetType $= "ImageAsset")
// %filters = "";
//TODO
%currentFile = "";
%dlg = new OpenFileDialog()
{
Filters = "(All Files (*.*)|*.*|";
@ -1412,10 +1427,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
AssetBrowser-->assetList.deleteAllObjects();
AssetPreviewArray.empty();
// uhh?? I just added global schenanagins here to make this work
%assetArray = $AssetBrowser::AssetArray;
if(isObject(%assetArray))
%assetArray.delete();
%assetArray = new ArrayObject();
$AssetBrowser::AssetArray = %assetArray;
//First, Query for our assets
%assetQuery = new AssetQuery();

View file

@ -277,6 +277,9 @@ function AssetBrowser::onDropFolder(%this, %filePath)
//First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale
//and not process their contents.
// TODO
%fileExt = "";
//If not modules, it's likely an art pack or other mixed files, so we'll import them as normal
if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") )
%this.importAssetListArray.add("ImageAsset", %filePath);

View file

@ -142,6 +142,7 @@ function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem)
%filePath = %assetItem.filePath;
%assetName = %assetItem.assetName;
%assetConfigObj = %assetItem.importConfig;
%optionsObj = %assetItem.optionsObj; // TODO IS THIS RIGHT
ImportOptionsList.startGroup("Asset");
ImportOptionsList.addField("AssetName", "Asset Name", "string", "", "NewAsset", "", %assetItem);
@ -405,6 +406,7 @@ function ImportAssetConfigEditorWindow::editConfig(%this)
function ImportAssetConfigEditorWindow::deleteConfig(%this)
{
%configList = ImportAssetConfigSettingsList;
for(%i=0; %i < %configList.count(); %i++)
{

View file

@ -110,7 +110,7 @@ function AssetBrowser::renameComponentAsset(%this, %assetDef, %newAssetId, %orig
%line = %file.readLine();
%line = trim( %line );
%editedFileContents = %editedFileContents @ strreplace(%line, %originalAssetName, %newName) @ "\n";
%editedFileContents = %editedFileContents @ strreplace(%line, %originalName, %newName) @ "\n";
}
%file.close();

View file

@ -37,6 +37,8 @@ function AssetBrowser::createCpp(%this)
TamlWrite(%asset, %tamlpath);*/
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);

View file

@ -137,7 +137,7 @@ function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
%previewData.assetPath = %assetDef.getLevelPath();
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
%levelPreviewImage = %assetDesc.PreviewImage;
%levelPreviewImage = %assetDef.PreviewImage;
if(isFile(%levelPreviewImage))
%previewData.previewImage = %levelPreviewImage;

View file

@ -49,8 +49,7 @@ function AssetBrowser::importScriptAsset(%this, %assetId)
function AssetBrowser::onScriptAssetEditorDropped(%this, %assetDef, %position)
{
if(!isObject(%dropTarget))
return;
}
//Renames the asset

View file

@ -86,6 +86,9 @@ function AssetBrowser::editStateMachineAsset(%this, %assetDef)
function AssetBrowser::duplicateStateMachineAsset(%this, %assetDef)
{
// TODO:
%targetModule = "";
//Check if we have a target module, if not we need to select one
if(%targetModule $= "")
{

View file

@ -325,7 +325,7 @@ function directoryHandler::copyFolder(%this, %fromFolder, %toFolder)
if(!%success)
error("copyProjectFolder() - failed to copy file: " @ %file);
%file = findNextFileMultiExpr( %fullPath @ "/*.*" );
%file = findNextFileMultiExpr( %fromFolder @ "/*.*" );
}
//do sub directories

View file

@ -143,6 +143,10 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
//Update the selection to immediately jump to the new asset
AssetBrowser-->filterTree.clearSelection();
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
// TODO is this correct?
%assetType = %ModuleItem.getClassName();
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
AssetBrowser-->filterTree.selectItem(%assetTypeId);
@ -236,9 +240,9 @@ function moveAssetFile(%assetDef, %destinationPath)
%assetPath = makeFullPath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()));
%assetFilename = fileName(%assetPath);
%newAssetPath = %destination @ "/" @ %assetFilename;
%newAssetPath = %destinationPath @ "/" @ %assetFilename;
%copiedSuccess = pathCopy(%assetPath, %destination @ "/" @ %assetFilename);
%copiedSuccess = pathCopy(%assetPath, %destinationPath @ "/" @ %assetFilename);
if(!%copiedSuccess)
return "";