Merge pull request #673 from Areloch/useImagePreviews

Shifts utilization of gui elements in editors that point to 'normal' image assets to utilize generated previews instead.
This commit is contained in:
Brian Roberts 2021-11-15 12:39:33 -06:00 committed by GitHub
commit b5bd242e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 168 additions and 277 deletions

View file

@ -549,7 +549,20 @@ bool GuiInspectorTypeImageAssetPtr::renderTooltip(const Point2I& hoverPos, const
if (!filename || !filename[0])
return false;
GFXTexHandle texture(filename, &GFXStaticTextureSRGBProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__));
StringTableEntry previewFilename = filename;
if (Con::isFunction("getAssetPreviewImage"))
{
ConsoleValue consoleRet = Con::executef("getAssetPreviewImage", filename);
previewFilename = StringTable->insert(consoleRet.getString());
if (AssetDatabase.isDeclaredAsset(previewFilename))
{
ImageAsset* previewAsset = AssetDatabase.acquireAsset<ImageAsset>(previewFilename);
previewFilename = previewAsset->getImagePath();
}
}
GFXTexHandle texture(previewFilename, &GFXStaticTextureSRGBProfile, avar("%s() - tooltip texture (line %d)", __FUNCTION__, __LINE__));
if (texture.isNull())
return false;