mini cleanups for ab

seems some operating systems don't play nice with setting `extent =` outside of a define{init} block,
cleaned up %assetarray using $AssetBrowser::AssetArray
cleanup for terrain definition path display
This commit is contained in:
AzaezelX 2021-08-30 01:50:47 -05:00
parent ef6efbf738
commit 66d7b0c49f
2 changed files with 25 additions and 26 deletions

View file

@ -479,13 +479,12 @@ function AssetBrowser::buildAssetPreview( %this, %asset, %moduleName )
{ {
%previewButton.iconLocation = "Left"; %previewButton.iconLocation = "Left";
%previewButton.textLocation = "Right"; %previewButton.textLocation = "Right";
%previewButton.extent = "120 20"; %previewButton.setextent(120,20);
} }
else else
{ {
%size = %previewSize.x * %previewScaleSize; %size = %previewSize.x * %previewScaleSize;
%previewButton.extent.x = %size; %previewButton.setextent(%size,%size + %textBottomPad);
%previewButton.extent.y = %size + %textBottomPad;
} }
//%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24; //%previewButton.extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24;
@ -1402,10 +1401,10 @@ function AssetBrowser::doRebuildAssetArray(%this)
AssetBrowser-->assetList.deleteAllObjects(); AssetBrowser-->assetList.deleteAllObjects();
AssetPreviewArray.empty(); AssetPreviewArray.empty();
if(isObject(%assetArray)) if(isObject($AssetBrowser::AssetArray))
%assetArray.delete(); $AssetBrowser::AssetArray.delete();
%assetArray = new ArrayObject(); $AssetBrowser::AssetArray = new ArrayObject();
//First, Query for our assets //First, Query for our assets
%assetQuery = new AssetQuery(); %assetQuery = new AssetQuery();
@ -1486,7 +1485,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%assetName, %assetType)) if(matchesSearch(%assetName, %assetType))
{ {
%assetArray.add( %moduleName, %assetId); $AssetBrowser::AssetArray.add( %moduleName, %assetId);
if(%assetType !$= "Folder") if(%assetType !$= "Folder")
%finalAssetCount++; %finalAssetCount++;
@ -1500,7 +1499,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(AssetBrowser.assetTypeFilter $= %assetType) if(AssetBrowser.assetTypeFilter $= %assetType)
{ {
%assetArray.add( %moduleName, %assetId ); $AssetBrowser::AssetArray.add( %moduleName, %assetId );
if(%assetType !$= "Folder") if(%assetType !$= "Folder")
%finalAssetCount++; %finalAssetCount++;
@ -1509,7 +1508,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
else else
{ {
//got it. //got it.
%assetArray.add( %moduleName, %assetId ); $AssetBrowser::AssetArray.add( %moduleName, %assetId );
if(%assetType !$= "Folder") if(%assetType !$= "Folder")
%finalAssetCount++; %finalAssetCount++;
@ -1531,7 +1530,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%folderName, "Folder", "")) if(matchesSearch(%folderName, "Folder", ""))
{ {
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); $AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
continue; continue;
} }
} }
@ -1547,7 +1546,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
if(!%this.toolsModulesFilter && %folderName $= "tools" && %breadcrumbPath $= "") if(!%this.toolsModulesFilter && %folderName $= "tools" && %breadcrumbPath $= "")
continue; continue;
%assetArray.add( %breadcrumbPath, "Folder" TAB %folderName ); $AssetBrowser::AssetArray.add( %breadcrumbPath, "Folder" TAB %folderName );
} }
} }
} }
@ -1577,14 +1576,14 @@ function AssetBrowser::doRebuildAssetArray(%this)
%dbName = %obj.getName(); %dbName = %obj.getName();
if(matchesSearch(%dbName, "Datablock")) if(matchesSearch(%dbName, "Datablock"))
{ {
%assetArray.add( %dbFilename, "Datablock" TAB %dbName ); $AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName );
} }
} }
} }
else if(%dbFilePath $= %breadcrumbPath) else if(%dbFilePath $= %breadcrumbPath)
{ {
%dbName = %obj.getName(); %dbName = %obj.getName();
%assetArray.add( %dbFilename, "Datablock" TAB %dbName ); $AssetBrowser::AssetArray.add( %dbFilename, "Datablock" TAB %dbName );
/*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category); /*%catItem = AssetBrowser-->filterTree.findItemByName(%obj.category);
@ -1609,7 +1608,7 @@ function AssetBrowser::doRebuildAssetArray(%this)
%looseFileName = fileName(%looseFileFullPath); %looseFileName = fileName(%looseFileFullPath);
%looseFileExt = fileExt(%looseFileFullPath); %looseFileExt = fileExt(%looseFileFullPath);
%assetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName ); $AssetBrowser::AssetArray.add( %looseFilePath, "LooseFile" TAB %looseFileName );
} }
//Prefabs //Prefabs
@ -1628,13 +1627,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%prefabName, "Prefab")) if(matchesSearch(%prefabName, "Prefab"))
{ {
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName ); $AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName );
} }
} }
} }
else if(%prefabPath $= %breadcrumbPath) else if(%prefabPath $= %breadcrumbPath)
{ {
%assetArray.add( %prefabPath, "Prefab" TAB %prefabName ); $AssetBrowser::AssetArray.add( %prefabPath, "Prefab" TAB %prefabName );
} }
%fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr ); %fullPrefabPath = findNextFile( %breadcrumbPath @ "/" @ %expr );
@ -1654,13 +1653,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%cppName, "Cpp")) if(matchesSearch(%cppName, "Cpp"))
{ {
%assetArray.add( %cppPath, "Cpp" TAB %cppName ); $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
} }
} }
} }
else if(%cppPath $= %breadcrumbPath) else if(%cppPath $= %breadcrumbPath)
{ {
%assetArray.add( %cppPath, "Cpp" TAB %cppName ); $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
} }
} }
@ -1678,13 +1677,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%cppName, "Cpp")) if(matchesSearch(%cppName, "Cpp"))
{ {
%assetArray.add( %cppPath, "Cpp" TAB %cppName ); $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
} }
} }
} }
else if(%cppPath $= %breadcrumbPath) else if(%cppPath $= %breadcrumbPath)
{ {
%assetArray.add( %cppPath, "Cpp" TAB %cppName ); $AssetBrowser::AssetArray.add( %cppPath, "Cpp" TAB %cppName );
} }
} }
@ -1726,13 +1725,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
{ {
if(matchesSearch(%tscriptName, "tscript")) if(matchesSearch(%tscriptName, "tscript"))
{ {
%assetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); $AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
} }
} }
} }
else if(%tscriptPath $= %breadcrumbPath) else if(%tscriptPath $= %breadcrumbPath)
{ {
%assetArray.add( %tscriptPath, "tscript" TAB %tscriptName ); $AssetBrowser::AssetArray.add( %tscriptPath, "tscript" TAB %tscriptName );
} }
} }
} }
@ -1754,13 +1753,13 @@ function AssetBrowser::doRebuildAssetArray(%this)
%name = %creatorObj.val[1]; %name = %creatorObj.val[1];
%func = %creatorObj.val[2]; %func = %creatorObj.val[2];
%assetArray.add( %name, "Creator" TAB %creatorObj ); $AssetBrowser::AssetArray.add( %name, "Creator" TAB %creatorObj );
} }
} }
} }
for(%i=0; %i < %assetArray.count(); %i++) for(%i=0; %i < $AssetBrowser::AssetArray.count(); %i++)
AssetBrowser.buildAssetPreview( %assetArray.getValue(%i), %assetArray.getKey(%i) ); AssetBrowser.buildAssetPreview( $AssetBrowser::AssetArray.getValue(%i), $AssetBrowser::AssetArray.getKey(%i) );
AssetBrowser_FooterText.text = %finalAssetCount @ " Assets"; AssetBrowser_FooterText.text = %finalAssetCount @ " Assets";

View file

@ -169,7 +169,7 @@ function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData)
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
"\nAsset Type: Terrain Asset" @ "\nAsset Type: Terrain Asset" @
"\nAsset Definition ID: " @ %assetDef @ "\nAsset Definition ID: " @ %assetDef @
"\nDefinition Path: " @ %assetPath @ %assetDef.getTerrainFilePath(); "\nDefinition Path: " @ %assetDef.getTerrainFilePath();
} }
function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName ) function GuiInspectorTypeTerrainAssetPtr::onClick( %this, %fieldName )