mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Shifts utilization of gui elements in editors that point to 'normal' image assets to utilize generated previews instead.
This reduces console spam about mismatched texture profiles and improves stability.
This commit is contained in:
parent
e9414a1660
commit
eb24b63be4
9 changed files with 168 additions and 277 deletions
|
|
@ -2488,3 +2488,50 @@ function AssetBrowser::importLooseFiles(%this)
|
|||
echo("Adding loose files at directory " @ %this.dirHandler.currentAddress);
|
||||
LooseFileAuditWindow.showDialog(%this.dirHandler.currentAddress);
|
||||
}
|
||||
|
||||
//
|
||||
function getAssetPreviewImage(%asset)
|
||||
{
|
||||
if(isFile(%asset))
|
||||
{
|
||||
%aq = new AssetQuery();
|
||||
%assetsFound = AssetDatabase.findAssetLooseFile(%aq, %asset);
|
||||
if(%assetsFound != 0)
|
||||
{
|
||||
%asset = %aq.getAsset(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewPath = %asset;
|
||||
}
|
||||
|
||||
%aq.delete();
|
||||
}
|
||||
|
||||
if(AssetDatabase.isDeclaredAsset(%asset))
|
||||
{
|
||||
%moduleName = AssetDatabase.getAssetModule(%asset).ModuleId;
|
||||
%assetName = AssetDatabase.getAssetName(%asset);
|
||||
%previewAssetName = "ToolsModule:" @ %moduleName @ "_" @ %assetName @ "_PreviewImage";
|
||||
|
||||
if(AssetDatabase.isDeclaredAsset(%previewAssetName))
|
||||
{
|
||||
%previewDef = AssetDatabase.acquireAsset(%previewAssetName);
|
||||
%previewPath = %previewDef.getImagePath();
|
||||
AssetDatabase.releaseAsset(%previewAssetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewPath = %asset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewPath = %asset;
|
||||
}
|
||||
|
||||
if(%previewPath $= "")
|
||||
%previewPath = "ToolsModule:unknownImage_image";
|
||||
|
||||
return %previewPath;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue