From 880ac5a264b86e7b52c052f5e2652889e5716c1c Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Tue, 12 Apr 2022 19:46:19 -0500 Subject: [PATCH] bump down saveScaledImage default to 256 also add a "Assets/Browser/PreviewImageSize" value lookup, which if left blank defaults to 256 --- Engine/source/gfx/bitmap/gBitmap.cpp | 4 ++-- .../game/tools/assetBrowser/scripts/assetTypes/image.tscript | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/gfx/bitmap/gBitmap.cpp b/Engine/source/gfx/bitmap/gBitmap.cpp index 21e1351f8..281ee7a5d 100644 --- a/Engine/source/gfx/bitmap/gBitmap.cpp +++ b/Engine/source/gfx/bitmap/gBitmap.cpp @@ -1362,7 +1362,7 @@ DefineEngineFunction( getBitmapInfo, String, ( const char *filename ),, image->getFormat()); } -DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const char* bitmapDest, S32 resolutionSize), ("", "", 512), +DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const char* bitmapDest, S32 resolutionSize), ("", "", 256), "Loads an image from the source path, and scales it down to the target resolution before" "Saving it out to the destination path.\n") { @@ -1419,7 +1419,7 @@ DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const cha image->extrudeMipLevels(); U32 mipCount = image->getNumMipLevels(); - U32 targetMips = mFloor(mLog2((F32)resolutionSize)) + 1; + U32 targetMips = mFloor(mLog2((F32)(resolutionSize ? resolutionSize : 256))) + 1; if (mipCount > targetMips) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript index df8b2467c..167b3f197 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript @@ -202,7 +202,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %f { displayEditorLoadingGui("Generating Image Asset Preview..."); - %success = saveScaledImage(%assetDef.getImagePath(), %previewFilePath); + %success = saveScaledImage(%assetDef.getImagePath(), %previewFilePath, EditorSettings.value("Assets/Browser/PreviewImageSize")); if(%success) {