Adds functions to get the full path for level and shape asset files

Updated choose level UI to use getLevelPath function so it works again
Added a check for mis.dso for choose level UI as well in case it was compiled
Updated open asset in shape editor logic to use getShapeFile so it works again
Fixed on-exit crash after drag-n-drop importing of assets into the AB by properly using the import config object as a pointered object
Added sanity check when inspecting a TSStatic, if there isn't a materials inspector group for whatever reason to prevent a crash
Added filter logic so if in select mode for a specific asset type, it won't show datablocks, prefabs or other loosefiles
Removed unneeded setting of AB's current address path when creating a new terrain material asset
Added logic for forcing field validation in the create a new asset window. This fixes a problem where if you'd typed in a field but didn't hit enter and then immediately hit the done button, the typed string wasn't used.
This commit is contained in:
Areloch 2020-08-12 13:11:13 -05:00
parent 3108a08650
commit 69bfbb0978
14 changed files with 221 additions and 153 deletions

View file

@ -1524,90 +1524,94 @@ function AssetBrowser::doRebuildAssetArray(%this)
}
//Add Non-Asset Scripted Objects. Datablock, etc based
%category = getWord( %breadcrumbPath, 1 );
%dataGroup = "DataBlockGroup";
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
if(AssetBrowser.assetTypeFilter $= "")
{
%obj = %dataGroup.getObject(%i);
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
%category = getWord( %breadcrumbPath, 1 );
%dataGroup = "DataBlockGroup";
//if ( %obj.category $= "" && %obj.category == 0 )
// continue;
%dbFilename = %obj.getFileName();
%dbFilePath = filePath(%dbFilename);
%searchActive = AssetSearchTerms.count() != 0;
if(%searchActive)
for ( %i = 0; %i < %dataGroup.getCount(); %i++ )
{
if(startsWith(%dbFilePath, %breadcrumbPath))
%obj = %dataGroup.getObject(%i);
// echo ("Obj: " @ %obj.getName() @ " - " @ %obj.category );
//if ( %obj.category $= "" && %obj.category == 0 )
// continue;
%dbFilename = %obj.getFileName();
%dbFilePath = filePath(%dbFilename);
%searchActive = AssetSearchTerms.count() != 0;
if(%searchActive)
{
if(startsWith(%dbFilePath, %breadcrumbPath))
{
%dbName = %obj.getName();
if(matchesSearch(%dbName, "Datablock"))
{
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
}
}
}
else if(%dbFilePath $= %breadcrumbPath)
{
%dbName = %obj.getName();
if(matchesSearch(%dbName, "Datablock"))
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
/*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
if(%catItem == 0)
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.category, "scripted");*/
/*%ctrl = %this.findIconCtrl( %obj.category );
if ( %ctrl == -1 )
{
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
}
%this.addFolderIcon( %obj.category );
}*/
}
}
else if(%dbFilePath $= %breadcrumbPath)
%this.getLooseFilesInDir();
%looseFiles = ABLooseFileArray.count();
for( %i=0; %i < %looseFiles; %i++)
{
%dbName = %obj.getName();
%assetArray.add( %dbFilename, "Datablock" TAB %dbName );
%looseFileFullPath = ABLooseFileArray.getKey(%i);
%looseFilePath = filePath(%looseFileFullPath);
%looseFileName = fileName(%looseFileFullPath);
/*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
if(%catItem == 0)
AssetBrowser-->filterTree.insertItem(%scriptedItem, %obj.category, "scripted");*/
/*%ctrl = %this.findIconCtrl( %obj.category );
if ( %ctrl == -1 )
{
%this.addFolderIcon( %obj.category );
}*/
%assetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName );
}
}
%this.getLooseFilesInDir();
%looseFiles = ABLooseFileArray.count();
for( %i=0; %i < %looseFiles; %i++)
{
%looseFileFullPath = ABLooseFileArray.getKey(%i);
%looseFilePath = filePath(%looseFileFullPath);
%looseFileName = fileName(%looseFileFullPath);
//Prefabs
%expr = "*.prefab";
%fullPrefabPath = findFirstFile( %breadcrumbPath @ "/" @ %expr );
%assetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName );
}
//Prefabs
%expr = "*.prefab";
%fullPrefabPath = findFirstFile( %breadcrumbPath @ "/" @ %expr );
while ( %fullPrefabPath !$= "" )
{
%prefabPath = filePath(%fullPrefabPath);
%prefabName = fileName(%fullPrefabPath);
%searchActive = AssetSearchTerms.count() != 0;
if(%searchActive)
{
if(startsWith(%prefabPath, %breadcrumbPath))
while ( %fullPrefabPath !$= "" )
{
%prefabPath = filePath(%fullPrefabPath);
%prefabName = fileName(%fullPrefabPath);
%searchActive = AssetSearchTerms.count() != 0;
if(%searchActive)
{
if(matchesSearch(%prefabName, "Prefab"))
if(startsWith(%prefabPath, %breadcrumbPath))
{
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
}
if(matchesSearch(%prefabName, "Prefab"))
{
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
}
}
}
else if(%prefabPath $= %breadcrumbPath)
{
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
}
}
else if(%prefabPath $= %breadcrumbPath)
{
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName );
}
%fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr );
%fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr );
}
}
for(%i=0; %i < %assetArray.count(); %i++)
for(%i=0; %i < %assetArray.count(); %i++)
AssetBrowser.buildAssetPreview( %assetArray.getValue(%i), %assetArray.getKey(%i) );
AssetBrowser_FooterText.text = %finalAssetCount @ " Assets";

View file

@ -134,7 +134,7 @@ function AssetBrowser::moveLevelAsset(%this, %assetDef, %destination)
function AssetBrowser::buildLevelAssetPreview(%this, %assetDef, %previewData)
{
%previewData.assetName = %assetDef.assetName;
%previewData.assetPath = %assetDef.levelFile;
%previewData.assetPath = %assetDef.getlevelFile();
%previewData.doubleClickCommand = "schedule( 1, 0, \"EditorOpenMission\", "@%assetDef@");";
%levelPreviewImage = %assetDesc.PreviewImage;

View file

@ -153,6 +153,12 @@ function newAssetUpdatePath(%newPath)
//We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function
function CreateNewAsset()
{
//To enusre that any in-progress-of-being-edited field applies it's changes
%lastEditField = AssetBrowser_newAsset.getFirstResponder();
if(%lastEditField.isMethod("forceValidateText"))
%lastEditField.forceValidateText();
%assetName = AssetBrowser.newAssetSettings.assetName;
if(%assetName $= "")